-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pvthinker
committed
Mar 25, 2023
1 parent
7499a82
commit 1e78c5c
Showing
5 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Compile Fluid2d Fortran routines into Python modules | ||
using f2py | ||
March 2023: the compilation now by-pass 'make' and 'Makefile' | ||
""" | ||
import os | ||
import glob | ||
import subprocess | ||
|
||
FFLAGS = "-O3 -march=native -fPIC" | ||
|
||
srcs = ["core/fortran_advection.f90", | ||
"core/fortran_diag.f90", | ||
"core/fortran_fluxes.f90", | ||
"core/fortran_operators.f90", | ||
"core/gmg/fortran_multigrid.f90"] | ||
|
||
|
||
pwd = os.getcwd() | ||
null = subprocess.PIPE | ||
|
||
print("Compile Fortran routines to Python modules") | ||
|
||
for filename in srcs: | ||
|
||
src = os.path.basename(filename) | ||
direc = os.path.dirname(filename) | ||
lib = os.path.splitext(src)[0] | ||
|
||
localdir = f"{pwd}/{direc}" | ||
|
||
cmd = ["f2py", f'--opt={FFLAGS}', "-m", lib, "-c", src] | ||
|
||
print(" ".join(cmd)) | ||
|
||
os.chdir(localdir) | ||
subprocess.call(cmd, stdout=null, stderr=null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,8 @@ echo " Compile modules with f2py" | |
echo "" | ||
{ | ||
# try | ||
make | ||
#make | ||
python3 build.py | ||
|
||
} || { | ||
#catch | ||
|