MPI job submission using SunStudio 12

The default compiler, Sun Studio 12, is installed in /opt/sun/sunstudio12.

[heri@fep ~]$ cc -V
cc: Sun C 5.9 Linux_i386 Patch 124871-01 2007/07/31
usage: cc [ options] files.  Use 'cc -flags' for details

For this example we will compile a basic hello_world example.

 

1 /* C Example */

2 #include
3 #include "mpi.h"
4
5
6 int main (int argc, char *argv[])
7 {
8   int rank, size;
9
10   MPI_Init (&argc, &argv);      /* starts MPI */
11   MPI_Comm_rank (MPI_COMM_WORLD, &rank);        /* get current process id */
12   MPI_Comm_size (MPI_COMM_WORLD, &size);        /* get number of processes */
13   printf( "Hello world from process %d of %d\n", rank, size );
14   MPI_Finalize();
15   return 0;
16 }

 

Step 1: compile the program using mpicc

mpicc -o out_file myfile.c

Step 2: submit the job to the batch system

qsub -q ibm-quad -pe ibm-quad [nr_procesoare <56] -cwd myscript.sh

-q

selected queue. By default you should use ibm-quad. Available queues should be  ibm-quad, fs-dual, fs-p4

-pe [nr-procs]

Paralel Environment (MPI environment) attached to the selected queue. Use the same as queue name.

[nr-procs] - number of MPI processes to run.

-cwd Change working directory. By default, all nodes use a shared home environment This option forces sun grid engine to use the current working directory as
myscript.sh

execution script:

#!/bin/bash

/opt/openmpi/default/bin/mpirun -np $NSLOTS ./out_file