66 lines
1.5 KiB
Bash
Executable File
66 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "Current directory: $PWD"
|
|
# get arch using uname -m
|
|
# if aarch64 then use arm64-v8a else use x86_64
|
|
ARCH=$(uname -m)
|
|
if [ "$ARCH" == "aarch64" ]; then
|
|
BUILD_ARCH="arm64-v8a"
|
|
else
|
|
BUILD_ARCH="x86_64"
|
|
fi
|
|
# Build directory
|
|
BUILD_DIR="./build/linux/$BUILD_ARCH/release"
|
|
|
|
# Programs
|
|
MPI_HELLO="$BUILD_DIR/mpi_hello_world"
|
|
MPI_PI="$BUILD_DIR/mpi_pi"
|
|
SERIAL_PI="$BUILD_DIR/serial_pi"
|
|
|
|
# Check if programs exist
|
|
if [[ ! -f "$MPI_HELLO" ]]; then
|
|
echo "Error: $MPI_HELLO not found. Please build first."
|
|
exit 1
|
|
fi
|
|
if [[ ! -f "$MPI_PI" ]]; then
|
|
echo "Error: $MPI_PI not found. Please build first."
|
|
exit 1
|
|
fi
|
|
if [[ ! -f "$SERIAL_PI" ]]; then
|
|
echo "Error: $SERIAL_PI not found. Please build first."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Programs found. Starting tests..."
|
|
|
|
# Test mpi_hello_world
|
|
echo "Testing mpi_hello_world with default settings:"
|
|
mpirun --hostfile ~/mpi_hosts "$MPI_HELLO"
|
|
echo "mpi_hello_world test completed."
|
|
|
|
# Terms to test
|
|
TERMS=(1000 100000 1000000 10000000 1000000000)
|
|
PROCS=(1 2 3 4 5 6)
|
|
|
|
echo ""
|
|
echo "Testing mpi_pi with different terms and processes:"
|
|
|
|
for procs in "${PROCS[@]}"; do
|
|
for terms in "${TERMS[@]}"; do
|
|
echo "Running mpi_pi with $procs processes and $terms terms:"
|
|
mpirun --hostfile ~/mpi_hosts -np $procs "$MPI_PI" <<< $terms
|
|
echo ""
|
|
done
|
|
done
|
|
|
|
echo ""
|
|
echo "Testing serial_pi with different terms:"
|
|
|
|
for terms in "${TERMS[@]}"; do
|
|
echo "Running serial_pi with $terms terms:"
|
|
"$SERIAL_PI" <<< $terms
|
|
echo ""
|
|
done
|
|
|
|
echo "All tests completed."
|