software:gurobi:caviness

This is an old revision of the document!


Gurobi on Caviness

[traine@login00 ~]$ vpkg_versions gurobi
Available versions in package (* = default version):
 
[/opt/shared/valet/2.1/etc/gurobi.vpkg_yaml]
gurobi  The most powerful mathematical optimization solver out there
* 9.0.1 release 9.0.1 for Linux

Based on the instructions on Gurobi's site for installing the Anaconda Python distribution (https://www.gurobi.com/documentation/9.0/quickstart_linux/ins_the_anaconda_python_di.html#section:Anaconda). The following steps can be adapted from those instructions to create an Anaconda Python environment for running Gurobi.

The workgroup it_css will be used in this example. The anaconda environment will be created in the home directory of user traine. The workgroup ($WORKGROUP) and home directory ($HOME) should be changed to reflect your workgroup and home directory. If Gurobi is going to be used by multiple people in a workgroup, then it might be worth installing the Gurobi anaconda environment in a workgroup directory ($WORKDIR), instead of installing in each person's home directory. Installing it in a workgroup directory will allow everyone within a workgroup to share that Gurobi anaconda environment, and not have to create their own. See workgroup software installs on Caviness for more details.

[traine@login00 ~]$ workgroup -g it_css
[(it_css:traine)@login00 ~]$ vpkg_require gurobi
Adding package `gurobi/9.0.1` to your environment
[(it_css:traine)@login00 ~]$ vpkg_require anaconda/5.2.0:python3
Adding package `anaconda/5.2.0:python3` to your environment
[(it_css:traine)@login00 ~]$ conda config --add channels http://conda.anaconda.org/gurobi
[(it_css:traine)@login00 ~]$ conda create -p ~/gurobiproject
Solving environment: done
 
 
==> WARNING: A newer version of conda exists. <==
  current version: 4.5.11
  latest version: 4.8.3
 
Please update conda by running
 
    $ conda update -n base -c defaults conda
 
 
 
## Package Plan ##
 
  environment location: /home/1201/gurobiproject
 
 
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate /home/1201/gurobiproject
#
# To deactivate an active environment, use:
# > source deactivate
#
 
[(it_css:traine)@login00 ~]$ source activate $HOME/gurobiproject
(/home/1201/gurobiproject)[(it_css:traine)@login00 ~]$ conda install gurobi scipy pandas joblib
Solving environment: done
 
 
==> WARNING: A newer version of conda exists. <==
  current version: 4.5.11
  latest version: 4.8.3
 
Please update conda by running
 
    $ conda update -n base -c defaults conda
 
 
 
## Package Plan ##
 
  environment location: /home/2179/gurobiproject
 
  added / updated specs:
    - gurobi
    - joblib
    - pandas
    - scipy
 
 
The following NEW packages will be INSTALLED:
 
    _libgcc_mutex:    0.1-main
    blas:             1.0-mkl
    ca-certificates:  2020.1.1-0
    certifi:          2019.11.28-py37_1
    gurobi:           9.0.1-py37_0             gurobi
    intel-openmp:     2020.0-166
    joblib:           0.14.1-py_0
    ld_impl_linux-64: 2.33.1-h53a641e_7
    libedit:          3.1.20181209-hc058e9b_0
    libffi:           3.2.1-hd88cf55_4
    libgcc-ng:        9.1.0-hdf63c60_0
    libgfortran-ng:   7.3.0-hdf63c60_0
    libstdcxx-ng:     9.1.0-hdf63c60_0
    mkl:              2020.0-166
    mkl-service:      2.3.0-py37he904b0f_0
    mkl_fft:          1.0.15-py37ha843d7b_0
    mkl_random:       1.1.0-py37hd6b4f25_0
    ncurses:          6.2-he6710b0_0
    numpy:            1.18.1-py37h4f9e942_0
    numpy-base:       1.18.1-py37hde5b4d6_1
    openssl:          1.1.1e-h7b6447c_0
    pandas:           1.0.3-py37h0573a6f_0
    pip:              20.0.2-py37_1
    python:           3.7.7-hcf32534_0_cpython
    python-dateutil:  2.8.1-py_0
    pytz:             2019.3-py_0
    readline:         8.0-h7b6447c_0
    scipy:            1.4.1-py37h0b6359f_0
    setuptools:       46.1.3-py37_0
    six:              1.14.0-py37_0
    sqlite:           3.31.1-h7b6447c_0
    tk:               8.6.8-hbc83047_0
    wheel:            0.34.2-py37_0
    xz:               5.2.4-h14c3975_4
    zlib:             1.2.11-h7b6447c_3
 
Proceed ([y]/n)? y
 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
[(it_css:traine)@login00 ~]$ source deactivate

The below steps are based on copying a template job script and modifying serial.qs or threads.qs script to load run your Gurobi Anaconda environment.

It is a good idea to periodically check in /opt/templates/slurm/ for updated or new templates to use as job scripts to run generic or specific applications, designed to provide the best performance on Caviness.

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.

Example serial.qs script

#
# Do general job environment setup:
#
. /opt/shared/slurm/templates/libexec/common.sh
 
#
# [EDIT] Add your script statements hereafter, or execute a script or program
#        using the srun command.
#
 
vpkg_require gurobi
vpkg_require anaconda/5.2.0:python3
 
source activate ~${USER}/gurobiproject #Directory where the Gurobi Anaconda Environment was installed
python serial_test.py
source deactivate

Example threads.qs script

#
# Do standard OpenMP environment setup:
#
. /opt/shared/slurm/templates/libexec/openmp.sh
 
#
# [EDIT] Execute your OpenMP/threaded program using the srun command:
#
 
vpkg_require gurobi
vpkg_require anaconda/5.2.0:python3
 
source activate ~${USER}/gurobiproject #Directory where the Gurobi Anaconda Environment was installed
python sample_parallel.py
source deactivate
  • software/gurobi/caviness.1586813475.txt.gz
  • Last modified: 2020-04-13 17:31
  • by anita