File: test-dolfin-cpp

package info (click to toggle)
dolfin 2018.1.0.post1-16
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 28,764 kB
  • sloc: xml: 104,040; cpp: 98,856; python: 22,511; makefile: 204; sh: 182
file content (45 lines) | stat: -rw-r--r-- 1,475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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 OMPI_MCA_plm_rsh_agent=/bin/false
export OMPI_MCA_rmaps_base_oversubscribe=1

DEMO_DIR=./dolfin-demo

rm -rf $DEMO_DIR
cp -rL /usr/share/dolfin/demo $DEMO_DIR

cd $DEMO_DIR
cmake -DCMAKE_C_COMPILER=mpicc .
make -j${N_CPU} all

DEMO_LIST=`find . -executable -name demo*[^.dir]`

# construct ctest scripts
# (cf. add_test in source cmake/scripts/generate-cmakefiles.py)
CTESTFILE=CTestTestfile.cmake
for d in ${DEMO_LIST}; do
    demo_bin=`basename $d`
    dir=`dirname $d`
    echo -e "subdirs(\"${dir}\")" >> $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 C++ demos (serial)"
ctest --output-on-failure -j${N_CPU} -R serial

echo "running C++ demos (MPI)"
ctest --output-on-failure -j${N_MPI_TESTS} -R mpi

cd ..