Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

Commit

Permalink
Adding filters to the build system
Browse files Browse the repository at this point in the history
This commit adds filters to the build system in a shared src/filters
directory. Additionally, this commit adds a driver which may be used to
act on lists of filters. It is provided to allow cores to utilize shared
functionality of a driver, without writing their own custom driver, but
is not required to use filters.

This commit also adds an example filter as
mpas_filter_test_compute_interval. This filter can be used to test that
the compute interval portion of the driver works correctly.
  • Loading branch information
douglasjacobsen committed Aug 18, 2015
1 parent f4cada7 commit 169ca57
Show file tree
Hide file tree
Showing 7 changed files with 775 additions and 6 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,12 @@ endif
RM = rm -f
CPP = cpp -P -traditional
RANLIB = ranlib
ADDL_TARGETS=

ifdef CORE

USE_FILTERS=false

ifneq ($(wildcard src/core_$(CORE)), ) # CHECK FOR EXISTENCE OF CORE DIRECTORY

ifneq ($(wildcard src/core_$(CORE)/build_options.mk), ) # Check for build_options.mk
Expand Down Expand Up @@ -464,6 +467,11 @@ else
TAU_MESSAGE="TAU Hooks are off."
endif

ifeq "$(USE_FILTERS)" "true"
LIBS += -lfilters
ADDL_TARGETS = filters
endif

ifeq "$(GEN_F90)" "true"
GEN_F90_MESSAGE="MPAS generated and was built with intermediate .f90 files."
else
Expand Down Expand Up @@ -581,6 +589,7 @@ endif
CORE="$(CORE)"\
AUTOCLEAN="$(AUTOCLEAN)" \
GEN_F90="$(GEN_F90)" \
ADDL_TARGETS="$(ADDL_TARGETS)" \
NAMELIST_SUFFIX="$(NAMELIST_SUFFIX)" \
EXE_NAME="$(EXE_NAME)"

