1- from runtests .mpi import MPITest
21from nbodykit .lab import *
32from nbodykit import set_options
43from nbodykit import setup_logging
54from numpy .testing import assert_array_equal , assert_allclose
65import pytest
7-
6+ from mpi4py import MPI
87# debug logging
98setup_logging ("debug" )
109
11- @MPITest ([1 ])
10+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
11+ @pytest .mark .mpi
1212def test_tsc_interlacing (comm ):
1313
1414 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -22,7 +22,8 @@ def test_tsc_interlacing(comm):
2222 # skip a few large scale modes that are noisier (fewer modes)
2323 assert_allclose (r .power ['power' ][5 :], 1 / (3e-4 ), rtol = 1e-1 )
2424
25- @MPITest ([1 ])
25+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
26+ @pytest .mark .mpi
2627def test_paint_empty (comm ):
2728
2829 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -41,7 +42,8 @@ def test_paint_empty(comm):
4142 real = mesh .to_real_field (normalize = False )
4243 assert_allclose (real , 0.0 )
4344
44- @MPITest ([1 ])
45+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
46+ @pytest .mark .mpi
4547def test_paint_chunksize (comm ):
4648
4749 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -57,7 +59,8 @@ def test_paint_chunksize(comm):
5759
5860 assert_allclose (r1 , r2 )
5961
60- @MPITest ([1 , 4 ])
62+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
63+ @pytest .mark .mpi
6164def test_shotnoise (comm ):
6265
6366 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -78,7 +81,8 @@ def test_shotnoise(comm):
7881 assert_allclose (r1 .attrs ['shotnoise' ], SN , rtol = 1e-2 )
7982 assert_allclose (r2 .attrs ['shotnoise' ], SN , rtol = 1e-2 )
8083
81- @MPITest ([1 ])
84+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
85+ @pytest .mark .mpi
8286def test_cic_interlacing (comm ):
8387
8488 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -90,7 +94,8 @@ def test_cic_interlacing(comm):
9094 # if the compensation worked
9195 r = FFTPower (mesh , mode = '1d' , kmin = 0.02 )
9296
93- @MPITest ([1 ])
97+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
98+ @pytest .mark .mpi
9499def test_setters (comm ):
95100
96101 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -110,7 +115,8 @@ def test_setters(comm):
110115 mesh .window = 'tsc'
111116 assert mesh .window == 'tsc'
112117
113- @MPITest ([1 ])
118+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
119+ @pytest .mark .mpi
114120def test_bad_window (comm ):
115121
116122 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -122,7 +128,8 @@ def test_bad_window(comm):
122128 with pytest .raises (Exception ):
123129 mesh .window = "BAD"
124130
125- @MPITest ([1 ])
131+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
132+ @pytest .mark .mpi
126133def test_no_compensation (comm ):
127134
128135 source = UniformCatalog (nbar = 3e-4 , BoxSize = 512. , seed = 42 , comm = comm )
@@ -137,7 +144,8 @@ def test_no_compensation(comm):
137144 with pytest .raises (ValueError ):
138145 actions = mesh .actions
139146
140- @MPITest ([4 ])
147+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
148+ @pytest .mark .mpi
141149def test_odd_chunksize (comm ):
142150 # no errors shall occur. This is a regression test.
143151
@@ -147,11 +155,12 @@ def test_odd_chunksize(comm):
147155
148156 # make the mesh
149157 mesh = source .to_mesh (resampler = 'cic' , Nmesh = 64 , interlaced = True , compensated = True )
150-
158+
151159 with set_options (paint_chunk_size = 1111 ):
152160 mesh .compute ()
153161
154- @MPITest ([1 , 4 ])
162+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
163+ @pytest .mark .mpi
155164def test_view (comm ):
156165
157166 # the CatalogSource
@@ -172,7 +181,8 @@ def test_view(comm):
172181 for k in mesh .attrs :
173182 assert k in view .attrs
174183
175- @MPITest ([1 , 4 ])
184+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
185+ @pytest .mark .mpi
176186def test_apply_nocompensation (comm ):
177187
178188 # the CatalogSource
@@ -201,7 +211,8 @@ def raisefunc(k, v):
201211 for k in mesh .attrs :
202212 assert k in view .attrs
203213
204- @MPITest ([1 ])
214+ @pytest .mark .parametrize ("comm" , [MPI .COMM_WORLD ,])
215+ @pytest .mark .mpi
205216def test_apply_compensated (comm ):
206217
207218 # the CatalogSource
0 commit comments