Difference between revisions of "HowTo:comsol"

From CAC Wiki
Jump to: navigation, search
(create COMSOL documentation)
 
(Redirect temporary files)
Line 17: Line 17:
 
<pre>
 
<pre>
 
mkdir -p /scratch/hpc1234/comsol_scratch
 
mkdir -p /scratch/hpc1234/comsol_scratch
mv ~/.comsol/* /scratch/hpc1234/comsol_scratch            # move any existing COMSOL tempfiles to your new scratch directory
+
mv ~/.comsol/* /scratch/hpc1234/comsol_scratch            # moves any existing COMSOL tempfiles to your new scratch directory
rmdir ~/.comsol
+
rmdir ~/.comsol                                           # if the .comsol directory exists, delete it
 
ln -s /scratch/hpc1234/comsol_scratch ~/.comsol
 
ln -s /scratch/hpc1234/comsol_scratch ~/.comsol
 
</pre>
 
</pre>

Revision as of 15:39, 29 August 2016

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

Redirect temporary files

COMSOL also attempts to place a large number of temporary and configuration files in your home directory and /tmp. This is not recommended on our systems, as /tmp 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 your home directory, a typical COMSOL job might look like this (replace <Your_UID> with your UID number):

NOTE: your UID is the numeric portion of your COMSOL key. As an example, the UID of "CMC_12345.key" would be "12345".

#!/bin/bash
#$ -S /bin/bash
#$ -V
#$ -cwd
#$ -q abaqus.q
#$ -l qname=abaqus.q
#$ -o 
#$ -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 comsol
(while true; do sleep 60 ; done) | ./CMC_CADPASS_BATCH_COMSOL.sh <Your_UID> &
sleep 30
comsol -nn 1 -np $NSLOTS batch -tmpdir /scratch/hpc1234/comsol_scratch -inputfile inputFilename.mph -outputfile outputFilename

Once done creating this job script, submit the job with "qsub yourJobScriptName.sh".