Skip to content

Commit d264df1

Browse files
committed
Add sequential distributed test
1 parent 7b11f8a commit d264df1

File tree

4 files changed

+82
-62
lines changed

4 files changed

+82
-62
lines changed

test/dev/distributed_aggregation.jl

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ using MPI
1515
using Test
1616
using BenchmarkTools
1717

18-
if ! MPI.Initialized()
19-
MPI.Init()
20-
end
21-
2218
function asymmetric_kettlebell(ranks, parts, nc, ng)
2319
L = 1
2420
p0 = Point(0.0,0.0)
@@ -259,11 +255,11 @@ function run_benchmark_test(distribute,
259255

260256
end
261257

262-
function run_new_distributed_agfem(distribute,
263-
parts,
264-
ncells_x_dir,
265-
nghost_layers,
266-
problem)
258+
function run_distributed_agfem(distribute,
259+
parts,
260+
ncells_x_dir,
261+
nghost_layers,
262+
problem)
267263

268264
ranks = distribute(LinearIndices((prod(parts),)))
269265
bgmodel, geo = problem(ranks, parts, ncells_x_dir, nghost_layers)
@@ -368,52 +364,4 @@ function run_new_distributed_agfem(distribute,
368364

369365
end
370366

371-
problem = symmetric_kettlebell
372-
373-
if MPI.Comm_size(MPI.COMM_WORLD) == 3
374-
with_mpi() do distribute
375-
run_benchmark_test(distribute,(3,1),9,2,problem)
376-
for ncells_x_dir in (9,18,36,72), nghost_layers in (2,3,4)
377-
run_benchmark_test(distribute,
378-
(3,1),
379-
ncells_x_dir,
380-
nghost_layers,
381-
problem)
382-
end
383-
end
384-
elseif MPI.Comm_size(MPI.COMM_WORLD) == 4
385-
with_mpi() do distribute
386-
run_benchmark_test(distribute,(2,2),8,2,problem)
387-
for ncells_x_dir in (8,16,32,64), nghost_layers in (2,3,4)
388-
run_benchmark_test(distribute,
389-
(2,2),
390-
ncells_x_dir,
391-
nghost_layers,
392-
problem)
393-
end
394-
end
395-
elseif MPI.Comm_size(MPI.COMM_WORLD) == 8
396-
with_mpi() do distribute
397-
run_benchmark_test(distribute,(4,2),8,2,problem)
398-
for ncells_x_dir in (16,32,64,128), nghost_layers in (2,3,4,5)
399-
run_benchmark_test(distribute,
400-
(4,2),
401-
ncells_x_dir,
402-
nghost_layers,
403-
problem)
404-
end
405-
end
406-
elseif MPI.Comm_size(MPI.COMM_WORLD) == 12
407-
with_mpi() do distribute
408-
run_benchmark_test(distribute,(4,3),12,2,problem)
409-
for ncells_x_dir in (24,48,96,192), nghost_layers in (2,3,4,5)
410-
run_benchmark_test(distribute,
411-
(4,3),
412-
ncells_x_dir,
413-
nghost_layers,
414-
problem)
415-
end
416-
end
417-
end
418-
419367
end

test/dev/runtests.jl renamed to test/dev/mpi/runtests.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using Test
44
using MPI
55

66
mpidir = @__DIR__
7-
testdir = mpidir
7+
testdir = joinpath(mpidir,"..")
88
repodir = joinpath(testdir,"..","..")
99

1010
function run_test(procs,file)
@@ -13,9 +13,9 @@ function run_test(procs,file)
1313
end
1414
end
1515

16-
run_test( 3,"distributed_aggregation.jl")
17-
run_test( 4,"distributed_aggregation.jl")
18-
run_test( 8,"distributed_aggregation.jl")
19-
run_test(12,"distributed_aggregation.jl")
16+
run_test( 3,"runtests_body.jl")
17+
# run_test( 4,"runtests_body.jl")
18+
# run_test( 8,"runtests_body.jl")
19+
# run_test(12,"runtests_body.jl")
2020

2121
end # module

test/dev/mpi/runtests_body.jl

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
module DistributedAggregationMPI
2+
3+
using PartitionedArrays
4+
const PArrays = PartitionedArrays
5+
using MPI
6+
7+
include("../distributed_aggregation.jl")
8+
9+
const DA = DistributedAggregation
10+
11+
if ! MPI.Initialized()
12+
MPI.Init()
13+
end
14+
15+
problem = DA.symmetric_kettlebell
16+
17+
if MPI.Comm_size(MPI.COMM_WORLD) == 3
18+
with_mpi() do distribute
19+
DA.run_benchmark_test(distribute,(3,1),9,2,problem)
20+
for ncells_x_dir in (9,18,36,72), nghost_layers in (2,3,4)
21+
DA.run_benchmark_test(distribute,
22+
(3,1),
23+
ncells_x_dir,
24+
nghost_layers,
25+
problem)
26+
end
27+
end
28+
elseif MPI.Comm_size(MPI.COMM_WORLD) == 4
29+
with_mpi() do distribute
30+
DA.run_benchmark_test(distribute,(2,2),8,2,problem)
31+
for ncells_x_dir in (8,16,32,64), nghost_layers in (2,3,4)
32+
DA.run_benchmark_test(distribute,
33+
(2,2),
34+
ncells_x_dir,
35+
nghost_layers,
36+
problem)
37+
end
38+
end
39+
elseif MPI.Comm_size(MPI.COMM_WORLD) == 8
40+
with_mpi() do distribute
41+
DA.run_benchmark_test(distribute,(4,2),8,2,problem)
42+
for ncells_x_dir in (16,32,64,128), nghost_layers in (2,3,4,5)
43+
DA.run_benchmark_test(distribute,
44+
(4,2),
45+
ncells_x_dir,
46+
nghost_layers,
47+
problem)
48+
end
49+
end
50+
elseif MPI.Comm_size(MPI.COMM_WORLD) == 12
51+
with_mpi() do distribute
52+
DA.run_benchmark_test(distribute,(4,3),12,2,problem)
53+
for ncells_x_dir in (24,48,96,192), nghost_layers in (2,3,4,5)
54+
DA.run_benchmark_test(distribute,
55+
(4,3),
56+
ncells_x_dir,
57+
nghost_layers,
58+
problem)
59+
end
60+
end
61+
end
62+
63+
end # module

test/dev/sequential/runtests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module DistributedAggregationSeqTests
2+
using PartitionedArrays
3+
include("../distributed_aggregation.jl")
4+
const DA = DistributedAggregation
5+
problem = DA.symmetric_kettlebell
6+
with_debug() do distribute
7+
DA.run_distributed_agfem(distribute,(3,1),9,2,problem)
8+
end
9+
end # module

0 commit comments

Comments
 (0)