Difference between revisions of "Gurobi 2016"

From HPC users
Jump to navigationJump to search
Line 27: Line 27:
Here, $GUROBI_HOME is set in the environment, coins.lp is an example model. The option Threads=1 set the parameter Threads to 1. This is an important option when you run Gurobi on the cluster: if not used Gurobi may use all available cores on a compute node which could interfere with other jobs (and therefore should be avoided!). The command above rund very quickly and produces a few lines of output. In addition, a file gurobi.log is created (or appended to if it already exists).
Here, $GUROBI_HOME is set in the environment, coins.lp is an example model. The option Threads=1 set the parameter Threads to 1. This is an important option when you run Gurobi on the cluster: if not used Gurobi may use all available cores on a compute node which could interfere with other jobs (and therefore should be avoided!). The command above rund very quickly and produces a few lines of output. In addition, a file gurobi.log is created (or appended to if it already exists).


== using Gurobi with the HPC Cluster ==
== Using Gurobi with the HPC Cluster ==


In most cases you need to run an optimization that needs longer run time. In that case you should prepare and submit a job script as explained in the section about the [[SGE Job Management (Queueing) System]]. A job script could look like this:
In most cases you need to run an optimization that needs longer run time. In that case you should prepare and submit a job script as explained in the section about the [[SLURM]]. A job script could look like this:
<pre>
<pre>
SCRIPT
SCRIPT

Revision as of 15:13, 7 February 2017

Introduction

Gurobi Optimizer has been designed to be a fast and powerful solver for your LP, QP, QCP, and MIP problems. More information can be found on the Gurobi webpage. Read the Quickstart Guide for examples on how to use gurobi.

Please note that Gurobi Optimizer is commercial software. The academic license available at the University Oldenburg can only be used for research and teaching puporses. If you have used Gurobi in your research you can acknowledge this by citing

@misc{gurobi,
  author = "Gurobi Optimization, Inc.",
  title = "Gurobi Optimizer Reference Manual",
  year = 2015,
  url = "http://www.gurobi.com"
}

Installed Version

The currently installed Version is 7.0.2.

Using Gurobi

In order to use Gurobi Optimizer you need to load the module with the command

module load gurobi/7.0.2

This sets up the environment to run e.g. the command-line tool. To get some help type

gurobi_cl --help

The general format for the command-line tool is

gurobi_cl [--command]* [param=value]* filename

where filename contains a model for optimization. Using one of the examples described in the Quickstart Guide, a working command could look like this:

gurobi_cl Threads=1 $GUROBI_HOME/examples/data/coins.lp

Here, $GUROBI_HOME is set in the environment, coins.lp is an example model. The option Threads=1 set the parameter Threads to 1. This is an important option when you run Gurobi on the cluster: if not used Gurobi may use all available cores on a compute node which could interfere with other jobs (and therefore should be avoided!). The command above rund very quickly and produces a few lines of output. In addition, a file gurobi.log is created (or appended to if it already exists).

Using Gurobi with the HPC Cluster

In most cases you need to run an optimization that needs longer run time. In that case you should prepare and submit a job script as explained in the section about the SLURM. A job script could look like this:

SCRIPT

Here the lines beginning with #$ describe the requested resources for the job and other settings. You may need to modify these according to your needs. Note that the SMP parallel environment (#$ -pe smp <N>) is requested because Gurobi can make use of multi-core architectures. The information about the number of available slots is passed in the Threads= option using the variable $NSLOTS. If you want to change the number of slots you only need to modify the value of <N>. Note that not all parts of Gurobi can run in parallel and increasing the number of cores does not alway improve the performance. Please test this before wasting compute resources (the example glass4.mps runs in 500s on 8 cores and in 235s on 16 cores, which is very good). If you remove or comment out the request for PE smp NSLOTS will be set to 1 (i.e. you don't need to modify the Threads option).

The job script is creating a new directory at the location where the job was submitted and all output from Gurobi will be written to that directory. The output from the SGE will be found where the job script is. The script is somewhat generic, you can change the location and name of the input file, the result file name will be created automatically.

If you need to make a large number of runs with similar input files/parameters consider using a job array.

Using Gurobi on your local work station

If you want to use Gurobi Optimizer on your own computer (within the University network) you can do so. Follow the instructions in Quickstart Guide to install Gurobi 6.5.1 (you need to create an account to download the software). Instead of retrieving your own named license you can install a license file named gurobi.lic in the location as described in guide. The license file must contain the following two lines:

TOKENSERVER=gurobi.license.uni-oldenburg.de
PORT=27001