Wrap all RTS functions exposed to AMPI programs in special macros
[charm.git] / src / scripts / testrun
blob0e65302005cc711a0a062e8b211478da141efce1
1 #!/bin/bash
3 #check if ppn divides p
4 ppn_found=0
5 ppn=0
6 #parse the arguments to extract the ppn number
7 IFS=' ' read -r -a array <<< "$*"
8 for i in "${array[@]}"
9 do
10 if [ $ppn_found -eq 1 ] ; then
11 ppn=$i
12 #echo "FOUND ppn:" $i
13 break
15 if [[ $i == *"ppn"* ]]; then
16 ppn=$(echo $i | cut -d'n' -f 2)
17 if [ -z "$ppn" ]
18 then
19 ppn_found=1
20 else
21 break
25 done
27 #now parse the arguments to run to find the p number
28 p=0
29 p_found=0
30 s=$*
31 IFS=' ' read -r -a array <<< "$*"
32 for i in "${array[@]}"
34 if [ $p_found -eq 1 ] ; then
35 p=$i
36 #echo "FOUND p:" $p
37 break
39 if [[ $i == "+p"* ]]; then
40 p=$(echo $i | cut -d'p' -f 2)
41 if [ -z "$p" ]
42 then
43 p_found=1
44 else
45 break
48 done
50 #if ppn is zero, don't do division test
51 if [[ $ppn -eq 0 ]] ; then
52 ./charmrun $*
53 else #division test
54 #check if p divides ppn
55 m=`expr $p % $ppn`
56 if [[ $p -ne 0 && $m -eq 0 ]] ; then
57 #if it divides run the test
58 ./charmrun $*
59 else
60 #if it does not divide, give a warning and do not run
61 echo "Warning: ppn does not divide p. Skipping the test."