Skip to content

Commit

Permalink
fix(gsflow): remove gsflow as a possible target (#176)
Browse files Browse the repository at this point in the history
gsflow (and prms) cause continual problems trying to include them as
prebuilt executables. New versions require additional work to filter out
extraneous source files and object files. The build process uses specific
compiler flags. In short, supporting gsflow (and prms) requires more
support each time we are ready to make a executables release or when
a new version is released.

* merge with failure - in process of resolving
  • Loading branch information
jdhughes-usgs committed Jun 9, 2024
1 parent 4460311 commit 3948fab
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 313 deletions.
76 changes: 23 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,8 @@ The help message identifies required positional arguments and optional arguments
default values.

```
usage: mfpymake [-h] [-fc {ifort,mpiifort,gfortran,none}]
[-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}]
[-ar {ia32,ia32_intel64,intel64}] [-mc] [-dbl] [-dbg] [-e]
[-dr] [-sd] [-ff FFLAGS] [-cf CFLAGS] [-sl {-lc,-lm}] [-mf]
[-md] [-cs COMMONSRC] [-ef EXTRAFILES] [-exf EXCLUDEFILES]
[-so] [-ad APPDIR] [-v] [--keep] [--zip ZIP] [--inplace]
[--networkx] [--meson] [--mesondir]
usage: mfpymake [-h] [-fc {ifort,mpiifort,gfortran,none}] [-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}] [-ar {ia32,ia32_intel64,intel64}] [-mc] [-dbl] [-dbg] [-e] [-dr] [-sd] [-ff FFLAGS]
[-cf CFLAGS] [-sl {-lc,-lm}] [-mf] [-md] [-cs COMMONSRC] [-ef EXTRAFILES] [-exf EXCLUDEFILES] [-so] [-ad APPDIR] [-v] [--keep] [--zip ZIP] [--inplace] [--networkx] [--meson] [--mesondir]
srcdir target
This is the pymake program for compiling fortran, c, and c++ source
Expand All @@ -73,70 +68,45 @@ positional arguments:
srcdir Path source directory.
target Name of target to create. (can include path)
optional arguments:
options:
-h, --help show this help message and exit
-fc {ifort,mpiifort,gfortran,none}
Fortran compiler to use. (default is gfortran)
-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}
C/C++ compiler to use. (default is gcc)
-ar {ia32,ia32_intel64,intel64}, --arch {ia32,ia32_intel64,intel64}
Architecture to use for Intel and Microsoft compilers
on Windows. (default is intel64)
-mc, --makeclean Clean temporary object, module, and source files when
done. (default is False)
Architecture to use for Intel and Microsoft compilers on Windows. (default is intel64)
-mc, --makeclean Clean temporary object, module, and source files when done. (default is False)
-dbl, --double Force double precision. (default is False)
-dbg, --debug Create debug version. (default is False)
-e, --expedite Only compile out of date source files. Clean must not
have been used on previous build. (default is False)
-dr, --dryrun Do not actually compile. Files will be deleted, if
--makeclean is used. Does not work yet for ifort.
(default is False)
-sd, --subdirs Include source files in srcdir subdirectories.
(default is None)
-e, --expedite Only compile out of date source files. Clean must not have been used on previous build. (default is False)
-dr, --dryrun Do not actually compile. Files will be deleted, if --makeclean is used. Does not work yet for ifort. (default is False)
-sd, --subdirs Include source files in srcdir subdirectories. (default is None)
-ff FFLAGS, --fflags FFLAGS
Additional Fortran compiler flags. Fortran compiler
flags should be enclosed in quotes and start with a
blank space or separated from the name (-ff or
--fflags) with a equal sign (-ff='-O3'). (default is
None)
Additional Fortran compiler flags. Fortran compiler flags should be enclosed in quotes and start with a blank space or separated from the name (-ff or --fflags) with a equal sign
(-ff='-O3'). (default is None)
-cf CFLAGS, --cflags CFLAGS
Additional C/C++ compiler flags. C/C++ compiler flags
should be enclosed in quotes and start with a blank
space or separated from the name (-cf or --cflags)
with a equal sign (-cf='-O3'). (default is None)
Additional C/C++ compiler flags. C/C++ compiler flags should be enclosed in quotes and start with a blank space or separated from the name (-cf or --cflags) with a equal sign
(-cf='-O3'). (default is None)
-sl {-lc,-lm}, --syslibs {-lc,-lm}
Linker system libraries. Linker libraries should be
enclosed in quotes and start with a blank space or
separated from the name (-sl or --syslibs) with a
equal sign (-sl='-libgcc'). (default is None)
Linker system libraries. Linker libraries should be enclosed in quotes and start with a blank space or separated from the name (-sl or --syslibs) with a equal sign (-sl='-libgcc').
(default is None)
-mf, --makefile Create a GNU make makefile. (default is False)
-md, --makefiledir GNU make makefile directory. (default is '.')
-cs COMMONSRC, --commonsrc COMMONSRC
Additional directory with common source files.
(default is None)
Additional directory with common source files. (default is None)
-ef EXTRAFILES, --extrafiles EXTRAFILES
List of extra source files to include in the
compilation. extrafiles can be either a list of files
or the name of a text file that contains a list of
files. (default is None)
List of extra source files to include in the compilation. extrafiles can be either a list of files or the name of a text file that contains a list of files. (default is None)
-exf EXCLUDEFILES, --excludefiles EXCLUDEFILES
List of extra source files to exclude from the
compilation. excludefiles can be either a list of
files or the name of a text file that contains a list
of files. (default is None)
-so, --sharedobject Create shared object or dll on Windows. (default is
False)
List of extra source files to exclude from the compilation. excludefiles can be either a list of files or the name of a text file that contains a list of files. (default is None)
-so, --sharedobject Create shared object or dll on Windows. (default is False)
-ad APPDIR, --appdir APPDIR
Target path that overides path defined target path
(default is None)
Target path that overides path defined target path (default is None)
-v, --verbose Verbose output to terminal. (default is False)
--keep Keep existing executable. (default is False)
--zip ZIP Zip built executable. (default is False)
--inplace Source files in srcdir are used directly. (default is
False)
--networkx Use networkx package to build Directed Acyclic Graph
use to determine the order source files are compiled
in. (default is False)
--zip ZIP Zip built executable. (default is None)
--inplace Source files in srcdir are used directly. (default is False)
--networkx Use networkx package to build Directed Acyclic Graph use to determine the order source files are compiled in. (default is False)
--meson Use meson to build executable. (default is False)
--mesondir meson directory. (default is '.')
Expand Down Expand Up @@ -203,7 +173,7 @@ python mymf6script.py -fc ifort -cc icc

When pymake is installed, a `make-program` (or `make-program.exe` for Windows) program is installed. `make-program` can
be used to build MODFLOW 6, MODFLOW-2005, MODFLOW-NWT, MODFLOW-USG, MODFLOW-LGR, MODFLOW-2000, MODPATH 6, MODPATH 7,
GSFLOW, VS2DT, MT3DMS, MT3D-USGS, SEAWAT, GSFLOW, PRMS, and SUTRA. Utility programs CRT, Triangle, and GRIDGEN can also
GSFLOW, VS2DT, MT3DMS, MT3D-USGS, SEAWAT, and SUTRA. Utility programs CRT, Triangle, and GRIDGEN can also
be built. `make-program` downloads the distribution file (requires an internet connection), unzips the file, sets the
pymake settings required to build the program, and compiles the program from the source files. Optional pymake command
line arguments can be used to customize the build (`-fc`, `-cc`, `--fflags`, etc.). For example, MODFLOW 6 could be
Expand Down
83 changes: 0 additions & 83 deletions autotest/test_gsflow.py

This file was deleted.

35 changes: 9 additions & 26 deletions docs/build_apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,14 @@ and options can be determined by executing:
```console
$ make-program --help

usage: make-program [-h] [-fc {ifort,mpiifort,gfortran,none}]
[-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}]
[-dbl] [-dr] [-ff FFLAGS] [-cf CFLAGS] [-ad APPDIR] [-v]
[--keep] [--zip ZIP] [--meson]
usage: make-program [-h] [-fc {ifort,mpiifort,gfortran,none}] [-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}] [-dbl] [-dr] [-ff FFLAGS] [-cf CFLAGS] [-ad APPDIR] [-v] [--keep] [--zip ZIP] [--meson]
targets

