Mpich

From MediaWiki

Revision as of 09:28, 12 October 2011 by Ngrkic (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In this exercise user should obtain prepared openmp job, extract archive, list content of files, submit job on PARADOX cluster, monitor his progress with information from queue and when job is done list resaults file.

1. Login on ui.ipb.ac.rs:

$ ssh ngrkic@ui.ipb.ac.rs

2. Navigate to your folder in nfs filesystem.

$ cd /nfs/ngrkic

3. Download tgz archive with example files.

wget http://wiki.ipb.ac.rs/images/7/79/Openmp.tgz

4. Extract archive :

$ tar xvzf openmp.tgz

5. Enter openmp folder

$ cd openmp

6. List content of folder:

$ ll

7. List content of job.pbs and job.c files:

$ cat job.pbs
#!/bin/bash
#PBS -q hpsee
#PBS -l nodes=1:ppn=6
#PBS -l walltime=10:00:00
#PBS -e ${PBS_JOBID}.err
#PBS -o ${PBS_JOBID}.out

cd $PBS_O_WORKDIR
chmod +x job
export OMP_NUM_THREADS=6
./job
$ cat job.c
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[]) 
{
int nthreads, tid;

/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(nthreads, tid)
  {

  /* Obtain thread number */
  tid = omp_get_thread_num();
  printf("Hello World from thread = %d\n", tid);

  /* Only master thread does this */
  if (tid == 0) 
    {
    nthreads = omp_get_num_threads();
    printf("Number of threads = %d\n", nthreads);
    }

  }  /* All threads join master thread and disband */

}

8. Submit job :

qsub job.pbs

qsub will print output :

<jobID>.ce64.ipb.ac.rs

9. Monitor your job :

qstat <jobID>.ce64.ipb.ac.rs

10.When job is done list content of <jobID>.ce64.ipb.ac.rs.out file :

cat <jobID>.ce64.ipb.ac.rs.out
Hello World from thread = 0
Number of threads = 6
Hello World from thread = 1
Hello World from thread = 3
Hello World from thread = 2
Hello World from thread = 4
Hello World from thread = 5
Personal tools