OpenMP: Difference between revisions

From Research Computing Center Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:
|}
|}


For more information about the compilers on zcluster, please see [[Code Compilation on zcluster]].
===Defining number of OpenMP threads===
===Defining number of OpenMP threads===


Line 50: Line 52:
qsub -q rcc-30d -pe thread 4 sub.sh
qsub -q rcc-30d -pe thread 4 sub.sh
</pre>
</pre>
For more information about running jobs on zcluster, please see [[Running Jobs on zcluster]].

Revision as of 15:13, 11 February 2013

Compiling OpenMP code on zcluster

The compilers installed on zcluster support shared memory applications using OpenMP. Here are the compiler options to include when using OpenMP:

Compiler Commands Option
PGI pgcc, pgCC, pgf90, etc. -mp
Intel icc, ifort -openmp
GNU gcc, gfortran, g++, gcc44, etc. -fopenmp

For more information about the compilers on zcluster, please see Code Compilation on zcluster.

Defining number of OpenMP threads

The number of OpenMP threads can be specified using the environment variable OMP_NUM_THREADS. For example, to define 4 threads:

For bash/sh:

export OMP_NUM_THREADS=4

For csh/tcsh:

setenv OMP_NUM_THREADS 4

Sample script to run a shared memory job using OpenMP

Sample script (sub.sh) to run a program that uses 4 OpenMP threads:

#!/bin/bash
cd working_directory
export OMP_NUM_THREADS=4
time ./myprog

Sample job submission command on zcluster

To submit a shared memory job that uses 4 OpenMP threads to the rcc-30d queue:

qsub -q rcc-30d -pe thread 4 sub.sh

For more information about running jobs on zcluster, please see Running Jobs on zcluster.