-
Notifications
You must be signed in to change notification settings - Fork 0
/
cibw-check-mpi.sh
executable file
·71 lines (57 loc) · 1.6 KB
/
cibw-check-mpi.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -euo pipefail
mpiname="${MPINAME:-mpich}"
tempdir="$(mktemp -d)"
trap 'rm -rf $tempdir' EXIT
cd "$tempdir"
cat > helloworld.c << EOF
#include <mpi.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int size, rank, len;
char name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(name, &len);
printf("Hello, World! I am process %d of %d on %s.\n", rank, size, name);
MPI_Finalize();
return 0;
}
EOF
ln -s helloworld.c helloworld.cxx
if test "$mpiname" = "openmpi"; then
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
export OMPI_MCA_btl=tcp,self
export OMPI_MCA_plm_rsh_agent=false
export OMPI_MCA_plm_ssh_agent=false
export OMPI_MCA_mpi_yield_when_idle=true
export OMPI_MCA_rmaps_base_oversubscribe=true
export OMPI_MCA_rmaps_default_mapping_policy=:oversubscribe
export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
fi
export MPIEXEC_TIMEOUT=60
RUN() { echo + "$@"; "$@"; }
if test "$mpiname" = "mpich"; then
RUN command -v mpichversion
RUN mpichversion
fi
if test "$mpiname" = "mpich"; then
RUN command -v mpivars
RUN mpivars -nodesc | grep 'Category .* has'
fi
if test "$mpiname" = "openmpi"; then
RUN command -v ompi_info
RUN ompi_info
fi
RUN command -v mpicc
RUN mpicc -show
RUN mpicc helloworld.c -o helloworld-c
RUN command -v mpicxx
RUN mpicxx -show
RUN mpicxx helloworld.cxx -o helloworld-cxx
RUN command -v mpiexec
RUN mpiexec -n 3 ./helloworld-c
RUN mpiexec -n 3 ./helloworld-cxx