Skip to content

Commit

Permalink
fix(gsflow): remove gsflow as a possible target
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.
  • Loading branch information
jdhughes-usgs committed Jun 9, 2024
1 parent 4460311 commit 1a289ff
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 260 deletions.
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
108 changes: 0 additions & 108 deletions pymake/utils/_usgs_src_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,114 +468,6 @@ def _update_mfnwt_files(srcdir, fc, cc, arch, double):
_update_swi(srcdir, double)


def _update_prms_files(srcdir, fc, cc, arch, double):
"""Update PRMS source files
Parameters
----------
srcdir : str
path to directory with source files
fc : str
fortran compiler
cc : str
c/c++ compiler
arch : str
architecture
double : bool
boolean indicating if compiler switches are used to build a
double precision target
Returns
-------
"""
# remove existing *.mod, *.o, and *.a (if any are left) files
dpths = [
os.path.join(srcdir, o)
for o in os.listdir(srcdir)
if os.path.isdir(os.path.join(srcdir, o))
]

for dpth in dpths:
for f in os.listdir(dpth):
ext = os.path.splitext(f)[1]
fpth = os.path.join(dpth, f)
if ext in [".mod", ".o", ".a"]:
os.remove(fpth)

# remove specific files
fpths = (
os.path.join(srcdir, "prms", "gsflow_module.f90"),
os.path.join(srcdir, "prms", "gsflow_prms.f90"),
)
for fpth in fpths:
if os.path.isfile(fpth):
os.remove(fpth)

return


def _update_gsflow_files(srcdir, fc, cc, arch, double):
"""Update GSFLOW source files
Parameters
----------
srcdir : str
path to directory with source files
fc : str
fortran compiler
cc : str
c/c++ compiler
arch : str
architecture
double : bool
boolean indicating if compiler switches are used to build a
double precision target
Returns
-------
"""
# update utl7.f
_update_utl7(srcdir)

# update gwf2swt7.f
_update_swt(srcdir)

# update gwf2swi27.f or gwf2swi27.fpp
_update_swi(srcdir, double)

# remove merge and lib directories
pths = [os.path.join(srcdir, "merge"), os.path.join(srcdir, "lib")]
for pth in pths:
if os.path.isdir(pth):
shutil.rmtree(pth)

# remove existing *.mod, *.o, and *.a (if any are left) files
dpths = [
os.path.join(srcdir, o)
for o in os.listdir(srcdir)
if os.path.isdir(os.path.join(srcdir, o))
]

for dpth in dpths:
for f in os.listdir(dpth):
ext = os.path.splitext(f)[1]
fpth = os.path.join(dpth, f)
if ext in [".mod", ".o", ".a"]:
os.remove(fpth)

# remove specific files
fpths = [
os.path.join(srcdir, "modflow", "gwf2ag1_NWT_rsr.f"),
]
for fpth in fpths:
if os.path.isfile(fpth):
os.remove(fpth)

return


def _update_mf2000_files(srcdir, fc, cc, arch, double):
"""Update MODFLOW-2000 source files
Expand Down
1 change: 0 additions & 1 deletion pymake/utils/usgsprograms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ zonbud3 , 3.01 , True , https://water.usgs.gov/water-resources/software
mfnwt1.1.4 , 1.1.4 , False , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip , MODFLOW-NWT_1.1.4 , src , True , False , False
mfnwt , 1.3.0 , True , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.3.0.zip , MODFLOW-NWT , src , True , False , False
mfusg_gsi , 2.2.2 , True , https://www.gsienv.com/wp-content/uploads/2023/11/USG-Transport_Version-2.2.2.zip , USGT-v2-2-2-Source , . , True , False , False
gsflow , 2.2.1 , True , https://water.usgs.gov/water-resources/software/gsflow/gsflow_2.2.1_linux.zip , gsflow_2.2.1 , src , True , False , False
mf6dev , 6.6.0.dev0 , False , https://github.com/MODFLOW-USGS/modflow6/archive/refs/heads/develop.zip , modflow6-develop , src , True , False , False
zbud6dev , 6.6.0.dev0 , False , https://github.com/MODFLOW-USGS/modflow6/archive/refs/heads/develop.zip , modflow6-develop , utils/zonebudget/src, True , False , False
libmf6dev , 6.6.0.dev0 , False , https://github.com/MODFLOW-USGS/modflow6/archive/refs/heads/develop.zip , modflow6-develop , srcbmi , True , False , True

0 comments on commit 1a289ff

Please sign in to comment.