Skip to content

Commit

Permalink
Activated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Feb 27, 2024
1 parent 2bc3daa commit 3daf742
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
30 changes: 17 additions & 13 deletions test/PeriodicModels.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module PeriodicModelsTests

using Test
using Gridap, Gridap.Geometry, Gridap.Adaptivity, Gridap.ReferenceFEs
Expand Down Expand Up @@ -34,7 +35,7 @@ function same_model(m1::DiscreteModel{Dc},m2) where Dc
return A && B
end

function run(ranks,Dc,isperiodic)
function driver(ranks,Dc,isperiodic)
nc = (Dc==2) ? (3,3) : (3,3,3)
domain = (Dc==2) ? (0,3,0,3) : (0,3,0,3,0,3)
good_cmodel = CartesianDiscreteModel(domain,nc;isperiodic=isperiodic)
Expand All @@ -50,18 +51,21 @@ function run(ranks,Dc,isperiodic)
@test same_model(good_fmodel,fmodel)
end

ranks = with_mpi() do distribute
distribute(LinearIndices((1,)))
end
function run(distribute)
np = MPI.Comm_size(MPI.COMM_WORLD)
ranks = distribute(LinearIndices((np,)))

for isperiodic in [(true,true),(true,false),(false,true)]
run(ranks,2,isperiodic)
end
for isperiodic in [(true,true),(true,false),(false,true)]
driver(ranks,2,isperiodic)
end

for isperiodic in [
(true,true,true),
(false,true,true),(true,false,true),(true,true,false),
(false,false,true),(true,false,false),(false,true,false)
]
run(ranks,3,isperiodic)
for isperiodic in [
(true,true,true),
(false,true,true),(true,false,true),(true,true,false),
(false,false,true),(true,false,false),(false,true,false)
]
driver(ranks,3,isperiodic)
end
end

end # module
15 changes: 15 additions & 0 deletions test/mpi/PeriodicModels.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using MPI
using PartitionedArrays

include("../PeriodicModels.jl")
import .PeriodicModelsTests as TestModule

if !MPI.Initialized()
MPI.Init()
end

with_mpi() do distribute
TestModule.run(distribute)
end

MPI.Finalize()
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ function run_tests(testdir)
elseif f in ["PoissonNonConformingOctreeModelsTests.jl"]
np = [1,2,4]
extra_args = ""
elseif f in ["PeriodicModels.jl"]
np = [1]
extra_args = ""
else
np = [nprocs]
extra_args = ""
Expand Down

0 comments on commit 3daf742

Please sign in to comment.