Note: This documentation has been tested on Colosse. Parts of the instruction might be different on other servers.
COMSOL is an engineering simulation software to facilitate modeling at all levels - geometry, mesh, physics, optimisation and visualisation.
COMSOL is a commercial software. Each research group needs to provide its own licence to use it on the Calcul Québec servers. Software installation is usually done in the group folder and can be done either by a Calcul Québec analyst or by a group member.
SSH configuration and keys
COMSOL is an application that is losely integrated, which means that the user is responsible for starting different processes on every node that is allocated using the batch script. So it is necessary to have a means of communication between the worker nodes, and in this case we use SSH.
As no information can be entered by the user during communication between nodes, it may be necessary to generate SSH keys. On certain servers, this is automatically done. To test if this is the case, use the command
[name@server $] ssh localhost
The SSH connection should work without asking anything on your part. If this is not the case, you should generate SSH keys.
How to start COMSOL on multiple nodes
To permit the distribution of COMSOL computations to multiple nodes, you should first configure the "Study" section of the model to enable execution in "batch" mode or "cluster computing".
The options "batch" and "cluster computing" are not visible by default.Hence you must first activate the visibility of these options. In the section "Model Builder", click the "Show" button. This is the 4th button from the left that is immediately under the tab "Model Builder".
- After that check "Advanced Study Options".
- After this you can access the "Cluster computing" and "Batch" options when you right-click on the "Study" section of your model.
- You should then check "Distribute parametric sweep" in the "Cluster Computing" menu, so that COMSOL distributes simulation parameters.
- The only thing left to do now is to run your script on the compute server.
Here is an example of an example submission file allowing to run COMSOL on 4 nodes with Moab as a function of the COMSOL version.
Note : this submission script uses the file hosts.txt generated thank to the utility moabhl2hl.py, that is available on Colosse. To generate this file on other servers, please contact us.
Results (on Colosse)
To see if COMSOL was correctly distributed on Colosse, several tests were made. In particular, the same task was launched successively on Colosse with different number of cores. The simulation consists of the calculation of the acoustic response of an object, and is in fact in the resolution field of pressure and velocity in response to an excitation at a certain frequency. The excitation frequency varies from 0 to 7000Hz, in steps of 10Hz, and therefore the total simulation actually consists of 700 independent simulations. The simulation times are then extracted from COMSOL's log file. The blue curve in the graph below shows the results. The red line on the same graph shows that COMSOL correctly distributes the different frequencies with 80 cores, as the simulation time is approximately divided by 10 compared to the time for eight cores.