Main menu

Search

Comsol

Comsol is only available to licensed groups through CoE's ECI - contact help@engr.ucsb.edu for more information.

To use Comsol, save your file as a '.mph' file on the computer you regularly use Comsol from. Transfer this file to Knot.

You will need a .job file to run your job in the queue, an example one is at the end of this page - note that you really only need to adjust the 'ppn' (processors/node) and the job name lines.

Once you set the filenames and 'ppn', you submit with a

qsub myfile.job (assuming you've named the file below myfile.job). To run on a regular node (48GB of RAM and up to 12 cores - that is ppn=12) use

qsub myfile.job

To run on the 'fat' (high memory, up to 1TB) nodes (where you can set ppn as high as 32) use

qsub -q largemem myfile.job

In this example, progress info goes to batch.log and when finished your output is in the file myfile-out.mph that you can transfer back to your desktop to look at.

#!/bin/bash
# This is for a single node job, leave nodes=1, only adjust ppn
#PBS -l nodes=1:ppn=12
# Make sure that we are in the same subdirectory as where the qsub command is issued
cd $PBS_O_WORKDIR
# Setting up some files
cat $PBS_NODEFILE > nodes
# Get number of nodes allocated
NO_OF_NODES=`cat $PBS_NODEFILE | egrep -v '^#'\|'^$' | wc -l | awk '{print $1}'`
NODE_LIST=`cat $PBS_NODEFILE `
# Just for kicks, see which nodes we got.
echo $NODE_LIST
# # Run the executable. *DO NOT PUT* a '&' at the end
# Note - this example uses ComSol 5.2 - there are other
# versions available too - look in /sw/eci
# This is the line you need to change for your filenames
/sw/eci/comsol52/bin/comsol -np $NO_OF_NODES batch -inputfile ./myfile.mph -outputfile ./myfile-out.mph -batchlog batch.log
# # End of script-file.
# #######################################################################

Below is how you can run things across multiple nodes, although this is more touchy - so try the single node job (above) with 12 cores first.

#!/bin/sh
##############################################################################
# First we have some directives to the queueing system. Must be in # the first block of comment lines.
# IMPORTANT: the next line determines how many nodes to run on
# nodes is number of nodes, ppn= processors per node
#PBS -l nodes=1:ppn=12
# # Make sure that we are in the same subdirectory as where the qsub command is issued
cd $PBS_O_WORKDIR
# Setting up some files
cat $PBS_NODEFILE > nodes cat $PBS_NODEFILE | uniq > mpd.conf
# Get number of nodes allocated
NO_OF_NODES=`cat $PBS_NODEFILE | egrep -v '^#'\|'^$' | wc -l | awk '{print $1}'`
NODE_LIST=`cat $PBS_NODEFILE `
# # Just for kicks, see which nodes we got.
echo $NODE_LIST
# # # Run the executable. *DO NOT PUT* a '&' at the end
# Note - this example uses ComSol 4.4 - there are other
# versions available too - look in /sw/eci
# Some setup stuff - you don't need to change this line
/sw/eci/comsol44/COMSOL44/bin/comsol -nn $PBS_NUM_NODES mpd boot -f mpd.conf -mpirsh ssh /sw/eci/comsol44/COMSOL44/bin/comsol mpd trace -l
# This is the line you need to change for your filenames
/sw/eci/comsol44/COMSOL44/bin/comsol -nn $PBS_NUM_NODES -np $NO_OF_NODES batch -inputfile ./3D.mph -outputfile ./myfile-out.mph -batchlog batch.log
# Some cleanup - you don't need to change
/sw/eci/comsol42/bin/comsol mpd allexit
# # End of script-file. # #######################################################################