Software:comsol

From CAC Wiki
Jump to: navigation, search

General-purpose software platform, based on advanced numerical methods, for modeling and simulating physics-based problems. Although COMSOL is installed on the SW cluster, users will need to provide their own license before they are able to use the software.

Any given COMSOL job requires 4 components to run, namely a license key (follows the format "CMC_#####.key"), a CMC_CADPASS_BATCH_COMSOL.sh licensing script, a job script, and an input .mph file. The CMC license key and CMC_CADPASS_BATCH_COMSOL.sh script should be obtained from CMC. If CMC asks for an IP address of the machine COMSOL will be run on, give them 130.15.59.4 (this is the external IP address of the SW cluster).

  • Version: 5.2
  • Related link: [1]
  • Extra documentation: Documentation is in the the /opt/COMSOL/5.2/doc directory on our systems. It is available in html and pdf format and accessible from the program GUI.


Using your own license

The CMC_CADPASS_BATCH_COMSOL.sh script requires editing before it can be used. These changes are designed to allow your job scripts to be run non-interactively. Please edit the line beginning with "ssh" and replace it with the following:

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 443 -i $CMC_KEY -L 6601:lmserver-8:6601 -L 16601:lmserver-8:16601 cpass01.cmc.ca -l $CMC_AG

As a test, verify that your license is active. To do this, run CMC_CADPASS_BATCH_COMSOL.sh with the command "./CMC_CADPASS_BATCH_COMSOL.sh <yourUID>". This will open up a connection with CMC and fetch your license status. Your UID is the numeric portion of your COMSOL key. As an example, the UID of "CMC_12345.key" would be "12345".

An active license will show the following output (type "quit" to quit):

Warning: Permanently added '[cpass01.cmc.ca]:443,[130.15.52.80]:443' (RSA) to the list of known hosts.

IP access services                                            Status
 CMC_COMSOL_lmgrd  CMC COMSOL lmgrd (CMC Data center)           Active
 CMC_COMSOL_vendor  CMC COMSOL vendor                            Active

Enter a service name above, or 'help' for further instructions.

appgate>

If you see dashes ("-") instead of "Active", you should get in touch with CMC and ensure your license gets activated. COMSOL jobs will fail with a licensing error until this is resolved.

Redirect temporary files

COMSOL will attempt to place a large number of temporary and configuration files in your home directory and /tmp (several GB per run). This is not recommended on compute clusters, as /tmp is not shared between nodes and can fill up quickly (causing COMSOL runs to crash with a disk error), and the files it places in one's home directory may use up a significant amount of a user's disk quota under /home. To avoid this, we suggest redirecting all COMSOL tempfiles to your scratch directory. Follow these directions to setup temp file redirection (replace hpc1234 with your user name):

mkdir -p /scratch/hpc1234/comsol_scratch
mv ~/.comsol/* /scratch/hpc1234/comsol_scratch             # moves any existing COMSOL tempfiles to your new scratch directory
rmdir ~/.comsol                                            # if the .comsol directory exists, delete it
ln -s /scratch/hpc1234/comsol_scratch ~/.comsol

Running jobs

Assuming all required files are in the same directory, a typical COMSOL job might look like this (replace <Your_UID> with your UID number):

#!/bin/bash
#$ -S /bin/bash
#$ -V
#$ -cwd
#$ -o $JOB_NAME.o$JOB_ID
#$ -j y

# Change the 12 to however many processors are needed
#$ -pe glinux.pe 12
# Change the 24 to however much memory is needed 
#$ -l mf=24G

use comsol
source /opt/gaussian/setup.sh
(while true; do sleep 60 ; done) | ./CMC_CADPASS_BATCH_COMSOL.sh <Your_UID> &
sleep 30
comsol -np $NSLOTS batch -tmpdir $GAUSS_SCRDIR -inputfile inputFilename.mph -outputfile outputFilename

Once done creating this job script, submit the job with "qsub yourJobScriptName.sh". If you've reached this point, congratulations! You can now run COMSOL jobs on the SW cluster.

License troubleshooting

A start error occured on node 11: Could_not_obtain_license_for#Cluster Node
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 11

Check that you have registered and activated your hpc#### username with CMC.




Could not obtain license for COMSOL Multiphysics.
License error -5. 
No such product exists.

All of the available seats for your license have been checked out and are in use.




A start error occured on node 0: License_error_-15_Cannot_connect_to_license_server_system

The CMC_CADPASS_BATCH_COMSOL.sh licensing script will silently fail (and not connect your job to the server) unless the CMC_#####.key file is in the working directory of the job. To change this behavior, edit CMC_CADPASS_BATCH_COMSOL.sh script to point directly to the location of your key. In this case, change the line beginning with CMC_KEY to the following:

CMC_KEY="/absolute/path/to/your/CMC_"$CMC_UID".key"




My license only works for a single node! How can I schedule multiple jobs to one machine?

Add the following line to your job script. Keep in mind that this may make your jobs considerably more difficult to schedule, as they can only be scheduled on a single node. It is a very good idea to get in touch with CAC user support before doing this, as it might otherwise be extremely difficult to pick a suitable node.

#$ -l hostname=nodeName