A how-to guide for running mentat on the HPC.
Mentat requires the GUI, even if running in background mode -bg
. There are solutions to fake a display, but this does not work with mentat. As stated in the documentation
Note that the DISPLAY environment variable must point to a valid display.
The way around this is to use an interactive session that points to your computer's display (X11 Forwarding). This does mean that you have to keep the ssh session open for the entire time that the interactive session is running.
Probably not. X11 forwarding is slow, painfully slow. I ran some proc files on the HPC using the steps outlined below and it was 3 times SLOWER than my laptop. Make sure that there is a good reason to use mentat on the HPC, e.g. if the model you generate is far too big for your PC's RAM.
Note: If you are not on campus you need to run the Citrix VPN before opening MobaXTerm.
- MobaXTerm is the easiest way that I have found. So have that installed.
- When in MobaXterm, use the "+ Start local terminal option".
- Next you need to start a ssh session with X-Forwarding, this is done with the command below. Note, it will ask for your password.
ssh -X username@hpc1.sun.ac.za
- If all worked, you should now be in your home directory on the HPC. This will look the same as if you had done a normal ssh.
- Now we need to enter an interactive session on one of the nodes. This is done using the command: (You can set the specifications to suit your job.)
qsub -I -X -V -l walltime=01:00:00 -l select=1:ncpus=4:mem=8GB
- If done correctly you will be greeted with the following two lines (obviously the job number will be different):
qsub: waiting for job 282033.hpc1.hpc to start
qsub: job 282033.hpc1.hpc ready
- You are now in an interactive session on a visualisation node on the HPC. You will be in your home directory and have access to all your files as per normal.
- To load mentat type:
module load app/mentat
This will produce no output if done correctly.
- To check if it worked you can type:
which mentat
If it points you to a directory with mentat it worked.
- Now you can run your .proc file. using
mentat -bg Filename.proc
.
- You will probably be met with the following warning, I don't know what this means, but it still works :)
QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/YourUserName', please create it with 0700 permissions.
- If the above does not work an additional thing to try can be to install Xming X Server for Windows, and then make sure it is running before you open mobaXterm, then follow the same process.
Warning When trying to connect to mentat using the python run as separeate process
on port 40007 it just hangs. I have not found a way around this so far.
If you need to interface with mentat using py_post or py_mentat on the hpc there are a couple of additional steps to follow to get this working. The following steps assumes that the mentat module has already been loaded. If not, see point 8 above.
- First you need to load python:
module load python/3.8.1
- Then export the py_post and py_mentat library locations to
LD_LIBRARY_PATH
andPYTHONPATH
using:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/apps2/MSC/mentat2021.4/shlib/linux64
export PYTHONPATH=$PYTHONPATH:/home/apps2/MSC/mentat2021.4/shlib/linux64
You should now be able to run python and import py_menat and py_post. You can check this by doing the following in the interactive session:
- Type
python3
- This will show a>>>
on the line below. - Now type
import py_mentat
- If it did not give an error message it worked and the library has been imported and can be used.
- I have not tried to run a bash script in the interactive session, but I am sure it should work. Remember you won't qsub the bash script since you are already within the qsub.
- If you find some other quirks and workarounds, please add them to this page.