Coverage for /usr/share/miniconda3/envs/dolfin/lib/python3.8/site-packages/block/helpers.py: 88%

11 statements  

« prev     ^ index     » next       coverage.py v7.2.1, created at 2023-03-20 13:03 +0000

1from dolfin import MPI 

2 

3class MpiNotSupported(Exception): 

4 pass 

5 

6def supports_mpi(yesno, msg=None, size=MPI.size(MPI.comm_world)): 

7 if not yesno and size > 1: 

8 import os, sys 

9 if os.environ.get('BLOCK_REGRESSION_MPIRUN'): 9 ↛ 14line 9 didn't jump to line 14, because the condition on line 9 was never false

10 if MPI.comm_world.rank == 0: 

11 print(f'skip {sys.argv[0]}: {msg or "MPI not supported"}', file=sys.stderr) 

12 sys.exit(0) 

13 else: 

14 raise MpiNotSupported(msg)