To use CPLEX on Compute Canada clusters, you must first register with IBM and then download a personal version of the software. If you are presented with a choice of architectures, choose Linux x86-64.
The file is an executable archive which will perform the installation after you have answered a few questions. To execute the archive, you need to type the command bash ./cplex_studioXYZ.linux-x86.bin.
To access the software, you can create a personal module. Modules are normally created and placed in a directory hierarchy. In order for your modules to be found, you need to modify the configuration file $HOME/.bashrc so that it points to the root of this hierarchy, by adding the following line:
[name@server ~]$ export MODULEPATH=$HOME/modulefiles:$MODULEPATH
Next, you need to create a directory structure in which to put your new cplex module:
[name@server ~]$ mkdir -p $HOME/modulefiles/mycplex
In this directory, you should create a file (e.g. $HOME/modulefiles/mycplex/12.8.0) with the version number corresponding to the version you downloaded (e.g. 12.8.0) and with the following content:
Adjust the lines which correspond to the variables cplexversion and studio_root so that they have the correct values for your situation, i.e. the version you downloaded and the path you specified when extracting the archive.
If you use Java, you will have some further steps to carry out. Firstly, in your .bashrc file, you can add the line
[name@server ~]$ export CLASSPATH=.
which will allow your code to be found during execution.
Next, you should modify the dynamic library of CPLEX. Look for this library in the directory hierarchy of the installation directory, make a copy of it and then execute the command
[name@server ~]$ setrpaths.sh --path libcplex1280.so
It's possible that during your compilation, you receive an error message because of a lack of memory. In this case, you should request a compute node using an interactive job to do the compilation. For example,
[name@server ~]$ salloc --time=1:0:0 --ntasks=1 --mem-per-cpu=8G
After you have installed CPLEX as documented above, you must first install the module that you created:
[name@server ~]$ module load mycplex/<version>
To install the CPLEX Python modules like docplex, we suggest that you use a virtual environment.
Once the virtual environment has been activated, you can install the module using the command:
(ENV) [name@server ~] pip install docplex
The installation of these Python modules must be done on the login node because they are not available in our software stack.