Skip to content

Commit 7295e9d

Browse files
committed
different MPI tests
1 parent 9b8a3ce commit 7295e9d

File tree

5 files changed

+349
-524
lines changed

5 files changed

+349
-524
lines changed

.github/workflows/pip-tests-mpi.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
. .po3/bin/activate
2-
cd examples/MPI_Tests
3-
mpirun -np 2 python mpi_initialization_test.py | tee test.txt
42

3+
# Simple test to check if MPI was linked at all
4+
mpirun -np 2 python examples/MPI_Tests/mpi_initialization_test.py | tee test.txt
55
calculated_sha1=$(sha1sum test.txt | awk '{ print $1 }')
6-
echo $calculated_sha1
7-
cat test.txt
6+
[ "$calculated_sha1" != "d94e03044bf06c7a42d07505b50fa58b4b30e49a" ] && exit 1
87

9-
[ "$calculated_sha1" == "d94e03044bf06c7a42d07505b50fa58b4b30e49a" ] && exit 0 || exit 1
8+
# Uniformly charged sphere
9+
mpirun -np 2 python examples/SpaceCharge/sc3D/sc_3d_drift_latt_uniform_sphere_bunch.py --SC ellipsoid| tee results.txt
10+
python examples/SpaceCharge/sc3D/read_sc_numbers.py
11+
[ $? != 0 ] && exit 1
12+
13+
mpirun -np 2 python examples/SpaceCharge/sc3D/sc_3d_drift_latt_uniform_sphere_bunch.py --SC fft3d| tee results.txt
14+
python examples/SpaceCharge/sc3D/read_sc_numbers.py
15+
[ $? != 0 ] && exit 1
16+
17+
# this should fail as no space charge will give incorrect sphere size
18+
mpirun -np 2 python examples/SpaceCharge/sc3D/sc_3d_drift_latt_uniform_sphere_bunch.py --SC none| tee results.txt
19+
python examples/SpaceCharge/sc3D/read_sc_numbers.py
20+
[ $? == 0 ] && exit 1
21+
22+
23+
# This tests that five nodes give the same result as one node
24+
mpirun -np 1 python examples/SpaceCharge/sc3D/sc_3d_drift_latt_uniform_sphere_bunch.py | tee results.txt
25+
calculated_sha1=$(sha1sum results.txt | awk '{ print $1 }')
26+
27+
mpirun -np 5 python examples/SpaceCharge/sc3D/sc_3d_drift_latt_uniform_sphere_bunch.py | tee results.txt
28+
calculated_sha5=$(sha1sum results.txt | awk '{ print $1 }')
29+
30+
[ "$calculated_sha1" != "$calculated_sha5" ] && exit 1
1031

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
with open('results.txt', 'r') as f:
3+
for line in f.readlines():
4+
if line.startswith('Final:'):
5+
sizes = line.split()[3:7]
6+
break
7+
print(sizes)
8+
for s in sizes:
9+
if abs(float(s) - 14.65) > 0.2:
10+
print(f'{s} out of range!')
11+
sys.exit(1)
12+
13+
print('Uniform Sphere check - OK')

examples/SpaceCharge/sc3D/sc_3D_fft_drift_latt_uniform_sphere_bunch.py

Lines changed: 0 additions & 264 deletions
This file was deleted.

0 commit comments

Comments
 (0)