-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VCMML-487] Use setup.py with pkg-config (#117)
The build system of the python and fortran models are somewhat coupled. This PR addresses a few sources of this coupling - Remove the hardcoded names in the `setup.py` leveraging the `pkg-config` tool and #54 - `lib/Makefile` no longer depends on any makefiles or source code in `lib/external`. It uses pkg-config as well. Some other changes: - Remove `build_docker.sh` script in lieu of a makefile target. - Streamline the Dockerfile by basing the final wrapper image of the fv3gfs-wrapper-build image. This was needed for the build to pass, and reduces the redundant configuration of esmf and fms. Work not done: - Substantial restructuring of the relationship between `docker/Dockerfile` and `lib/external/docker/Dockerfile`. This should be addressed in future PRs.
- Loading branch information
Showing
11 changed files
with
59 additions
and
131 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,48 +1,33 @@ | ||
SHELL = /bin/sh | ||
|
||
ifndef FV3GFS_BUILD_DIR | ||
FV3GFS_BUILD_DIR=$(shell pwd)/external/FV3 | ||
endif | ||
include $(FV3GFS_BUILD_DIR)/conf/configure.fv3 | ||
|
||
TEMPLATES = $(shell ls ../templates) | ||
PROPERTIES_FILES = ../fv3gfs/wrapper/dynamics_properties.json ../fv3gfs/wrapper/physics_properties.json | ||
|
||
FFLAGS += \ | ||
-I$(FMS_DIR) \ | ||
-I$(FMS_DIR)/include \ | ||
-I$(FV3GFS_BUILD_DIR)/gfsphysics \ | ||
-I$(FV3GFS_BUILD_DIR)/ipd \ | ||
-I$(FV3GFS_BUILD_DIR)/cpl \ | ||
-I$(FV3GFS_BUILD_DIR)/io \ | ||
-I$(FV3GFS_BUILD_DIR)/atmos_cubed_sphere \ | ||
-I$(FV3GFS_BUILD_DIR)/ccpp/driver \ | ||
-I$(FV3GFS_BUILD_DIR)/../stochastic_physics \ | ||
-I$(FV3GFS_BUILD_DIR) | ||
# Use pkg-config to get flags for fv3 | ||
# If we run without PKG_CONFIG_ALLOW_SYSTEM_CFLAGS, | ||
# the -I/usr/include flag will be missing | ||
FFLAGS += $(shell PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config fv3 --cflags) | ||
FC ?= mpif90 | ||
|
||
.PHONY: clean cleanall fortran_libs | ||
|
||
all: coupler_lib.o dynamics_data.o physics_data.o $(TEMPLATES) | ||
|
||
dynamics_data.o: dynamics_data.F90 fortran_libs | ||
$(FC) $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) $(OTHER_FFLAGS) $(ESMF_INC) -c $< -o $@ | ||
dynamics_data.o: dynamics_data.F90 | ||
$(FC) $(FFLAGS) -c $< -o $@ | ||
|
||
physics_data.o: physics_data.F90 dynamics_data.o fortran_libs | ||
$(FC) $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) $(OTHER_FFLAGS) $(ESMF_INC) -c $< -o $@ | ||
physics_data.o: physics_data.F90 dynamics_data.o | ||
$(FC) $(FFLAGS) -c $< -o $@ | ||
|
||
coupler_lib.o: coupler_lib.F90 fortran_libs | ||
$(FC) $(CPPDEFS) $(CPPFLAGS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) $(OTHER_FFLAGS) $(ESMF_INC) -c $< -o $@ | ||
coupler_lib.o: coupler_lib.F90 | ||
$(FC) $(FFLAGS) -c $< -o $@ | ||
|
||
clean: | ||
@echo "Cleaning ... " | ||
$(RM) -f *.o *.mod *.lst *.c depend $(TEMPLATES) | ||
$(RM) -rf tests/pytest/output/* | ||
(cd external && make clean) | ||
|
||
$(TEMPLATES): %: ../templates/% $(PROPERTIES_FILES) | ||
python3 ../fill_templates.py $@ | ||
|
||
fortran_libs: | ||
cd $(FV3GFS_BUILD_DIR) && make | ||
|
||
cleanall: clean |
Submodule external
updated
from b1d219 to 8b03ce
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,4 @@ | ||
# credit: https://stackoverflow.com/questions/60045913/installing-numpy-before-using-numpy-distutils-core-setup | ||
[build-system] | ||
build-backend = "setuptools.build_meta" | ||
requires=["numpy", "setuptools", "cython", "pkgconfig", "wheel"] |
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 |
---|---|---|
|
@@ -83,3 +83,4 @@ websocket-client==0.57.0 | |
xarray==0.16.0 | ||
zarr==2.3.2 | ||
zipp==0.5.2 | ||
pkgconfig==1.5.0 |
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