Download and build USGS MODFLOW and related programs.

positional arguments:
targets Program(s) to build. Options: crt, gridgen, gsflow,
libmf6, mf2000, mf2005, mf6, mflgr, mfnwt, mfusg,
mfusg_gsi, mp6, mp7, mt3dms, mt3dusgs, sutra, swtv4,
triangle, vs2dt, zbud6, zonbud3, zonbudusg, :.
Specifying the target to be ':' will build all of the
programs. Multiple targets can be specified by
separating individual targets by a comma (i.e.,
mf6,zbud6).
targets Program(s) to build. Options: crt, gridgen, libmf6, mf2000, mf2005, mf6, mflgr, mfnwt, mfusg, mfusg_gsi, mp6, mp7, mt3dms, mt3dusgs, sutra, swtv4, triangle, vs2dt, zbud6, zonbud3,
zonbudusg, :. Specifying the target to be ':' will build all of the programs. Multiple targets can be specified by separating individual targets by a comma (i.e., mf6,zbud6).

options:
-h, --help show this help message and exit
Expand All @@ -32,23 +23,15 @@ options:
-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}
C/C++ compiler to use. (default is gcc)
-dbl, --double Force double precision. (default is False)
-dr, --dryrun Do not actually compile. Files will be deleted, if
--makeclean is used. Does not work yet for ifort.
(default is False)
-dr, --dryrun Do not actually compile. Files will be deleted, if --makeclean is used. Does not work yet for ifort. (default is False)
-ff FFLAGS, --fflags FFLAGS
Additional Fortran compiler flags. Fortran compiler
flags should be enclosed in quotes and start with a
blank space or separated from the name (-ff or
--fflags) with a equal sign (-ff='-O3'). (default is
None)
Additional Fortran compiler flags. Fortran compiler flags should be enclosed in quotes and start with a blank space or separated from the name (-ff or --fflags) with a equal sign
(-ff='-O3'). (default is None)
-cf CFLAGS, --cflags CFLAGS
Additional C/C++ compiler flags. C/C++ compiler flags
should be enclosed in quotes and start with a blank
space or separated from the name (-cf or --cflags)
with a equal sign (-cf='-O3'). (default is None)
Additional C/C++ compiler flags. C/C++ compiler flags should be enclosed in quotes and start with a blank space or separated from the name (-cf or --cflags) with a equal sign
(-cf='-O3'). (default is None)
-ad APPDIR, --appdir APPDIR
Target path that overides path defined target path
(default is None)
Target path that overides path defined target path (default is None)
-v, --verbose Verbose output to terminal. (default is False)
--keep Keep existing executable. (default is False)
--zip ZIP Zip built executable. (default is None)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ programs released by the USGS.

