Skip to content

Commit 5bc0297

Browse files
Merge pull request #266 from BconstantMMK/dev
Converter: fix deadlock when reading from file in parallel
2 parents 6d95b6d + dee7327 commit 5bc0297

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Cassiopee/Converter/Converter/Mpi4py.py

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
from mpi4py import MPI
2727
import numpy
28+
import os
2829

2930
COMM_WORLD = MPI.COMM_WORLD
3031
KCOMM = COMM_WORLD
@@ -441,6 +442,9 @@ def gatherZones(zones, root=0):
441442
def convertFile2SkeletonTree(fileName, format=None, maxFloatSize=5,
442443
maxDepth=-1, links=None):
443444
"""Read a file and return a skeleton tree."""
445+
exists = os.path.exists(fileName)
446+
if not exists: raise IOError("convertFile2SkeletonTree: file %s not found."%fileName)
447+
444448
if rank == 0: t = Distributed.convertFile2SkeletonTree(fileName, format, maxFloatSize, maxDepth, None, links)
445449
else: t = None
446450
t = KCOMM.bcast(t)
@@ -456,6 +460,9 @@ def convertFile2SkeletonTree(fileName, format=None, maxFloatSize=5,
456460
#==============================================================================
457461
def convertFile2PyTree(fileName, format=None, proc=None):
458462
"""Read a file and return a full tree or partial tree."""
463+
exists = os.path.exists(fileName)
464+
if not exists: raise IOError("convertFile2PyTree: file %s not found."%fileName)
465+
459466
if proc is None: # load full tree on all procs
460467
if rank == 0: t = C.convertFile2PyTree(fileName, format)
461468
else: t = None

0 commit comments

Comments
 (0)