Child pages
  • How to run Comsol on FAS Cannon (SEAS users only)

In the instructions below, the term  RC-Cluster refers to the Cannon cluster.

The examples below discuss how to run Comsol interactively, or non-interactively in batch mode (without any GUI interface), and how to submit a Comsol job to the RC-Cluster job scheduler SLURM.

Getting started

Obtain a FAS RC account by visiting:

https://portal.rc.fas.harvard.edu/request/account/new

RC-Cluster (Cannon currently) quick start guide:

https://docs.rc.fas.harvard.edu/

Please consult the documentation available at the above link for connecting to FAS systems and familiarizing yourself with the SLURM queue management system. For any help on RC-Cluster (Cannon), contact FAS RC:

https://rc.fas.harvard.edu/about/contact/

Using Comsol

Important:

  1. Due to the limited number of COMSOL licenses, we sometimes run out of licenses. If you get a message to that effect, wait for some time before trying again.  Also, please log out of any sessions when not in use. If your work requires regular use of COMSOL, please consider purchasing a copy from COMSOL.
  2. With the introduction of OnDemand VDI (see below), the only supported use of comsol will be on RC-Cluster.
  3. SEAS Comsol licenses are to be used for only academic non-profit work.

OnDemand Virtual Desktop (VDI)

You can now work conveniently via a browser on RC-Cluster using the virtual desktop infrastructure (VDI) known as OnDemand on RC-Cluster. For more details, please visit:

https://www.rc.fas.harvard.edu/resources/documentation/virtual-desktop/

Interactive use

The best option for working interactively on RC-Cluster is to use OnDemand VDI (see above). If you are authorized to use Comsol, the latest version should be available on OnDemand as an app. Otherwise, open a terminal on the OnDemand remote desktop and proceed as follows.

Comsol versions available via the new module system:

module-query comsol

This will display one or more modules. Once you determine a version to use, you can load the module and run comsol. For example, if you choose to use a specific version say comsol 6,

module load comsol/6.0-fasrc01
comsol

Running comsol in batch via slurm

Batch submissions :  1. Do not submit batch jobs from an OnDemand VDI session. Submit batch jobs from a simple ssh login session to a login node.

                                           (https://docs.rc.fas.harvard.edu/kb/terminal-access/)

                                       2. Do not try to run COMSOL interactively from a login node.

In order to run Comsol mph files in the batch mode (i.e. solving the model without using the GUI interface) you need an input file (usually with extension .mph) created with COMSOL GUI. Once you have an input file (we use, for eg. busbar.mph in the following example), prepare a batch submission script for COMSOL using the following template (called "runscript_comsol.sh"):

#!/bin/bash 
#----------------------------------------------------------------------------
#  This is a sample script. Please examine all the variables to make sure
#  they are relevant for the RC Cluster at the time of submission
#-------------------------------------------------------------------
#SBATCH -n 8        # Number of cores 
#SBATCH -N 1        # Number of nodes (all cores will be on this node)
#SBATCH -t 0-1:00   # Runtime in D-HH:MM format 
#SBATCH -p shared  # Partition to submit to 
#
# Memory per CPU for multinode/MPI work
# use --mem= for single node work, and specify -N 1
#SBATCH --mem-per-cpu=500 #Memory per cpu in MB (see also --mem) 

module load comsol/5.4-fasrc01
 
# To run with an older module (example):
# source new-modules.sh
# module load legacy

#For an earlier version:
#module load centos6
#source new-modules.sh
#module load legacy
# module load seas/comsol5.1
# The input file, for example, is assumed to be a COMSOL generated
# file called 'busbar.mph'.

INPUT_FILENAME=busbar.mph
OUTPUT_FILENAME=busbar_out.mph
OUTLOG=busbar_out.log
SCRATCH_DIR=.

# use $SLURM_NTASKS env set by #SBATCH -n value
export COMSOL_NUM_THREADS=$SLURM_NTASKS
comsol batch -np $COMSOL_NUM_THREADS -inputfile $INPUT_FILENAME -outputfile $OUTPUT_FILENAME -batchlog $OUTLOG

# Report some useful info
/bin/uname -a

date

exit

You can submit the script to SLURM with:

sbatch runscript_comsol.sh

For further details on using RC-Cluster and  SLURM (such as monitoring or canceling your jobs) please visit https://rc.fas.harvard.edu or the list of convenient SLURM commands at https://rc.fas.harvard.edu/resources/documentation/convenient-slurm-commands/.

Documentation

Comsol documentation is generally found in the COMSOL installation directories. You can find out the installation directory for the particular module you are using with, eg.:

module display seas/comsol5.3a


The above command should display something like setenv("COMSOL_HOME","/n/sw/comsol53a")  in  addition to other locations. In this case, the documentation directory is: 

 /n/sw/comsol53a/doc

You can view the pdf files in the directoried in the above directory with a pdf reader, such as evince:

Comsol documentation is usually found under html and pdf directories. You can open the pdf documentation (from an OnDemand remote desktop terminal):

Alternatively, you can copy the pdf files to your local desktop/laptop.

evince /n/sw/comsol53a/doc/pdf/COMSOL_Multiphysics/IntroductionToCOMSOLMultiphysics.pdf


Comsol examples

As under Documentation, determine the installation directory for COMSOL. For example, for comsol5.3, it is: 

/n/sw/comsol53

comsol examples are in:

/n/sw/comsol53/applications/

For example, the busbar example is in:

/n/sw/comsol53/applications/COMSOL_Multiphysics/Multiphysics/

You need to copy all the files with busbar in them in order to run the example script:

cp  /n/sw/comsol53/applications/COMSOL_Multiphysics/Multiphysics/ busbar* .

(Note the dot (.) at the end on the line above)



  • No labels