Expand Down
9 changes: 7 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ ops: $(AUTOCLEAN_DEPS) externals frame
( cd operators; $(MAKE) CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" all )
ln -sf operators/libops.a libops.a

dycore: $(AUTOCLEAN_DEPS) build_tools externals frame ops
filters: $(AUTOCLEAN_DEPS) externals frame ops
( cd filters; $(MAKE) CPPFLGAS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" all)
ln -sf filters/libfilters.a libfilters.a

dycore: $(AUTOCLEAN_DEPS) build_tools externals frame ops $(ADDL_TARGETS)
( cd core_$(CORE); $(MAKE) CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" REG_PATH="$(PWD)/tools/registry/" REG_PARSE="parse" FILTER_PARSE="filter-parse" gen_includes )
( cd core_$(CORE); $(MAKE) CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" NL_GEN="$(PWD)/tools/input_gen/namelist_gen" ST_GEN="$(PWD)/tools/input_gen/streams_gen" core_input_gen )
( cd core_$(CORE); $(MAKE) CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" all )
Expand All @@ -58,9 +62,10 @@ ifeq "$(AUTOCLEAN)" "true"
@echo "*********************************************************************************************"
@echo ""
endif
$(RM) libframework.a libops.a libdycore.a lib$(CORE).a *.o
$(RM) libframework.a libops.a libdycore.a libfilters.a lib$(CORE).a *.o
( cd tools; $(MAKE) clean )
( cd external; $(MAKE) clean )
( cd filters; $(MAKE) clean )
( cd framework; $(MAKE) clean )
( cd operators; $(MAKE) clean )
( cd driver; $(MAKE) clean )
9 changes: 7 additions & 2 deletions src/Makefile.in.ACME
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include $(CASEROOT)/Macros

USE_FILTERS=true

ifneq ($(wildcard core_$(CORE)/build_options.mk), ) # Check for build_options.mk
include core_$(CORE)/build_options.mk
else # ELSE Use Default Options
Expand All @@ -22,6 +24,8 @@ else
ESMFDIR = noesmf
endif

ADDL_TARGETS = filters

RM = rm -f
CPP = cpp -P -traditional
FC=$(MPIFC)
Expand Down Expand Up @@ -53,12 +57,13 @@ all:
( $(MAKE) mpas RM="$(RM)" CPP="$(CPP)" NETCDF="$(NETCDF)" PNETCDF="$(PNETCDF)" \
PIO="$(PIO)" FC="$(FC)" CC="$(CC)" SFC="$(SFC)" SCC="$(SCC)" \
CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" FCINCLUDES="$(FCINCLUDES)" \
FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" )
FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ADDL_TARGETS="$(ADDL_TAGETS)" )

mpas: externals frame ops dycore drver
mpas: externals frame ops dycore drver $(ADDL_TARGETS)
ar ru lib$(COMPONENT).a framework/*.o
ar ru lib$(COMPONENT).a operators/*.o
ar ru lib$(COMPONENT).a external/ezxml/*.o
ar ru lib$(COMPONENT).a filters/*.o
ar ru lib$(COMPONENT).a `find core_$(CORE)/ -type f -name "*.o"` # Find command finds objects in any subdirectories
ar ru lib$(COMPONENT).a $(DRIVER)/*.o

Expand Down
9 changes: 7 additions & 2 deletions src/Makefile.in.CESM
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include $(CASEROOT)/Macros

USE_FILTERS=true

ifneq ($(wildcard core_$(CORE)/build_options.mk), ) # Check for build_options.mk
include core_$(CORE)/build_options.mk
else # ELSE Use Default Options
Expand All @@ -22,6 +24,8 @@ else
ESMFDIR = noesmf
endif

ADDL_TARGETS = filters

RM = rm -f
CPP = cpp -P -traditional
FC=$(MPIFC)
Expand Down Expand Up @@ -53,12 +57,13 @@ all:
( $(MAKE) mpas RM="$(RM)" CPP="$(CPP)" NETCDF="$(NETCDF)" PNETCDF="$(PNETCDF)" \
PIO="$(PIO)" FC="$(FC)" CC="$(CC)" SFC="$(SFC)" SCC="$(SCC)" \
CPPFLAGS="$(CPPFLAGS)" CPPINCLUDES="$(CPPINCLUDES)" FCINCLUDES="$(FCINCLUDES)" \
FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" )
FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ADDL_TARGETS="$(ADDL_TAGETS)" )

mpas: externals frame ops dycore drver
mpas: externals frame ops dycore drver $(ADDL_TARGETS)
ar ru lib$(COMPONENT).a framework/*.o
ar ru lib$(COMPONENT).a operators/*.o
ar ru lib$(COMPONENT).a external/ezxml/*.o
ar ru lib$(COMPONENT).a filters/*.o
ar ru lib$(COMPONENT).a `find core_$(CORE)/ -type f -name "*.o"` # Find command finds objects in any subdirectories
ar ru lib$(COMPONENT).a $(DRIVER)/*.o

Expand Down
26 changes: 26 additions & 0 deletions src/filters/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.SUFFIXES: .F .c .o

FILTER_OBJS = mpas_filter_test_compute_interval.o

all: filters

filters: mpas_filter_driver.o $(FILTER_OBJS)
ar -ru libfilters.a mpas_filter_driver.o $(FILTER_OBJS)

clean:
$(RM) *.o *.mod *.f90 libfilters.a
@# Certain systems with intel compilers generate *.i files
@# This removes them during the clean process
$(RM) *.i

.F.o:
$(RM) $@ $*.mod
ifeq "$(GEN_F90)" "true"
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) $< > $*.f90
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators
else
$(FC) $(CPPFLAGS) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I../framework -I../operators
endif

.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $(CPPINCLUDES) -I../framework -I../operators -c $<
Loading

0 comments on commit 169ca57

Please sign in to comment.