HPC/Applications/comsol

From CNM Wiki
Jump to navigation Jump to search

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.

Usage on Carbon

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

module load comsol

Then, from the command line on a Carbon login node, start the COMSOL GUI:

comsol &

Comsol will use a number of cores to run calculations multithreaded by default. (On Carbon, COMSOL_NUM_THREADS is set.)

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

Native desktop version with license forwarding

You can use a native Comsol version on your desktop but need a connection to the Comsol license server running on Carbon. The license is served by one of two license servers. Unfortunately, the automatic server selection only works on Carbon, and fails when using a native desktop version.


Use these steps to set up the connection.

  • On your desktop machine, set up SSH tunneling.
    • Windows: Configure PuTTY
    • Linux/Mac/Cygwin: edit the file ~/.ssh/config and add to the Host clogin section:
Host clogin
       …
       # Comsol FlexLM
       LocalForward 33318 mgmt03:1718
       LocalForward 33418 mgmt04:1718
       LocalForward  1719 mgmt03:1719
       LocalForward  1720 mgmt04:1720
  • Connect to clogin.
ssh -v clogin
  • Start the Comsol installer on your machine. When asked for licensing use the following type:
    • License type: networked server
  • For License hosts use one of these entries. If the first failed, use the second.
      • localhost, port 33318
      • localhost, port 33418
  • Complete the installer.
  • Locate and start the COMSOL Multiphysics application.

Point to an alternate license server

The license server is determined by the file COMSOLDIR/license/license.dat. It should look as follows:

SERVER localhost ANY 33318
USE_SERVER

Most of the time, the first license server works fine. If the port 33318 does not respond, locate the license.dat file and change it to read:

#SERVER localhost ANY 33318
SERVER localhost ANY 33319
USE_SERVER

Multiple CPU cores

Ways to start multi-core (from http://www.comsol.com/support/knowledgebase/1096/)

comsol -np 2
export COMSOL_NUM_THREADS=8    # automatically provided on Carbon
comsol
  • COMSOL does not benefit from hyperthreading.

Batch jobs

Sample Job file

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

cd $PBS_O_WORKDIR
comsol  -clustersimple batch \
        -tmpdir $TMPDIR \
        -inputfile  inp.mph \
        -outputfile out.mph