HowTo:comsol

From CAC Wiki
Revision as of 14:56, 30 August 2016 by Hasch (Talk | contribs) (Hasch moved page COMSOL to HowTo:comsol: Consistency in naming)

Jump to: navigation, search

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).

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
#$ -q abaqus.q
#$ -l qname=abaqus.q
#$ -o comsol_job.o$JOB_ID
#$ -j y

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

use java8
use comsol
(while true; do sleep 60 ; done) | ./CMC_CADPASS_BATCH_COMSOL.sh <Your_UID> &
sleep 30
comsol -clustersimple batch -tmpdir /scratch/hpc1234/comsol_scratch -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.




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