@@ -56,6 +56,7 @@ class Environment : public testing::Environment {
5656 Foam::IOobject::MUST_READ),
5757 false );
5858
59+ // FIXME this needs the device_id_handler
5960 exec = std::make_shared<ExecutorHandler>(runTime_->thisDb (), dict,
6061 " dummy" , true );
6162
@@ -172,6 +173,7 @@ TEST_P(DistMatL2D, canCreateDistributedMatrix)
172173{
173174 /* The test mesh is 6x6 grid decomposed into 4 3x3 subdomains */
174175 auto [ranks_per_gpu, matrix_format, fused] = GetParam ();
176+ exec.set_ranks_per_gpu (ranks_per_gpu);
175177
176178 auto mesh = ((Environment *)global_env)->mesh ;
177179 auto hostMatrix = ((Environment *)global_env)->hostMatrix ;
@@ -182,6 +184,7 @@ TEST_P(DistMatL2D, canCreateDistributedMatrix)
182184 gko::dim<2 > global_vec_dim{repartitioner->get_orig_partition ()->get_size (),
183185 1 };
184186 gko::dim<2 > local_vec_dim{repartitioner->get_repart_dim ()[0 ], 1 };
187+ exec.init_device_comm ();
185188
186189 auto distributed = create_distributed (exec, repartitioner, hostMatrix,
187190 matrix_format, fused, 0 );
@@ -200,6 +203,8 @@ TEST_P(DistMatL2D, hasCorrectLocalMatrix)
200203{
201204 /* The test mesh is 6x6 grid decomposed into 4 3x3 subdomains */
202205 auto [ranks_per_gpu, matrix_format, fused] = GetParam ();
206+ exec.set_ranks_per_gpu (ranks_per_gpu);
207+ exec.init_device_comm ();
203208 auto mesh = ((Environment *)global_env)->mesh ;
204209 auto hostMatrix = ((Environment *)global_env)->hostMatrix ;
205210 auto repartitioner = std::make_shared<Repartitioner>(
@@ -254,6 +259,8 @@ TEST_P(DistMatL2D, hasCorrectNonLocalMatrix)
254259{
255260 /* The test mesh is 6x6 grid decomposed into 4 3x3 subdomains */
256261 auto [ranks_per_gpu, matrix_format, fused] = GetParam ();
262+ exec.set_ranks_per_gpu (ranks_per_gpu);
263+ exec.init_device_comm ();
257264 auto mesh = ((Environment *)global_env)->mesh ;
258265 auto hostMatrix = ((Environment *)global_env)->hostMatrix ;
259266 auto name = ((Environment *)global_env)->name_ ;
@@ -292,6 +299,8 @@ TEST_P(DistMatL2D, hasCorrectNonLocalMatrix)
292299TEST_P (DistMatL2D, canApplyCorrectly)
293300{
294301 auto [ranks_per_gpu, format, fused] = GetParam ();
302+ exec.set_ranks_per_gpu (ranks_per_gpu);
303+ exec.init_device_comm ();
295304 auto mesh = ((Environment *)global_env)->mesh ;
296305 auto hostMatrix = ((Environment *)global_env)->hostMatrix ;
297306 auto name = ((Environment *)global_env)->name_ ;
@@ -314,12 +323,15 @@ TEST_P(DistMatL2D, canApplyCorrectly)
314323 x->fill (0 );
315324
316325 // Act
326+ bool active = repartitioner->get_repart_size () != 0 ;
327+ if (active){
317328 distributed->apply (b, x);
318329 auto res_x = std::vector<scalar>(
319330 x->get_local_vector ()->get_const_values (),
320331 x->get_local_vector ()->get_const_values () + local_vec_dim[0 ]);
321332
322333 ASSERT_EQ (res_x, exp_x[name][fused][ranks_per_gpu][rank]);
334+ }
323335}
324336
325337int main (int argc, char *argv[])
0 commit comments