Difference between revisions of "Fluent Guide"

From Storrs HPC Wiki
Jump to: navigation, search
(Rewrite interactive job commands. Remove unnecessary instructions line for connecting with SSH and running a serial job.)
Line 1: Line 1:
 +
<!-- Administrator notes:
 +
 +
`fluent -help` actually provides very limited information for command-line usage.
 +
The only place to read more documentation is the help in the Fluent GUI:
 +
So open a terminal in X2Go, load the fluent module, run `fluent`, click on the Help button > Help on Parallel Processing > Starting Parallel ANSYS Fluent on a Linux System
 +
 +
-->
 +
 
=Module File=
 
=Module File=
First check the available fluent module
+
First check the available fluent modules
 
  module avail fluent
 
  module avail fluent
 
To load fluent version 16.2:
 
To load fluent version 16.2:
 
  module load fluent/16.2
 
  module load fluent/16.2
 
=Run Fluent with Slurm=
 
[[HPC Getting Started#SSH access|SSH]] into the HPC Cluster to use SLURM.
 
 
==Serial Job==
 
Create a batch script, say, fluent.sh, with something similar to:
 
#!/bin/bash
 
#SBATCH -n 1 # only allocate 1 task
 
#SBATCH -J fluent1 # sensible name for the job
 
#SBATCH -o fluent_$J.out #the file to write the stdout for fluent job
 
#SBATCH -e fluent_%J.err #the fiel to write the stderr for fluent job
 
 
export FLUENT_GUI=off
 
 
fluent 2d -g -i foo.txt
 
 
Then, submit the job as:
 
sbatch<fluent.sh
 
  
 
==Parallel Job==
 
==Parallel Job==
Line 27: Line 17:
 
  #!/bin/bash
 
  #!/bin/bash
 
  #SBATCH -N 2 # allocate 2 nodes for the job
 
  #SBATCH -N 2 # allocate 2 nodes for the job
  #SBATCH -n 40 # total number of tasks. Or you can specify number of tasks per node as "#SBATCH --ntasks-per-node=20"
+
  #SBATCH --ntasks-per-node=20
 
  #SBATCH --exclusive # no other jobs on the nodes while job is running
 
  #SBATCH --exclusive # no other jobs on the nodes while job is running
#SBATCH -J fluentP1 # sensible name for the job
+
  #SBATCH -o fluentP_$J.out # the file to write stdout for fluent job
  #SBATCH -o fluentP_$J.out #the file to write the stdout for fluent job
+
  #SBATCH -e fluentP_%J.err # the file to write stderr for fluent job
  #SBATCH -e fluentP_%J.err #the fiel to write the stderr for fluent job
 
 
   
 
   
export FLUENT_GUI=off
 
 
  if [ -z "$SLURM_NPROCS" ]; then
 
  if [ -z "$SLURM_NPROCS" ]; then
 
   N=$(( $(echo $SLURM_TASKS_PER_NODE | sed -r 's/([0-9]+)\(x([0-9]+)\)/\1 * \2/') ))
 
   N=$(( $(echo $SLURM_TASKS_PER_NODE | sed -r 's/([0-9]+)\(x([0-9]+)\)/\1 * \2/') ))
Line 43: Line 31:
 
   
 
   
 
  # run fluent in batch on the allocated node(s)
 
  # run fluent in batch on the allocated node(s)
  fluent 2ddp -g -slurm -t$N -pnmpi -ssh -i foo.txt
+
  fluent <span style=color:red>2ddp</span> -g -slurm -t$N -pnmpi -ssh -i <span style=color:red>foo.txt</span>
Then, submit your job as:
+
 
  sbatch< fluentP.sh
+
Make sure to replace <span style=color:red>foo.txt</span> in the last line with the name of your job file.
 +
 
 +
Then, submit your job with:
 +
  sbatch fluentP.sh
  
 
==Interactive Job==
 
==Interactive Job==
For an interactive run of the Fluent, you can use this simple script, fluent-srun.sh:
+
 
#!/bin/bash
+
Start the interactive session on 1 node with 12 CPUs with fisbatch:
HOSTSFILE=.hostlist-job$SLURM_JOB_ID
+
fisbatch -N 1 -n 12 -p Westmere
if [ "$SLURM_PROCID" == "0" ]; then
+
 
    srun hostname -f > $HOSTSFILE
+
The first parameter to fluent is the version (namely, <span style=color:red>2ddp</span> below).
    fluent -t $SLURM_NTASKS -cnf=$HOSTSFILE -ssh 3d
+
The version can be either 2d, 3d, 2ddp, or 3ddp; change it to whatever you need.
    rm -f $HOSTSFILE
+
The "dp" stands for "double precision".
fi
+
 
exit 0
+
Run fluent with:
To run an interactive session, use srun like this:
+
 
$ srun -n <#procs> ./fluent-srun.sh
+
fluent <span style=color:red>2ddp</span> -g -t $SLURM_NTASKS
 +
 
 +
Type "exit" to end the session.
  
 
[[Category:Software]]
 
[[Category:Software]]

Revision as of 12:29, 2 March 2016


Module File

First check the available fluent modules

module avail fluent

To load fluent version 16.2:

module load fluent/16.2

Parallel Job

To run several tasks in parallel on one or more nodes, here is an example fluentP.sh batch script:

#!/bin/bash
#SBATCH -N 2 # allocate 2 nodes for the job
#SBATCH --ntasks-per-node=20
#SBATCH --exclusive # no other jobs on the nodes while job is running
#SBATCH -o fluentP_$J.out # the file to write stdout for fluent job
#SBATCH -e fluentP_%J.err # the file to write stderr for fluent job

if [ -z "$SLURM_NPROCS" ]; then
  N=$(( $(echo $SLURM_TASKS_PER_NODE | sed -r 's/([0-9]+)\(x([0-9]+)\)/\1 * \2/') ))
else
  N=$SLURM_NPROCS
fi

echo -e "N: $N\n";

# run fluent in batch on the allocated node(s)
fluent 2ddp -g -slurm -t$N -pnmpi -ssh -i foo.txt

Make sure to replace foo.txt in the last line with the name of your job file.

Then, submit your job with:

sbatch fluentP.sh

Interactive Job

Start the interactive session on 1 node with 12 CPUs with fisbatch:

fisbatch -N 1 -n 12 -p Westmere

The first parameter to fluent is the version (namely, 2ddp below). The version can be either 2d, 3d, 2ddp, or 3ddp; change it to whatever you need. The "dp" stands for "double precision".

Run fluent with:

fluent 2ddp -g -t $SLURM_NTASKS

Type "exit" to end the session.