Difference between revisions of "MPI Certification Job template"
Jump to navigation
Jump to search
Line 35: | Line 35: | ||
MPI_Finalize(); | MPI_Finalize(); | ||
} | |||
$ less mpi-hooks.sh | |||
#!/bin/sh | |||
# | |||
# This function will be called before the MPI executable is started. | |||
# You can, for example, compile the executable itself. | |||
# | |||
pre_run_hook () { | |||
# Compile the program. | |||
echo "Compiling ${I2G_MPI_APPLICATION} with `which mpicc`" | |||
# Actually compile the program. | |||
cmd="mpicc ${MPI_MPICC_OPTS} -o ${I2G_MPI_APPLICATION} ${I2G_MPI_APPLICATION}.c" | |||
echo $cmd | |||
$cmd | |||
if [ ! $? -eq 0 ]; then | |||
echo "Error compiling program. Exiting..." | |||
exit 1 | |||
fi | |||
# Everything's OK. | |||
echo "Successfully compiled ${I2G_MPI_APPLICATION}" | |||
return 0 | |||
} | |||
echo "zazzazzareo " hostname | |||
# | |||
# This function will be called before the MPI executable is finished. | |||
# A typical case for this is to upload the results to a storage element. | |||
# | |||
post_run_hook () { | |||
echo "Executing post hook." | |||
echo "Finished the post hook." | |||
return 0 | |||
} | } |
Revision as of 09:51, 16 December 2010
MPI Certification Job
Examples of needed files:
$ less newmpi.jdl JobType = "Normal"; CPUNumber = 2; Executable = "mpi-start-wrapper.sh"; Arguments = "hello MPICH"; StdOutput = "mpi-test.out"; StdError = "mpi-test.err"; InputSandbox = {"mpi-start-wrapper.sh","mpi-hooks.sh","hello.c"}; OutputSandbox = {"mpi-test.err","mpi-test.out"}; #Requirements = # Member("MPICH", other.GlueHostApplicationSoftwareRunTimeEnvironment) # && Member("OPENMPI", other.GlueHostApplicationSoftwareRunTimeEnvironment); #Requirements = other.GlueCEInfoLRMSType == "PBS" || other.GlueCEInfoLRMSType == "LSF"; Requirements = other.GlueCEInfoHostName == "unipa-ce-01.pa.pi2s2.it";
$ less hello.c #include <stdio.h> #include <mpi.h> int main(int argc, char *argv[]) { int numprocs, rank, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Get_processor_name(processor_name, &namelen); printf("Process %d on %s out of %d\n", rank, processor_name, numprocs); MPI_Finalize(); }
$ less mpi-hooks.sh #!/bin/sh # # This function will be called before the MPI executable is started. # You can, for example, compile the executable itself. # pre_run_hook () { # Compile the program. echo "Compiling ${I2G_MPI_APPLICATION} with `which mpicc`" # Actually compile the program. cmd="mpicc ${MPI_MPICC_OPTS} -o ${I2G_MPI_APPLICATION} ${I2G_MPI_APPLICATION}.c" echo $cmd $cmd if [ ! $? -eq 0 ]; then echo "Error compiling program. Exiting..." exit 1 fi
# Everything's OK. echo "Successfully compiled ${I2G_MPI_APPLICATION}" return 0 } echo "zazzazzareo " hostname # # This function will be called before the MPI executable is finished. # A typical case for this is to upload the results to a storage element. # post_run_hook () { echo "Executing post hook." echo "Finished the post hook." return 0 }