use OpenMP on eddie

In phase one, eddie is a 'thin' SMP cluster. Each work node could provides 4 cpu slots sharing 8 GB memory. This feature allows users to do shared memory programming (i.e. OpenMP) on single node. Since eddie is comprised of thin nodes, it is more fit for distributed memory programming (i.e. MPI) rather than shared memory way. We might buy some 'fat' SMP machines like Sun X4600 (16 or 32 way) in phase two to give more spacious shared memory environment.

Intel compilers have the full support for OpenMP programming. You must load the modules before building or running OpenMP codes. Follow the steps below to build and run an example OpenMP codes on eddie:

hello.c

#include <omp.h>

  main(){
    #pragma omp parallel
    {
     printf("hello from thread %d of %d\n",omp_get_thread_num(),omp_get_num_threads());
    }
    printf("outside thread num is %d\n",omp_get_num_threads());
  }

1. Add intel compiler modules to your shell environment

module add intel/cce
module add intel/fce

2. Build OpenMP code

icc -openmp -o hello ./hello.c

3. Write a OpenMP job script

hello.sh

#!/bin/sh
###################################################
#                                                 #  
# A SGE batch job template for ECDF Cluster eddie #
#                                                 #
# by ECDF System Team                             # 
# ecdf-systems-team@lists.ed.ac.uk                #
#                                                 #
###################################################

# Grid Engine options

#$ -cwd
#$ -l h_rt=00:01:00
#$ -N hello

# initiallise environment module 

. /etc/profile

# use OpenMP with Intel (icc,ifort) compiler

module add intel/cce
module add intel/fce

# set number of threads

export OMP_NUM_THREADS=4

# Run OpenMP

./hello

4. Submit the job to Grid Engine

qsub -pe OpenMP <slots> ./hello.sh

use OpenMP (last edited 2007-12-05 15:10:58 by Yuan WAN)