Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 3b33680f authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Clean-up of compilation and loading of resulting module. The toolbox for that was refined.

parent 881174c8
......@@ -9,16 +9,20 @@ FFLAG = -fPIC
FPY = f2py
#PDBG = --debug
#
EXT_SUFFIX := $(shell python3-config --extension-suffix)
#
all : routing_interface.so diagst.so
routing_interface : routing_interface$(EXT_SUFFIX)
diagst : diagst$(EXT_SUFFIX)
clean :
rm -f compilation.log *.o *.so *.mod routing_interface.so diagst.so *~
routing_interface.so : $(obj) routing_interface.f90
routing_interface$(EXT_SUFFIX) : $(obj) routing_interface.f90
rm -f compilation.log
$(FPY) -c routing_interface.f90 $(PDBG) --fcompiler=gfortran -m routing_interface $(obj) > compilation.log
diagst.so : diagst.f90
diagst$(EXT_SUFFIX) : diagst.f90
$(FPY) -c diagst.f90 $(PDBG) --fcompiler=gfortran -m diagst > compilation.log
defprec.o : defprec.f90
......
......@@ -12,32 +12,25 @@ def localdir(follow_symlinks=True):
path = os.path.realpath(path)
return os.path.dirname(path)
def adddirtopath(dir) :
sys.path.append(localdir()+'/'+dir)
def adddirtopath(sdir) :
if not sdir in sys.path :
sys.path.append(localdir()+'/'+sdir)
return
def compilef90(mod) :
def compilef90(mod, mpi=None) :
adddirtopath(localdir()+"/F90subroutines")
try :
MPI
except :
err=os.system("cd "+localdir()+"/F90subroutines ; make all")
if not "mpi4py" in sys.modules :
err=os.system("cd "+localdir()+"/F90subroutines ; make "+mod)
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
else :
if MPI == sys.modules['mpi4py'].MPI :
if MPI.COMM_WORLD.Get_rank() == 0 :
err=os.system("cd "+localdir()+"/F90subroutines ; make all")
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
else :
print("Not compiling on other cores")
MPI.COMM_WORLD.Barrier()
else :
print("MPI exists but is not from mpi4py module")
mpimod=sys.modules["mpi4py"].MPI
if mpimod.COMM_WORLD.Get_rank() == 0 :
err=os.system("cd "+localdir()+"/F90subroutines ; make "+mod)
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
mpimod.COMM_WORLD.Barrier()
return
#
import os
import sys
from inspect import currentframe, getframeinfo
localdir=os.path.dirname(getframeinfo(currentframe()).filename)
sys.path.append(localdir+'/F90subroutines')
#
import numpy as np
from netCDF4 import Dataset
import datetime
......@@ -20,6 +15,10 @@ log_master, log_world = getargs.getLogger(__name__)
INFO, DEBUG, ERROR = log_master.info, log_master.debug, log_world.error
INFO_ALL, DEBUG_ALL = log_world.info, log_world.debug
#
import F90tools as F90T
#
F90T.adddirtopath("F90subroutines")
F90T.compilef90("routing_interface")
import routing_interface
import NcHelp as NH
import RPPtools as RPP
......
......@@ -8,20 +8,11 @@ from mpi4py import MPI
import gc
#
import sys
from inspect import currentframe, getframeinfo
#
localdir=os.path.dirname(getframeinfo(currentframe()).filename)
sys.path.append(localdir+'/F90subroutines')
F90=localdir+'/F90subroutines'
if MPI.COMM_WORLD.Get_rank() == 0 :
err=os.system("cd "+F90+"; make all")
if err != 0 :
print("Compilation error in the FORTRAN interface")
sys.exit()
else :
print("Not compiling on other cores")
MPI.COMM_WORLD.Barrier()
import F90tools as F90T
#
F90T.adddirtopath("F90subroutines")
F90T.compilef90("routing_interface")
import routing_interface
import NcHelp as NH
#
......
......@@ -11,19 +11,20 @@ import numpy as np
import numpy.ma as ma
import time
import sys
import os
from inspect import currentframe, getframeinfo
localdir=os.path.dirname(getframeinfo(currentframe()).filename)
sys.path.append(localdir+'/F90subroutines')
import routing_interface
#
import getargs
config = getargs.SetupConfig()
frac_lim=config.getfloat("OverAll", "frac_lim", fallback=0.3)
limit_step5=config.getfloat("OverAll","limit_step5",fallback=5)
log_master, log_world = getargs.getLogger(__name__)
INFO, DEBUG, ERROR = log_master.info, log_master.debug, log_world.error
#
import F90tools as F90T
#
F90T.adddirtopath("F90subroutines")
F90T.compilef90("routing_interface")
import routing_interface
#
######################
class trunc:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment