Difference between revisions of "MPI Certification Job template"
Jump to navigation
Jump to search
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Op menubar}} | |||
{{Template:Doc_menubar}} | |||
{{TOC_right}} | |||
[[Category:Operations Manuals]] | |||
==MPI Certification Job== | ==MPI Certification Job== | ||
Examples of needed files: | Examples of needed files: | ||
===newmpi.jdl=== | |||
<source lang="bash"> | |||
JobType = "Normal"; | JobType = "Normal"; | ||
CPUNumber = 2; | CPUNumber = 2; | ||
Line 17: | Line 22: | ||
#Requirements = other.GlueCEInfoLRMSType == "PBS" || other.GlueCEInfoLRMSType == "LSF"; | #Requirements = other.GlueCEInfoLRMSType == "PBS" || other.GlueCEInfoLRMSType == "LSF"; | ||
Requirements = other.GlueCEInfoHostName == "unipa-ce-01.pa.pi2s2.it"; | Requirements = other.GlueCEInfoHostName == "unipa-ce-01.pa.pi2s2.it"; | ||
</source> | |||
===hello.c=== | |||
<source lang="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(); | |||
} | |||
</source> | |||
===mpi-hooks.sh === | |||
<source lang="bash"> | |||
#!/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 | |||
} | |||
</source> | |||
=== mpi-start-wrapper.sh === | |||
<source lang="bash"> | |||
#!/bin/bash | |||
# Pull in the arguments. | |||
MY_EXECUTABLE=`pwd`/$1 | |||
MPI_FLAVOR=$2 | |||
# Convert flavor to lowercase for passing to mpi-start. | |||
MPI_FLAVOR_LOWER=`echo $MPI_FLAVOR | tr '[:upper:]' '[:lower:]'` | |||
# Pull out the correct paths for the requested flavor. | |||
eval MPI_PATH=`printenv MPI_${MPI_FLAVOR}_PATH` | |||
# Ensure the prefix is correctly set. Don't rely on the defaults. | |||
eval I2G_${MPI_FLAVOR}_PREFIX=$MPI_PATH | |||
export I2G_${MPI_FLAVOR}_PREFIX | |||
# Touch the executable. It exist must for the shared file system check. | |||
# If it does not, then mpi-start may try to distribute the executable | |||
# when it shouldn't. | |||
touch $MY_EXECUTABLE | |||
# Setup for mpi-start. | |||
export I2G_MPI_APPLICATION=$MY_EXECUTABLE | |||
export I2G_MPI_APPLICATION_ARGS= | |||
export I2G_MPI_TYPE=$MPI_FLAVOR_LOWER | |||
export I2G_MPI_PRE_RUN_HOOK=mpi-hooks.sh | |||
export I2G_MPI_POST_RUN_HOOK=mpi-hooks.sh | |||
# If these are set then you will get more debugging information. | |||
export I2G_MPI_START_VERBOSE=1 | |||
export I2G_MPI_START_DEBUG=1 | |||
export I2G_MPI_START_TRACE=1 | |||
# Invoke mpi-start. | |||
$I2G_MPI_START | |||
echo "Running on: $HOSTNAME" | |||
echo "*************************************" | |||
echo "ARCH=`arch`" | |||
echo "*************************************" | |||
echo "uname_out=`uname -a`" | |||
echo "*************************************" | |||
echo "mpicc_arch=`file /opt/mpich-1.2.7p1/bin/serv_p4`" | |||
echo "*************************************" | |||
echo "gcc_arch=$(file $(which gcc))" | |||
echo "*************************************" | |||
echo "infiniband=$(grep infiniband /proc/devices)" | |||
echo "*************************************" | |||
echo "cpu_info=`cat /proc/cpuinfo`" | |||
echo "*************************************" | |||
exit 0 | |||
</source> |
Latest revision as of 22:31, 1 December 2012
Main | EGI.eu operations services | Support | Documentation | Tools | Activities | Performance | Technology | Catch-all Services | Resource Allocation | Security |
Documentation menu: | Home • | Manuals • | Procedures • | Training • | Other • | Contact ► | For: | VO managers • | Administrators |
MPI Certification Job
Examples of needed files:
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";
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();
}
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
}
mpi-start-wrapper.sh
#!/bin/bash
# Pull in the arguments.
MY_EXECUTABLE=`pwd`/$1
MPI_FLAVOR=$2
# Convert flavor to lowercase for passing to mpi-start.
MPI_FLAVOR_LOWER=`echo $MPI_FLAVOR | tr '[:upper:]' '[:lower:]'`
# Pull out the correct paths for the requested flavor.
eval MPI_PATH=`printenv MPI_${MPI_FLAVOR}_PATH`
# Ensure the prefix is correctly set. Don't rely on the defaults.
eval I2G_${MPI_FLAVOR}_PREFIX=$MPI_PATH
export I2G_${MPI_FLAVOR}_PREFIX
# Touch the executable. It exist must for the shared file system check.
# If it does not, then mpi-start may try to distribute the executable
# when it shouldn't.
touch $MY_EXECUTABLE
# Setup for mpi-start.
export I2G_MPI_APPLICATION=$MY_EXECUTABLE
export I2G_MPI_APPLICATION_ARGS=
export I2G_MPI_TYPE=$MPI_FLAVOR_LOWER
export I2G_MPI_PRE_RUN_HOOK=mpi-hooks.sh
export I2G_MPI_POST_RUN_HOOK=mpi-hooks.sh
# If these are set then you will get more debugging information.
export I2G_MPI_START_VERBOSE=1
export I2G_MPI_START_DEBUG=1
export I2G_MPI_START_TRACE=1
# Invoke mpi-start.
$I2G_MPI_START
echo "Running on: $HOSTNAME"
echo "*************************************"
echo "ARCH=`arch`"
echo "*************************************"
echo "uname_out=`uname -a`"
echo "*************************************"
echo "mpicc_arch=`file /opt/mpich-1.2.7p1/bin/serv_p4`"
echo "*************************************"
echo "gcc_arch=$(file $(which gcc))"
echo "*************************************"
echo "infiniband=$(grep infiniband /proc/devices)"
echo "*************************************"
echo "cpu_info=`cat /proc/cpuinfo`"
echo "*************************************"
exit 0