Comsol BATCH licenses

From ScientificComputing
Revision as of 08:19, 25 March 2020 by Sfux (talk | contribs) (Preparation)

Jump to: navigation, search


For each Comsol license (including the additional modules) there exists a corresponding BATCH license:


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 available licenses to ETH researchers.

Using the additional Comsol BATCH licenses

To use the Comsol BATCH licenses, 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).


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.

  1. ssh -Y ${USER}
  2. mkdir $HOME/comsol
  3. cd $HOME/comsol
  4. echo "" > hostfile
  5. module load new comsol/5.4
  6. comsol
  7. click on "Options->preferences" in the menu bar
  8. click on "Multicore and Cluster Computing" in the navigation bar in the left part of the window
  9. make sure "Cluster type" is set to "General"
  10. you can ignore the field "Number of processors" as COMSOL will ignore this number when running the COMSOLBATCH jobs.
  11. specify "/cluster/home/${USER}/comsol/hostfile" in the field "Host file"
  12. specify a directory in the field "Batch directory", where comsol will store the initial .mph file and the result of the calculations
  13. make sure that the field "External COMSOL installation directory path:" contains the string "/cluster/apps/comsol/5.4/x86_64" and the checkbox is set.
  14. 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])
  15. click "OK"
  16. restart the COMSOL GUI to activate the changes in the preferences

Running a job

  1. open the COMSOL GUI
  2. open the simulation, you would like to run
  3. right-click on "Study1" and choose "Cluster computing". 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
  4. 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.
  5. 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).
  6. this is the most important step: enable the checkbox "Use batch license"
  7. 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



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


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.