HPC/Applications/comsol: Difference between revisions

From CNM Wiki
Jump to navigation Jump to search
Line 63: Line 63:


== Cluster usage ==
== Cluster usage ==
[[Media:HPC 2012-05-16 Comsol parallel usage.pdf]]
  comsol batch -inputfile ''infile''.mph -outputfile out.mph
  comsol batch -inputfile ''infile''.mph -outputfile out.mph


Line 83: Line 81:
=== Sample Job file ===
=== Sample Job file ===
Modified from http://www.comsol.com/support/knowledgebase/1001/files/4027/cluster_install_linux_42a.pptx (Appendix slide, PBS)
Modified from http://www.comsol.com/support/knowledgebase/1001/files/4027/cluster_install_linux_42a.pptx (Appendix slide, PBS)
<pre>
 
[[Media:HPC 2012-05-16 Comsol parallel usage.pdf]]
 
<syntaxhighlight lang="bash">
#!/bin/bash
#!/bin/bash
#PBS -l nodes=2:ppn=8
#PBS -l nodes=2:ppn=8
Line 105: Line 106:
         -batchlog batch_COMSOL__$$.log
         -batchlog batch_COMSOL__$$.log
comsol mpd allexit
comsol mpd allexit
</pre>
</syntaxhighlight>

Revision as of 23:27, May 16, 2012

Introduction

HPC Comsol licensed modules.png

The COMSOL Multiphysics product is available for Mac, Windows, and Linux. You can run either the native version on your desktop or use the Linux version from Carbon, displaying on your desktop via X11.

Running comsol requires a license. Of the available features we have licensed a subset, shown at right.

Basic usage with X11

For casual use, and with X11 tunneling to Carbon already set up, simply add to your ~/.bashrc file on Carbon:

module load comsol

Then start the GUI on a clogin node:

comsol &

This will use one CPU core. To run calculations off the GUI multithreaded (using several cores on one node), use instead:

OMP_NUM_THREADS=4 comsol &

Quit the application as soon as you are done. Only one user can use Comsol at a time.

Native desktop version, with license forwarding

Example for Comsol license tunneling using SSH under the popular PuTTY application. Adapt these settings for your SSH applications.

You can use a native Comsol version on your desktop but need a connection to the Comsol license server running on Carbon. Use these steps to set up the connection.

  • On your desktop machine, add to your SSH tunnel config file ~/.ssh/config in the Host clogin section:
Host clogin
       …
       # Comsol FlexLM
       LocalForward  1719 mgmt03:1719
       LocalForward 33317 mgmt03:1718
       LocalForward 33318 mgmt04:1718
       LocalForward 33319 sched1:1718

Adapt these settings for SSH applications other than OpenSSH.

  • Log in to clogin.
  • Start the Comsol installer on your machine. Use the following settings when asked for licensing:
    • License type: networked server
    • License hosts:
localhost, port 33317
localhost, port 33318
localhost, port 33319
  • Complete the installer.
  • Locate and start the COMSOL Multiphysics application.


Multicore usage

From http://www.comsol.com/support/knowledgebase/1096/ :

Note that if you have hyperthreading activated you need to divide the cores count reported by the above command by relevant hyperthreading factor (typcally 2) to get the physical core count. COMSOL does not benefit from hyperthreading.

On Linux the default behavior is to use all available cores for the COMSOL Multiphysics application. You can override the default behavior by using the command line switches. For example, start by the command comsol -np 2. Like on Windows, you can change the default behavior through the environment variable COMSOL_NUM_THREADS. Example export COMSOL_NUM_THREADS=2.

For a complete description of parallel processing in COMSOL Multiphysics, see the section "Running COMSOL on Multicore and Multiprocessor Computers" in the COMSOL Installation and Operations Guide.

Cluster usage

comsol batch -inputfile infile.mph -outputfile out.mph

Or:

comsol –nn 8 mpd boot
comsol –nn 8 batch –inputfile in.mph
comsol mpd allexit

Or (apparently recognizes the nodefile)

comsol -clustersimple batch -inputfile input.mph -outputfile output.mph 

See also http://www.comsol.com/support/knowledgebase/1001/ .

Requirements

module unload openmpi
(To be tested.)

Sample Job file

Modified from http://www.comsol.com/support/knowledgebase/1001/files/4027/cluster_install_linux_42a.pptx (Appendix slide, PBS)

Media:HPC 2012-05-16 Comsol parallel usage.pdf

#!/bin/bash
#PBS -l nodes=2:ppn=8
#PBS -l walltime=2:00:00
#PBS -N jobname
#PBS -o job.out
#PBS -e job.err
#PBS -m ae
#PBS -V

cd $PBS_O_WORKDIR

nn=$(sort -u $PBS_NODEFILE | wc -l)
np=$(wc -l < $PBS_NODEFILE)

comsol -nn ${nn} mpd boot -f $PBS_NODEFILE
comsol mpd trace
comsol -nn ${nn} -np ${np} batch \
        -inputfile simpleParametricModel.mph \
        -outputfile outfile.mph \
        -batchlog batch_COMSOL__$$.log
comsol mpd allexit