From 297274439be36828212cf00a28fd87f4df0b6b85 Mon Sep 17 00:00:00 2001 From: Adiv Paradise Date: Sun, 9 Jun 2024 21:32:49 -0400 Subject: [PATCH] Running compile_pyfft or sysconfigure before compiling the model for the first time will now ensure they won't be automatically re-run, and they will call each other the very first time one of them is run --- exoplasim/__init__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/exoplasim/__init__.py b/exoplasim/__init__.py index e4fc931..80bbff5 100755 --- a/exoplasim/__init__.py +++ b/exoplasim/__init__.py @@ -70,6 +70,14 @@ def compile_pyfft(): try: cwd = os.getcwd() os.chdir(sourcedir) + + if not os.path.isfile(sourcedir+"/most_compiler")\ + or not os.path.isfile(sourcedir+"/most_compiler_mpi")\ + or not os.path.isfile(sourcedir+"/firstrun"): + os.system(f"touch {sourcedir}/firstrun") + sysconfigure() + + import numpy.f2py with open("pyfft.f90","r") as pyfft_file: pyfft_source = pyfft_file.read() @@ -99,6 +107,7 @@ def compile_pyfft(): #os.system("cd postprocessor && rm burn7.x && make") #os.chdir(cwd) #os.system("touch %s/postprocessor/netcdfbuilt"%sourcedir) + os.chdir(cwd) except PermissionError: raise PermissionError("\nHi! Welcome to ExoPlaSim. It looks like this is the first "+ @@ -150,6 +159,10 @@ def sysconfigure(): os.system("./configure.sh -v 3") result="" + if not os.path.isfile(sourcedir+"/firstrun") : + os.system(f"touch {sourcedir}/firstrun") + compile_pyfft() + #import numpy.f2py #with open("pyfft.f90","r") as pyfft_file: #pyfft_source = pyfft_file.read() @@ -440,7 +453,7 @@ class Model(object): #"very bad idea to install things with sudo pip install.") sysconfigure() - compile_pyfft() + #compile_pyfft() #This will be called from sysconfigure() os.system(f"touch {sourcedir}/firstrun") #if self.burn7: