@@ -199,12 +199,21 @@ def test_distributed_norm(par):
199199def  test_distributed_masked (par ):
200200    """Test Asarray with masked array""" 
201201    # Number of subcommunicators 
202-     if  MPI .COMM_WORLD .Get_size () %  2  ==  0 :
202+     size  =  MPI .COMM_WORLD .Get_size ()
203+     
204+     # Exclude not handled cases 
205+     shape_axis  =  par ['x' ].shape [par ['axis' ]]
206+     print ('shape_axis, size' , shape_axis , size , shape_axis  %  size  !=  0 )
207+     if  shape_axis  %  size  !=  0 :
208+         pytest .skip (f"Array dimension to distributed ({ shape_axis }  
209+                     f"divisible by the number of processes ({ size }  )
210+     if  size  %  2  ==  0 :
203211        nsub  =  2 
204-     elif  MPI . COMM_WORLD . Get_size ()  %  3  ==  0 :
212+     elif  size  %  3  ==  0 :
205213        nsub  =  3 
206214    else :
207-         pass 
215+         pytest .skip (f"Number of processes ({ size }  
216+                     "by 2 or 3..." )
208217    subsize  =  max (1 , MPI .COMM_WORLD .Get_size () //  nsub )
209218    mask  =  np .repeat (np .arange (nsub ), subsize )
210219
@@ -236,12 +245,21 @@ def test_distributed_masked(par):
236245def  test_distributed_maskeddot (par1 , par2 ):
237246    """Test Distributed Dot product with masked array""" 
238247    # Number of subcommunicators 
239-     if  MPI .COMM_WORLD .Get_size () %  2  ==  0 :
248+     size  =  MPI .COMM_WORLD .Get_size ()
249+     
250+     # Exclude not handled cases 
251+     shape_axis  =  par1 ['x' ].shape [par1 ['axis' ]]
252+     print ('shape_axis, size' , shape_axis , size , shape_axis  %  size  !=  0 )
253+     if  shape_axis  %  size  !=  0 :
254+         pytest .skip (f"Array dimension to distributed ({ shape_axis }  
255+                     f"divisible by the number of processes ({ size }  )
256+     if  size  %  2  ==  0 :
240257        nsub  =  2 
241-     elif  MPI . COMM_WORLD . Get_size ()  %  3  ==  0 :
258+     elif  size  %  3  ==  0 :
242259        nsub  =  3 
243260    else :
244-         pass 
261+         pytest .skip (f"Number of processes ({ size }  
262+                     "by 2 or 3..." )
245263    subsize  =  max (1 , MPI .COMM_WORLD .Get_size () //  nsub )
246264    mask  =  np .repeat (np .arange (nsub ), subsize )
247265
@@ -271,12 +289,21 @@ def test_distributed_maskeddot(par1, par2):
271289def  test_distributed_maskednorm (par ):
272290    """Test Distributed numpy.linalg.norm method with masked array""" 
273291    # Number of subcommunicators 
274-     if  MPI .COMM_WORLD .Get_size () %  2  ==  0 :
292+     size  =  MPI .COMM_WORLD .Get_size ()
293+ 
294+     # Exclude not handled cases 
295+     shape_axis  =  par ['x' ].shape [par ['axis' ]]
296+     print ('shape_axis, size' , shape_axis , size , shape_axis  %  size  !=  0 )
297+     if  shape_axis  %  size  !=  0 :
298+         pytest .skip (f"Array dimension to distributed ({ shape_axis }  
299+                     f"divisible by the number of processes ({ size }  )
300+     if  size  %  2  ==  0 :
275301        nsub  =  2 
276-     elif  MPI . COMM_WORLD . Get_size ()  %  3  ==  0 :
302+     elif  size  %  3  ==  0 :
277303        nsub  =  3 
278304    else :
279-         pass 
305+         pytest .skip (f"Number of processes ({ size }  
306+                     "by 2 or 3..." )
280307    subsize  =  max (1 , MPI .COMM_WORLD .Get_size () //  nsub )
281308    mask  =  np .repeat (np .arange (nsub ), subsize )
282309    # Replicate x as required in masked arrays 
0 commit comments