cc_staff
1,857
edits
mNo edit summary |
mNo edit summary |
||
Line 70: | Line 70: | ||
== Batch Jobs == <!--T:7--> | == Batch Jobs == <!--T:7--> | ||
<!--T:70--> | |||
Once a slurm script has been prepared for a Gurobi problem it can be submitted to the queue by running the <code>sbatch script-name.sh</code> command. The jobs status in the queue can then be checked by running the <code>sq</code> command. Sample slurm scripts for two such problems provided with each gurobi module version in the examples directory are given here: | |||
=== Data Example === <!--T:71--> | === Data Example === <!--T:71--> | ||
<!--T:73--> | <!--T:73--> | ||
This is an example slurm script for | This is an example slurm script for solving [https://www.gurobi.com/documentation/9.5/quickstart_linux/solving_a_simple_model_the.html simple coin production model] written in the [https://www.gurobi.com/documentation/9.5/refman/lp_format.html LP format]. It shows how-to set the Threads and ResultFile [https://www.gurobi.com/documentation/9.0/refman/parameters.html parameters] when using the [https://www.gurobi.com/documentation/9.5/quickstart_linux/solving_the_model_using_th.html Gurobi command-line interface]. | ||
{{File | {{File | ||
|name=script-lp_coins.sh | |name=script-lp_coins.sh | ||
Line 86: | Line 89: | ||
#SBATCH --nodes=1 # do not change | #SBATCH --nodes=1 # do not change | ||
<!--T: | <!--T:74--> | ||
#module load StdEnv/2016 # for versions < 9.0.3 | #module load StdEnv/2016 # for versions < 9.0.3 | ||
module load StdEnv/2020 # for versions > 9.0.2 | module load StdEnv/2020 # for versions > 9.0.2 | ||
<!--T:75--> | |||
module load gurobi/9.5.0 | module load gurobi/9.5.0 | ||
<!--T: | <!--T:76--> | ||
rm -f coins.sol | rm -f coins.sol | ||
gurobi_cl Threads=$SLURM_CPUS_ON_NODE ResultFile=coins.sol ${GUROBI_HOME}/examples/data/coins.lp | gurobi_cl Threads=$SLURM_CPUS_ON_NODE ResultFile=coins.sol ${GUROBI_HOME}/examples/data/coins.lp | ||
}} | }} | ||
=== | === Python Example === <!--T:81--> | ||
<!--T: | <!--T:83--> | ||
This is an example | This is an example slurm script for solving a [https://www.gurobi.com/documentation/9.5/examples/a_list_of_the_grb_examples.html simple facility location model] using [https://www.gurobi.com/documentation/9.5/examples/facility_py.html Gurobi Python]. The example show how-to pass the [https://www.gurobi.com/documentation/9.5/refman/parameters.html#sec:Parameters Threads] parameter to the [https://www.gurobi.com/documentation/9.5/refman/python_parameter_examples.html Gurobi python interface] using a dynamically created [https://www.gurobi.com/documentation/9.5/quickstart_linux/using_a_grb_env_file.html gurobi.env] file in the current directory to set the number of threads. | ||
{{File | {{File | ||
|name=script-py_facility.sh | |name=script-py_facility.sh | ||
Line 112: | Line 116: | ||
#SBATCH --nodes=1 # do not change | #SBATCH --nodes=1 # do not change | ||
<!--T: | <!--T:84--> | ||
module load StdEnv/2016 | #module load StdEnv/2016 # for versions < 9.0.3 | ||
module load StdEnv/2020 # for versions > 9.0.2 | |||
module load gurobi/9.0 | <!--T:85--> | ||
module load gurobi/9.5.0 | |||
<!--T: | <!--T:86--> | ||
echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env | echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env | ||
<!--T:87--> | <!--T:87--> | ||
gurobi.sh | gurobi.sh ${GUROBI_HOME}/examples/python/facility.py | ||
}} | }} | ||