Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
software:gurobi:caviness [2020-04-16 19:04] – [MPI Python Environment] anita | software:gurobi:caviness [2021-03-16 10:07] – anita | ||
---|---|---|---|
Line 12: | Line 12: | ||
===== Serial or Threaded Python Environment ===== | ===== Serial or Threaded Python Environment ===== | ||
- | ==== Adding Gurobi to a Anaconda Environment === | + | ==== Adding Gurobi to a Anaconda Environment |
Based on the instructions on Gurobi' | Based on the instructions on Gurobi' | ||
Line 131: | Line 131: | ||
The below steps are based on copying a template job script and modifying '' | The below steps are based on copying a template job script and modifying '' | ||
- | <note tip>It is a good idea to periodically check in ''/ | + | <note tip>It is a good idea to periodically check in ''/ |
To start, use VALET to load Gurobi and Anaconda. Once those two packages are loaded, the Gurobi Anaconda environment will need to be activated. After the Gurobi Anaconda environment is activated, then the python script that uses Gurobi can be called and ran. After the python script has completed, then the Gurobi Anaconda environment will be need to be deactivated. | To start, use VALET to load Gurobi and Anaconda. Once those two packages are loaded, the Gurobi Anaconda environment will need to be activated. After the Gurobi Anaconda environment is activated, then the python script that uses Gurobi can be called and ran. After the python script has completed, then the Gurobi Anaconda environment will be need to be deactivated. | ||
Line 152: | Line 152: | ||
source activate ~${USER}/ | source activate ~${USER}/ | ||
- | python | + | python3 |
source deactivate | source deactivate | ||
Line 171: | Line 171: | ||
source activate ~${USER}/ | source activate ~${USER}/ | ||
- | python | + | python3 |
source deactivate | source deactivate | ||
Line 177: | Line 177: | ||
===== MPI Python Environment ===== | ===== MPI Python Environment ===== | ||
+ | |||
+ | ==== Adding Gurobi and mpi4py to a Python Environment ==== | ||
Using Gurobi with MPI requires mpi4py and in order for MPI to work properly on our cluster and to understand our networking, it must be compiled using our the version of Open MPI compiled for our cluster. | Using Gurobi with MPI requires mpi4py and in order for MPI to work properly on our cluster and to understand our networking, it must be compiled using our the version of Open MPI compiled for our cluster. | ||
Line 256: | Line 258: | ||
</ | </ | ||
- | Now, create a VALET package to handle the environment setup/ | + | ==== Creating a VALET package definition ==== |
+ | Now, create a VALET package to handle the environment setup/ | ||
<code bash> | <code bash> | ||
Line 278: | Line 281: | ||
</ | </ | ||
- | <note important> | + | <note important> |
- | If the '' | + | Check if the '' |
<code bash> | <code bash> | ||
Line 287: | Line 290: | ||
</ | </ | ||
- | If the '' | + | and in this case the directory does not exist, so create it: |
<code bash> | <code bash> | ||
Line 296: | Line 299: | ||
</ | </ | ||
- | Thereafter, here is a simple test using VALET to load the environment | + | Thereafter, here is a simple test using VALET to load the environment, test we have the correct version of python3, loading python3 and importing the packages gurobipy and mpi4py, exiting python3, and deactivating the environment: |
<code bash> | <code bash> | ||
- | [(it_css: | + | [(it_css: |
Adding dependency `libfabric/ | Adding dependency `libfabric/ | ||
Adding dependency `openmpi/ | Adding dependency `openmpi/ | ||
Line 305: | Line 308: | ||
Adding dependency `gurobi/ | Adding dependency `gurobi/ | ||
Adding package `gurobi-env/ | Adding package `gurobi-env/ | ||
- | |||
(/ | (/ | ||
/ | / | ||
+ | (/ | ||
+ | Python 3.7.7 (default, Mar 26 2020, 15:48:22) | ||
+ | [GCC 7.3.0] :: Anaconda, Inc. on linux | ||
+ | Type " | ||
+ | >>> | ||
+ | >>> | ||
+ | >>> | ||
+ | (/ | ||
+ | [(it_css: | ||
</ | </ | ||