#!/bin/bash # allow parallel jobs, but don't load up more than 8 NPROC=$( nproc ) MAX_CPU=8 N_CPU=$(( NPROC > MAX_CPU ? MAX_CPU : NPROC )) # MPI tests are set up to run on 3 processes. Spread them leanly over the available processors (don't have more than 2 tests using one processor). # e.g. run 1 MPI test at a time over 1-3 processors, or 2 tests at a time over 4-6 processors, or 3 tests over 7-9 processors, etc. N_MPI=3 N_MPI_TESTS=$(( (N_CPU+N_MPI-1)/N_MPI )) export PRTE_MCA_plm_ssh_agent=/bin/false export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe export PETSC_DIR=/usr/lib/petsc64 export SLEPC_DIR=/usr/lib/slepc64 # first check unit tests still pass UNITTEST_SOURCE_DIR=./test/unit/cpp DOLFIN_SOURCE_DIR=$(pwd) # need to run ffc to generate test/unit/cpp/function/Projection.h from ufl cat >> ${UNITTEST_SOURCE_DIR}/CMakeLists.txt <> $CTESTFILE echo -e "add_test(${demo_bin}_mpi \"mpirun\" \"-np\" \"${N_MPI}\" \"./${demo_bin}\")" >> $dir/$CTESTFILE echo "add_test(${demo_bin}_serial \"./${demo_bin}\")" >> $dir/$CTESTFILE done # demo_hyperelasticity_mpi diverges, so skip echo "set(CTEST_CUSTOM_TESTS_IGNORE demo_hyperelasticity_mpi)" > CTestCustom.cmake echo "running 64-bit C++ demos (serial)" ctest --output-on-failure -j${N_CPU} -R serial echo "running 64-bit C++ demos (MPI)" echo "available CPUs: NPROC=${NPROC}, of which we use N_CPU=${N_CPU}" echo "using ${N_MPI} processes per demo (i.e. run ${N_MPI_TESTS} demo[s] at once)" ctest --output-on-failure -j${N_MPI_TESTS} -R mpi cd ..