pymake includes example scripts for building MODFLOW 6, MODFLOW-2005,
MODFLOW-NWT, MODFLOW-USG, MODFLOW-LGR, MODFLOW-2000, MODPATH 6, MODPATH 7,
GSFLOW, VS2DT, MT3DMS, MT3D-USGS, SEAWAT, and SUTRA. Example scripts for
VS2DT, MT3DMS, MT3D-USGS, SEAWAT, and SUTRA. Example scripts for
creating the utility programs CRT, Triangle, and GRIDGEN are also included.
The scripts download the distribution file from the USGS (and other
organizations) and compile the source into a binary executable.
Expand Down
2 changes: 0 additions & 2 deletions pymake/pymake.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,6 @@ def _set_include_subdirs(self):
"libmf6",
"gridgen",
"mf6beta",
"gsflow",
"prms",
):
self.include_subdirs = True
else:
Expand Down
5 changes: 0 additions & 5 deletions pymake/pymake_build_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,6 @@ def build_apps(
download_verify = True
timeout = 30

# reset meson
if target in ("prms",):
pmobj.meson = True
pmobj.inplace = True

# set target and srcdir
pmobj.target = target.replace("dev", "")
pmobj.srcdir = os.path.join(
Expand Down
34 changes: 0 additions & 34 deletions pymake/utils/_compiler_switches.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,25 +781,6 @@ def _set_fflags(target, fc="gfortran", argv=True, osname=None, verbose=False):
if target == "mp7":
if fc == "gfortran":
fflags.append("-ffree-line-length-512")
elif target in ("gsflow", "prms"):
if fc == "ifort":
if osname == "win32":
fflags += [
"-fp:source",
"-names:lowercase",
"-assume:underscore",
]
else:
pass
elif fc == "gfortran":
fflags += ["-O1", "-fno-second-underscore"]
opt = "-fallow-argument-mismatch"
if _check_gnu_switch_available(
opt, compiler=fc, verbose=verbose
):
fflags += [
opt,
]
elif target in (
"mf2000",
"mt3dms",
Expand Down Expand Up @@ -899,17 +880,6 @@ def _set_cflags(target, cc="gcc", argv=True, osname=None, verbose=False):
cflags += ["-lm"]
else:
cflags += ["-DNO_TIMER"]
elif target in (
"gsflow",
"prms",
):
if cc in ["icc", "icpl", "icl"]:
if osname == "win32":
cflags += ["-D_CRT_SECURE_NO_WARNINGS"]
else:
cflags += ["-D_UF"]
elif cc == "gcc":
cflags += ["-O1"]

# add additional cflags from the command line
if argv:
Expand Down Expand Up @@ -1013,10 +983,6 @@ def _set_syslibs(
lcc = True
if lfc and lcc:
syslibs += ["-lm"]
elif target in ("gsflow", "prms"):
if "win32" not in osname:
if "ifort" in fc:
syslibs += ["-nofor_main"]

# add additional syslibs from the command line
if argv:
Expand Down
Loading

0 comments on commit 3948fab

Please sign in to comment.