Comsol BATCH licenses
This instructions are deprecated and obsolete as Comsol BATCH licenses can also be used by adding a command line option to your Comsol command. For instructions on how to use the Comsol BATCH licenses, please check How to submit a job
Contents
Introduction
For each Comsol license (including the additional modules) there exists a corresponding BATCH license:
COMSOL COMSOLBATCH
RAYOPTICS RAYOPTICSBATCH
RF RFBATCH
These secondary BATCH licenses are mostly available (compared to the primary licenses that are heavily in use). It takes a little bit of preparation and additional effort to use them, but on the other hand, this doubles the amount of Comsol licenses that are available to ETH researchers. The batch licenses cannot be used for the Matlab-Comsol livelink.
Using the additional Comsol BATCH licenses
To use the Comsol BATCH licenses on the Euler cluster, there need to be 1 COMSOL and 1 COMSOLGUI license available (and if your model is using additional licenses like RF, then you also need to have 1 RF license available).
Preparation
Please follow the steps indicated here for preparing the use of Comsol BATCH licenses. The preparation only needs to be done once. Please note that in the following instructions ${USER} needs to be replaced with your ETH account name.
- ssh -Y ${USER}@euler.ethz.ch
- mkdir $HOME/comsol
- cd $HOME/comsol
- echo "127.0.0.1" > hostfile
- module load new comsol/5.5
- comsol -np 1
- click on Options->preferences in the menu bar
- click on Multicore and Cluster Computing in the navigation bar in the left part of the window
- make sure Cluster type (in newer Comsol versions, it is scheduler type) is set to General
- you can ignore the field Number of processors as COMSOL will ignore this number when running the COMSOLBATCH jobs.
- specify /cluster/home/${USER}/comsol/hostfile in the field Host file
- specify a directory in the field Batch directory, where comsol will store the initial .mph file and the result of the calculations
- make sure that the field External COMSOL installation directory path: contains the string /cluster/apps/comsol/5.5/x86_64 and that the checkbox is set.
- specify the bsub command (only the resource part), without the actual command to run, in the field Prepend command (Example: bsub -n 4 -W 36:00 -R rusage[mem=2048])
- click OK
- restart the COMSOL GUI to activate the changes in the preferences
As a last part of the preparation, you need to create SSH keys if you don't have them already. For this, please run the script
/cluster/apps/local/setup_ssh.sh
Those keys will later be used in the Running a job section.
Running a job
It is OK to start the Comsol GUI for the preparation steps on the login node to change the preferences, because no simulation needs to be loaded and therefore not a lot of memory is used. For submitting a job from the GUI, using the COMSOLBATCH licenses, the simulation needs to be loaded, which will use more memory. Therefore when running the GUI in the following steps, it needs to be started in a batch job to not overload the login nodes.
- start a batch interactive X11 forwarding job by using the command bsub -R light -XF -R "rusage[mem=9000]" -n 4 -W 2:00 -Is xterm and wait until you get a shell from the interactive job
- load the COMSOL module with the command module load new comsol/5.5
- start the COMSOL GUI with the command comsol -np 1
- open the simulation, you would like to run
- right-click on Study1 (or Study in newer Comsol versions) and choose Cluster computing (or Batch and Cluster in newer Comsol versions). If the entry in the menu is not there, then you first have to click on the Show option in the model builder toolbar (a small eye icon) and choose the advanced study options entry from the menu
- specify a filename in the field Filename (Comsol will take the initial .mph input file, add some more information and save it under the new file name and at the location that you specify in the field Directory). Once the job has been submitted, it will be independent of the initial .mph file and only use the new one created for this job.
- set the value in the field Number of nodes to the number of CPU's you would like to use in the simulation (beware that this needs to match the number that was specified via bsub in the preparation part where the preferences are changed).
- this is the most important step: enable the checkbox Use batch license
- click on Study1 in the Model builder menu and then click the Compute button to start the calculation.
Now the job is submitted, but it is bound to the GUI (and when having a GUI open, you have a COMSOL and a COMSOLGUI license checked out, i.e., we do not gain anything if you use a COMSOL license per COMSOLBATCH license that you use). At this stage we are using the following licenses:
Number of jobs: 1 Licenses: 1 COMSOL 1 COMSOLGUI 1 COMSOLBATCH
The key step is now to detach the job from the GUI. As soon as the job started, there is a tab External process in the Messages window at the bottom right of the COMSOL GUI. At the bottom right of the tab, there is a button detach job which you need to click to detach the job from the GUI.
Now you can either close the GUI (which will give back the COMSOL and the COMSOLGUI license) or you can load the next .mph file to start the next COMSOL job. If you go for the second option, you would repeat the steps from the Running a job paragraph.
After having submitted the second job, the following licenses are in use:
Number of jobs: 2 1 COMSOL 1 COMSOLGUI 2 COMSOLBATCH
But when you then close the GUI, the COMSOL and COMSOLGUI license are given back. This means that in order to submit jobs that use the COMSOLBATCH licenses you have to check out one COMSOL and COMSOLGUI license, while you have the GUI open. But then you can submit as many jobs using only a COMSOLBATCH license as you want. And in the moment you close the GUI, the initially used COMSOL and COMSOLGUI license are given back.