Gurobi: Difference between revisions
mNo edit summary |
(example jobscripts) |
||
Line 13: | Line 13: | ||
My Compute Canada username is "_______" and I am a member of the academic institution "_____________________". This message confirms that I will only use the Compute Canada Gurobi license provided on Compute Canada systems for the purpose of non-commercial research project(s) to be published in a publicly available article(s). | My Compute Canada username is "_______" and I am a member of the academic institution "_____________________". This message confirms that I will only use the Compute Canada Gurobi license provided on Compute Canada systems for the purpose of non-commercial research project(s) to be published in a publicly available article(s). | ||
==Gurobi Command-Line Tools== <!--T:5--> | == Interactive Allocations == | ||
===Gurobi Command-Line Tools=== <!--T:5--> | |||
[gra-login2:~] salloc --time=1:00:0 --cpus-per-task=8 --mem=1G --account=def-xyz | [gra-login2:~] salloc --time=1:00:0 --cpus-per-task=8 --mem=1G --account=def-xyz | ||
Line 20: | Line 22: | ||
[gra800:~] gurobi_cl --help | [gra800:~] gurobi_cl --help | ||
==Gurobi Interactive Shell == <!--T:6--> | ===Gurobi Interactive Shell === <!--T:6--> | ||
[gra-login2:~] salloc --time=1:00:0 --cpus-per-task=8 --mem=1G --account=def-xyz | [gra-login2:~] salloc --time=1:00:0 --cpus-per-task=8 --mem=1G --account=def-xyz | ||
Line 43: | Line 45: | ||
**** https://www.gurobi.com/documentation/8.1/refman/attributes.html | **** https://www.gurobi.com/documentation/8.1/refman/attributes.html | ||
==Replay API Call Recording== <!--T:7--> | ===Replay API Call Recording=== <!--T:7--> | ||
[gra800:~] gurobi_cl recording000.grbr | [gra800:~] gurobi_cl recording000.grbr | ||
Reference: https://www.gurobi.com/documentation/8.1/refman/recording_api_calls.html | Reference: https://www.gurobi.com/documentation/8.1/refman/recording_api_calls.html | ||
== Batch Jobs == | |||
{{File | |||
|name=gurobi_example.sh | |||
|lang="sh" | |||
|contents= | |||
#!/bin/bash | |||
#SBATCH --time=0:30 # time limit (D-HH:MM) | |||
#SBATCH --mem-per-cpu=1000M # memory per CPU (in MB) | |||
module purge | |||
module load gurobi | |||
# Create environment file in current directory setting the number of threads: | |||
echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env | |||
gurobi_cl ${EBROOTGUROBI}/examples/data/coins.lp | |||
}} | |||
{{File | |||
|name=gurobi-py_example.sh | |||
|lang="sh" | |||
|contents= | |||
#!/bin/bash | |||
#SBATCH --time=0:30 # time limit (D-HH:MM) | |||
#SBATCH --mem-per-cpu=1000M # memory per CPU (in MB) | |||
module purge | |||
module load gurobi | |||
# Create environment file in current directory setting the number of threads: | |||
echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env | |||
gurobi.sh ${EBROOTGUROBI}/examples/python/facility.py | |||
}} |
Revision as of 14:28, 10 December 2019
Gurobi is a commercial software suite for solving complex optimization problems. This page wiki page describes the non-commercial use of Gurobi software on Compute Canada clusters and is currently a work in progress.
License limitations
Compute Canada supports and provides a free license to use Gurobi Graham, Cedar, Beluga and Niagara clusters. The license provides a total number of 4096 simultaneous uses (tokens in use) and permits distributed usage. A single user can run multiple simultaneous jobs. In order to use Gurobi you must agree to certain conditions. Please contact support with a copy of the following statement. You will then be added into the Compute Canada license file as a permitted user.
My Compute Canada username is "_______" and I am a member of the academic institution "_____________________". This message confirms that I will only use the Compute Canada Gurobi license provided on Compute Canada systems for the purpose of non-commercial research project(s) to be published in a publicly available article(s).
Interactive Allocations
Gurobi Command-Line Tools
[gra-login2:~] salloc --time=1:00:0 --cpus-per-task=8 --mem=1G --account=def-xyz [gra800:~] module load gurobi [gra800:~] gurobi_cl Record=1 Threads=8 Method=2 ResultFile=p0033.sol LogFile=p0033.log $GUROBI_HOME/examples/data/p0033.mps [gra800:~] gurobi_cl --help
Gurobi Interactive Shell
[gra-login2:~] salloc --time=1:00:0 --cpus-per-task=8 --mem=1G --account=def-xyz [gra800:~] module load gurobi [gra800:~] echo "Record 1" > gurobi.env see * [gra800:~] gurobi.sh gurobi> m = read('/cvmfs/restricted.computecanada.ca/easybuild/software/2017/Core/gurobi/8.1.1/examples/data/glass4.mps') gurobi> m.Params.Threads = 8 see ** gurobi> m.Params.Method = 2 gurobi> m.Params.ResultFile = "glass4.sol" gurobi> m.Params.LogFile = "glass4.log" gurobi> m.optimize() gurobi> m.write('glass4.lp') gurobi> m.status see *** gurobi> m.runtime see **** gurobi> help()
where
* https://www.gurobi.com/documentation/8.1/refman/recording_api_calls.html ** https://www.gurobi.com/documentation/8.1/refman/parameter_descriptions.html *** https://www.gurobi.com/documentation/8.1/refman/optimization_status_codes.html **** https://www.gurobi.com/documentation/8.1/refman/attributes.html
Replay API Call Recording
[gra800:~] gurobi_cl recording000.grbr
Reference: https://www.gurobi.com/documentation/8.1/refman/recording_api_calls.html
Batch Jobs
#!/bin/bash
#SBATCH --time=0:30 # time limit (D-HH:MM)
#SBATCH --mem-per-cpu=1000M # memory per CPU (in MB)
module purge
module load gurobi
# Create environment file in current directory setting the number of threads:
echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env
gurobi_cl ${EBROOTGUROBI}/examples/data/coins.lp
#!/bin/bash
#SBATCH --time=0:30 # time limit (D-HH:MM)
#SBATCH --mem-per-cpu=1000M # memory per CPU (in MB)
module purge
module load gurobi
# Create environment file in current directory setting the number of threads:
echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env
gurobi.sh ${EBROOTGUROBI}/examples/python/facility.py