[cig-commits] [commit] knepley/fix-faults-parallel, master: Fixed bug so only proc 0 creates output dir. (5afa9d0)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Mon May 5 03:04:04 PDT 2014
Repository : ssh://geoshell/pylith
On branches: knepley/fix-faults-parallel,master
Link : https://github.com/geodynamics/pylith/compare/80029c389e447a372a70929ff189ad24b6fbf5b4...422d933ebf5e19a69537cf35cab1c4497c03fe90
>---------------------------------------------------------------
commit 5afa9d03ad6d9b7db5b385e483b905d84d8202d4
Author: Brad Aagaard <baagaard at usgs.gov>
Date: Wed Apr 9 16:12:27 2014 -0700
Fixed bug so only proc 0 creates output dir.
>---------------------------------------------------------------
5afa9d03ad6d9b7db5b385e483b905d84d8202d4
pylith/meshio/DataWriter.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pylith/meshio/DataWriter.py b/pylith/meshio/DataWriter.py
index b2e3e1d..1898930 100644
--- a/pylith/meshio/DataWriter.py
+++ b/pylith/meshio/DataWriter.py
@@ -55,10 +55,16 @@ class DataWriter(PetscComponent):
"""
Initialize writer.
"""
+
import os
relpath = os.path.dirname(filename)
+
if len(relpath) > 0 and not os.path.exists(relpath):
- os.makedirs(relpath)
+ # Only create directory on proc 0
+ from pylith.mpi.Communicator import mpi_comm_world
+ comm = mpi_comm_world()
+ if 0 == comm.rank:
+ os.makedirs(relpath)
return
More information about the CIG-COMMITS
mailing list