Running Gurobi in a cluster
AnsweredHi!
I am trying to execute a Gurobi c++ compiled file in a cluster node, but I do not know if it is possible in the way I am trying. Let me explain the situation:
1/ Inside a folder named "Example", I have the following elements:
i) The Gurobi example file diet_c++.cpp.
ii) The folder gurobi810 (the one resulting from extracting gurobi8.1.0_linux64.tar.gz). I have copied this folder from "/opt" so I can compile the cpp file using relative paths.
2/ I compile diet_c++.cpp (in Linux) with the following command (see below) and it works perfectly (both compilation and execution)
g++ -w -Wall diet_c++.cpp -o executable2 -I./gurobi810/linux64/include -L./gurobi810/linux64/lib -lgurobi_g++5.2 -lgurobi81
3/ Now, I would like to execute the resulting compiled file (executable2) in a cluster (run also with a Linux OS) so I do the following: I move the folder "Example", with "executable2" and the folder "gurobi810", from my computer to my user directory in the cluster. Then, I try to execute the file executable2, but I obtain the following error:
./executable2: error while loading shared libraries: libgurobi81.so: cannot open shared object file: No such file or directory
Any idea of what can I do to achieve my goal?
Thanks in advance!
David
-
Hi David,
to solve the problem with the shared object, it should be sufficient to add the path where the .so-files are located to the environment variable LD_LIBRARY_PATH, e.g.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/david/gurobi810/linux64/lib
(please use your actual path). You might experience other problems if your environment is too different from the cluster's. It might be better to re-compile on the cluster in case of trouble. Then you could also optimize the code for the cluster's CPUs (e.g. gcc -march=native -O2).
Still, for running gurobi on a cluster, you have to consider other things:
First, there might be a license issue if the node where gubrobi runs changes from time to time. This can be avoided using a floating license.
Second, the usage of gurobi is very different when running on several cluster nodes simultaneously than when only using one node. Your approach is perfectly ok, when only using one cluster node. When you want to use more than one node, please have a look at the documentation. (When I did MIP solving on a cluster last time, using several nodes was not really helpful for most of the instances, but this might have changed since then.)
0 -
Hi Thomas,
Thank you very much for your help. I will try again next time I have access to the cluster.
Regards,
David
0
Please sign in to leave a comment.
Comments
2 comments