Skip to content

Commit

Permalink
Simpler tmp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslb committed Nov 15, 2019
1 parent f68ea6b commit eedfb45
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions psiesta/psiesta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
import importlib
import tempfile
from shutil import copyfile
from .util import chdir
from mpi4py import MPI
Expand All @@ -20,12 +21,8 @@ def __init__(self):
"""
self.launched = False
original_path = Path(importlib.util.find_spec("psiesta._psiesta").origin)
self._tmpdir = Path() / ".__siestalibtmp"
if rank == 0:
self._tmpdir.mkdir(parents=True, exist_ok=True)
comm.Barrier()
self._name = hex(id(self)) # a kinda unique name (memory address)
# TODO: Ensure mpi nodes dont use same _name
self._tmpdir = Path(tempfile.mkdtemp(prefix="fsiesta_"))
self._name = hex(id(self))
self._tmplib = self._tmpdir / self._name
copyfile(original_path, self._tmplib)

Expand Down

0 comments on commit eedfb45

Please sign in to comment.