#!/bin/bash # please do not move this script as relies on ../.. being DYNAMICO_ROOT # usage : ./python.sh mode [n] script script_args # mode is 'serial' or mpi # if mode is 'mpi' then argument [n] specifies the number of MPI processes function cmd_serial() { LD_PRELOAD=$PYTHON_PRELOAD python -u $* } function cmd_gdb() { set -x LD_PRELOAD=$PYTHON_PRELOAD gdb --args python -u $* } function cmd_mpi() { NB_MPI=$1 shift rm -f xios_client*.* mpirun --mca mpi_warn_on_fork 0 -np $NB_MPI python -u $* 2>&1 | tee dynamico.log } TEST=$PWD DYNAMICO_ROOT=$(cd -P $(dirname $0)/../.. ; pwd) cd $DYNAMICO_ROOT cp -i -u Python/dynamico/*.py lib/dynamico/ cp -i -u Python/dynamico/dev/*.py lib/dynamico/dev/ . arch.env . arch.path cd $DYNAMICO_ROOT/Python/env . $CURRENT_ARCH.env cd $TEST export OMP_STACKSIZE=128M ulimit -s unlimited CMD=$1 shift cmd_$CMD $*