|
| 1 | +#!/bin/bash -xe |
| 2 | + |
| 3 | +# Final return value |
| 4 | +FINAL_RTN=0 |
| 5 | + |
| 6 | +# Number of nodes - for accounting/verification purposes |
| 7 | +# Default: 1 |
| 8 | +NUM_NODES=${CI_NUM_NODES:-1} |
| 9 | + |
| 10 | +if [ "x" != "x${CI_HOSTFILE}" ] ; then |
| 11 | + ARG_HOSTFILE="--hostfile ${CI_HOSTFILE}" |
| 12 | +else |
| 13 | + ARG_HOSTFILE="" |
| 14 | +fi |
| 15 | + |
| 16 | +_shutdown() |
| 17 | +{ |
| 18 | + # --------------------------------------- |
| 19 | + # Cleanup |
| 20 | + # --------------------------------------- |
| 21 | + |
| 22 | + exit $FINAL_RTN |
| 23 | +} |
| 24 | + |
| 25 | +# --------------------------------------- |
| 26 | +# Run the test - Hostname |
| 27 | +# --------------------------------------- |
| 28 | +echo "==========================" |
| 29 | +echo "Test: hostname" |
| 30 | +echo "==========================" |
| 31 | +mpirun ${ARG_HOSTFILE} --map-by ppr:5:node hostname 2>&1 | tee output-hn.txt |
| 32 | + |
| 33 | +# --------------------------------------- |
| 34 | +# Verify the results |
| 35 | +# --------------------------------------- |
| 36 | +ERRORS=`grep ERROR output-hn.txt | wc -l` |
| 37 | +if [[ $ERRORS -ne 0 ]] ; then |
| 38 | + echo "ERROR: Error string detected in the output" |
| 39 | + FINAL_RTN=1 |
| 40 | + _shutdown |
| 41 | +fi |
| 42 | + |
| 43 | +LINES=`wc -l output-hn.txt | awk '{print $1}'` |
| 44 | +if [[ $LINES -ne $(( 5 * $NUM_NODES )) ]] ; then |
| 45 | + echo "ERROR: Incorrect number of lines of output" |
| 46 | + FINAL_RTN=2 |
| 47 | + _shutdown |
| 48 | +fi |
| 49 | + |
| 50 | +if [ $FINAL_RTN == 0 ] ; then |
| 51 | + echo "Success - hostname" |
| 52 | +fi |
| 53 | + |
| 54 | + |
| 55 | +# --------------------------------------- |
| 56 | +# Run the test - Hello World |
| 57 | +# --------------------------------------- |
| 58 | +echo "==========================" |
| 59 | +echo "Test: Hello World" |
| 60 | +echo "==========================" |
| 61 | +mpirun ${ARG_HOSTFILE} --map-by ppr:5:node ./hello 2>&1 | tee output.txt |
| 62 | + |
| 63 | +# --------------------------------------- |
| 64 | +# Verify the results |
| 65 | +# --------------------------------------- |
| 66 | +ERRORS=`grep ERROR output.txt | wc -l` |
| 67 | +if [[ $ERRORS -ne 0 ]] ; then |
| 68 | + echo "ERROR: Error string detected in the output" |
| 69 | + FINAL_RTN=1 |
| 70 | + _shutdown |
| 71 | +fi |
| 72 | + |
| 73 | +LINES=`wc -l output.txt | awk '{print $1}'` |
| 74 | +if [[ $LINES -ne $(( 5 * $NUM_NODES )) ]] ; then |
| 75 | + echo "ERROR: Incorrect number of lines of output" |
| 76 | + FINAL_RTN=2 |
| 77 | + _shutdown |
| 78 | +fi |
| 79 | + |
| 80 | +if [ $FINAL_RTN == 0 ] ; then |
| 81 | + echo "Success - hello world" |
| 82 | +fi |
| 83 | + |
| 84 | +echo "==========================" |
| 85 | +echo "Success" |
| 86 | +echo "==========================" |
| 87 | +_shutdown |
0 commit comments