rsnt_translations
56,430
edits
mNo edit summary |
(Marked this version for translation) |
||
Line 153: | Line 153: | ||
python3.11 | python3.11 | ||
=== Installing Gurobi for Python === | === Installing Gurobi for Python === <!--T:218--> | ||
<!--T:219--> | |||
As mentioned near the bottom of this official document [[support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python|How-do-I-install-Gurobi-for-Python]] the previously recommended method for installing Gurobi for Python with <code>setup.py</code> has been deprecated to be only usable with Gurobi 10 versions (and older). Therefore a new section has been added below which shows howto simultaneously download a compatible binary wheel from [[pypi.org/project/gurobipy|pypi.org]] and simultaneously convert it into a format usable with a newly recommended command to install Gurobi for Python with Gurobi 11 versions (and newer). | As mentioned near the bottom of this official document [[support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python|How-do-I-install-Gurobi-for-Python]] the previously recommended method for installing Gurobi for Python with <code>setup.py</code> has been deprecated to be only usable with Gurobi 10 versions (and older). Therefore a new section has been added below which shows howto simultaneously download a compatible binary wheel from [[pypi.org/project/gurobipy|pypi.org]] and simultaneously convert it into a format usable with a newly recommended command to install Gurobi for Python with Gurobi 11 versions (and newer). | ||
Line 186: | Line 187: | ||
!! | !! | ||
******************************************************************************** | <!--T:220--> | ||
******************************************************************************** | |||
newlines are not allowed in `summary` and will break in the future | newlines are not allowed in `summary` and will break in the future | ||
******************************************************************************** | ******************************************************************************** | ||
<!--T:221--> | |||
!! | !! | ||
write_field('Summary', single_line(summary)) | write_field('Summary', single_line(summary)) | ||
Line 244: | Line 247: | ||
Python scripts, such as the examples provided with the gurobi module can now be run (within the virtual environment) using python : | Python scripts, such as the examples provided with the gurobi module can now be run (within the virtual environment) using python : | ||
<!--T:222--> | |||
{{Commands|prompt=(env_gurobi) [name@server ~] $ | {{Commands|prompt=(env_gurobi) [name@server ~] $ | ||
| python $EBROOTGUROBI/examples/python/matrix1.py | | python $EBROOTGUROBI/examples/python/matrix1.py | ||
Line 251: | Line 255: | ||
Likewise custom python scripts such as the following can be run as jobs in the queue by writing slurm scripts that load your virtual environment. | Likewise custom python scripts such as the following can be run as jobs in the queue by writing slurm scripts that load your virtual environment. | ||
<!--T:223--> | |||
{{Commands|prompt=[name@server ~] $ | {{Commands|prompt=[name@server ~] $ | ||
| cat my_gurobi_script.py | | cat my_gurobi_script.py | ||
Line 260: | Line 265: | ||
}} | }} | ||
<!--T:224--> | |||
Submit your script to the queue by running <code>sbatch my_slurm_script.sh</code> as per usual : | Submit your script to the queue by running <code>sbatch my_slurm_script.sh</code> as per usual : | ||
Line 274: | Line 280: | ||
#SBATCH --mem=4000M # specify total MB memory | #SBATCH --mem=4000M # specify total MB memory | ||
<!--T:225--> | |||
module load StdEnv/2023 | module load StdEnv/2023 | ||
module load gurobi/11.0.1 | module load gurobi/11.0.1 | ||
# module load scipy-stack # uncomment if needed | # module load scipy-stack # uncomment if needed | ||
<!--T:226--> | |||
echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env | echo "Threads ${SLURM_CPUS_ON_NODE:-1}" > gurobi.env | ||
<!--T:227--> | |||
source ~/env_gurobi/bin/activate | source ~/env_gurobi/bin/activate | ||
python my_gurobi_script.py | python my_gurobi_script.py |