tutoMPI: mpi-hooks.sh

File mpi-hooks.sh, 787 bytes (added by /O=GRID-FR/C=FR/O=CNRS/OU=LPSC/CN=Fabian Lambert, 16 years ago)
Line 
1#!/bin/sh
2
3#
4# This function will be called before the MPI executable is started.
5# You can, for example, compile the executable itself.
6#
7pre_run_hook () {
8
9 # Compile the program.
10 echo "Compiling ${I2G_MPI_APPLICATION}"
11
12 # Actually compile the program.
13 cmd="mpicc ${MPI_MPICC_OPTS} -o ${I2G_MPI_APPLICATION} ${I2G_MPI_APPLICATION}.c"
14 echo $cmd
15 $cmd
16 if [ ! $? -eq 0 ]; then
17 echo "Error compiling program. Exiting..."
18 exit 1
19 fi
20
21 # Everything's OK.
22 echo "Successfully compiled ${I2G_MPI_APPLICATION}"
23
24 return 0
25}
26
27#
28# This function will be called before the MPI executable is finished.
29# A typical case for this is to upload the results to a storage
30element.
31#
32post_run_hook () {
33
34 echo "Executing post hook."
35 echo "Finished the post hook."
36
37 return 0
38}