Gurobi

From ACENET
Revision as of 19:27, September 28, 2017 by Ostueker (talk | contribs) (Examples: parallel example)
Jump to: navigation, search


Description
Gurobi Optimizer is a tool for mathematical programming, also known as mathematical optimization. It includes capabilities in linear programming (LP), mixed-integer linear programming (MILP), mixed-integer quadratic programming (MIQP), quadratic programming (QP), quadratically constrained programming (QCP), and mixed-integer quadratically constrained programming (MIQCP).
Modulefile
gurobi
Documentation
Vendor documentation

License conditions

Gurobi is a commercial product and controlled by a license that restricts who can use it. The user must be a researcher at the university which hosts the computers on which the software is running. So, only Dalhousie University researchers may use Gurobi on Glooscap (which is located at Dalhousie), Memorial University researchers may only use Gurobi on Placentia, and so on. In order to ensure compliance, we restrict access to the software using access control lists. If you wish to use Gurobi, contact support via email and we will add you to the access control list if you are at a qualified institution.

Presently Gurobi is only installed and licensed at Glooscap and Placentia. If you are at another institution which hosts an ACENET cluster and wish to use Gurobi, contact support and we will try to arrange a license for that cluster.

Examples

Serial jobs

Here is an example script to use with the job scheduler, and how to submit it:

$ cat gurobi-sample-job
#$ -l h_rt=0:5:0,test=true
#$ -cwd
#$ -j y
module load gurobi
gurobi_cl /usr/local/gurobi-7.5.1/linux64/examples/data/coins.lp

$ qsub gurobi-sample-job
Your job 12345678 ("gurobi-sample-job") has been submitted.


Gurobi/Python jobs using can be submitted as follows:

$ cat gurobi-py-sample-job
#$ -l h_rt=0:5:0,test=true
#$ -cwd
#$ -j y
module load gurobi
gurobi.sh  /usr/local/gurobi-7.5.1/linux64/examples/python/facility.py

$ qsub gurobi-py-sample-job
Your job 12345679 ("gurobi-py-sample-job") has been submitted.

Parallel jobs

Gurobi can utilize multiple threads, which can increase the performance.

This example submission script will create a Gurobi environment file in the current working directory to tell Gurobi how many Threads have been requested for the job. Note: This can cause interference between jobs that are running in the same directory but request different numbers of threads.

#$ -cwd
#$ -j y
#$ -l h_rt=0:30:0,test=true
#$ -pe openmp 4
# Create environment file in current directory:
echo "Threads $NSLOTS" > gurobi.env
module load  gurobi

echo "Example job from .lp file:"
gurobi_cl ${GUROBI_HOME}/examples/data/coins.lp

echo "Example job from .py file:"
gurobi.sh ${GUROBI_HOME}/examples/python/facility.py


Interactive jobs

For interactive work, we recommend asking for an interactive job:

$ module load gurobi
$ qrsh -l h_rt=1:0:0,test=true gurobi.sh
Python 2.7.13 (default, Jun  8 2017, 07:12:38)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Gurobi Interactive Shell (linux64), Version 7.5.1
Copyright (c) 2017, Gurobi Optimization, Inc.
Type "help()" for help

gurobi> m = read('/usr/local/gurobi-7.5.1/linux64/examples/data/coins.lp')
gurobi> m.optimize()
...

See Job Control for more on running and monitoring jobs. See Modules for more on module load and related commands.