#!/bin/sh # Redirect stdout and stderr exec > @SIMULATION_NAME@.out 2> @SIMULATION_NAME@.err echo "Preparing:" set -x # Output commands set -e # Abort on errors cd @RUNDIR@ # # export GMON_OUT_PREFIX=gmon.out echo "Checking:" pwd hostname date echo "Environment:" export OMP_NUM_THREADS=@NUM_THREADS@ env > SIMFACTORY/ENVIRONMENT echo "Nodes:" echo 'localhost' > SIMFACTORY/NODES cat > SIMFACTORY/start-exe <<'EOF' use strict; my $simulation = fork; if ($simulation == 0) { exec ('/usr/bin/nice', '-n', '19', '@EXECUTABLE@', @ARGV); die; } my $watchdog = fork; if ($watchdog == 0) { sleep @WALLTIME_SECONDS@; kill 15, $simulation; sleep 60; kill 9, $simulation; exit; } wait; kill 15, $watchdog; EOF chmod a+x SIMFACTORY/start-exe echo "Starting:" echo localhost > localhost mpirun -machinefile localhost -np @NUM_PROCS@ SIMFACTORY/start-exe -L 3 @PARFILE@ echo "Stopping:" date mail -s 'Simulation @SIMULATION_NAME@ finished' @EMAIL@ <