Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restructure makefiles #261

Merged
merged 5 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Make.CVODE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ifeq ($(INTEGRATOR_DIR), CVODE)

INCLUDE_LOCATIONS += $(CVODE_HOME)/include

LIBRARY_LOCATIONS += $(CVODE_HOME)/lib
LIBRARIES += -lsundials_cvode -lsundials_sunlinsolband -lsundials_sunlinsolspbcgs -lsundials_sunlinsolsptfqmr -lsundials_sunmatrixsparse -lsundials_nveccuda -lsundials_sunlinsoldense -lsundials_sunlinsolspfgmr -lsundials_sunmatrixband -lsundials_sunnonlinsolfixedpoint -lsundials_nvecserial -lsundials_sunlinsolpcg -lsundials_sunlinsolspgmr -lsundials_sunmatrixdense -lsundials_sunnonlinsolnewton

ifeq ($(USE_CUDA_CVODE),TRUE)
LIBRARIES += -rpath=$(CVODE_HOME)/lib
else
LIBRARIES += -Wl,-rpath,$(CVODE_HOME)/lib
endif

ifeq ($(USE_CUDA_CVODE), TRUE)
DEFINES += -DCUDA_CVODE
endif

ifeq ($(USE_CVODE_CUSOLVER), TRUE)
DEFINES += -DCVODE_CUSOLVER

LIBRARIES += -lsundials_cusolver_sparse -lcusolver -lcusparse -lcublas
LIBRARIES += -rpath=$(COMPILE_CUDA_PATH)/lib64
endif

endif
109 changes: 6 additions & 103 deletions Make.Microphysics
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ ifeq ($(USE_ACC), TRUE)
DEFINES += -DACC
endif

ifeq ($(USE_EXTRA_THERMO), TRUE)
DEFINES += -DEXTRA_THERMO
endif

ifeq ($(USE_SIMPLIFIED_SDC), TRUE)
DEFINES += -DSIMPLIFIED_SDC
endif
Expand All @@ -97,37 +93,12 @@ endif
#------------------------------------------------------------------------------
# CVODE directories
#------------------------------------------------------------------------------
ifeq ($(INTEGRATOR_DIR), CVODE)

INCLUDE_LOCATIONS += $(CVODE_HOME)/include

LIBRARY_LOCATIONS += $(CVODE_HOME)/lib
LIBRARIES += -lsundials_cvode -lsundials_sunlinsolband -lsundials_sunlinsolspbcgs -lsundials_sunlinsolsptfqmr -lsundials_sunmatrixsparse -lsundials_nveccuda -lsundials_sunlinsoldense -lsundials_sunlinsolspfgmr -lsundials_sunmatrixband -lsundials_sunnonlinsolfixedpoint -lsundials_nvecserial -lsundials_sunlinsolpcg -lsundials_sunlinsolspgmr -lsundials_sunmatrixdense -lsundials_sunnonlinsolnewton

ifeq ($(USE_CUDA_CVODE),TRUE)
LIBRARIES += -rpath=$(CVODE_HOME)/lib
else
LIBRARIES += -Wl,-rpath,$(CVODE_HOME)/lib
endif

ifeq ($(USE_CUDA_CVODE), TRUE)
DEFINES += -DCUDA_CVODE
endif

ifeq ($(USE_CVODE_CUSOLVER), TRUE)
DEFINES += -DCVODE_CUSOLVER

LIBRARIES += -lsundials_cusolver_sparse -lcusolver -lcusparse -lcublas
LIBRARIES += -rpath=$(COMPILE_CUDA_PATH)/lib64
endif

endif
include $(MICROPHYSICS_HOME)/Make.CVODE

#------------------------------------------------------------------------------
# Microphysics directories
#------------------------------------------------------------------------------

Bdirs := interfaces constants
Bdirs := constants

Bpack += $(foreach dir, $(Bdirs), $(TOP)/$(dir)/Make.package)
Blocs += $(foreach dir, $(Bdirs), $(TOP)/$(dir))
Expand All @@ -147,88 +118,20 @@ else
Pdirs := Base
endif

Bpack += $(foreach dir, $(Pdirs), $(AMREX_HOME)/Src/$(dir)/Make.package)
Bpack += $(foreach dir, $(Pdirs), $(AMREX_HOME)/Src/$(dir)/Make.package)


#------------------------------------------------------------------------------
# microphysics
# microphysics
#------------------------------------------------------------------------------
NETWORK_OUTPUT_PATH := .

EOS_PATH := $(MICROPHYSICS_HOME)/EOS/$(strip $(EOS_DIR))
NETWORK_PATH := $(MICROPHYSICS_HOME)/networks/$(strip $(NETWORK_DIR))
CONDUCTIVITY_PATH := $(MICROPHYSICS_HOME)/conductivity/$(strip $(CONDUCTIVITY_DIR))


# Problems can specify the input file for general_null by setting
# GENERAL_NET_INPUTS directly (full path) or just specifying the name
# of the inputs file as NETWORK_INPUTS and let us sort it out
ifndef GENERAL_NET_INPUTS
ifneq "$(wildcard $(NETWORK_INPUTS))" ""
GENERAL_NET_INPUTS := $(NETWORK_INPUTS)
else
GENERAL_NET_INPUTS := $(MICROPHYSICS_HOME)/networks/general_null/$(NETWORK_INPUTS)
endif
endif

# URCA network has tables
ifeq ($(findstring URCA-simple, $(NETWORK_DIR)), URCA-simple)
all: urcatables
endif

urcatables:
@if [ ! -f 23Ne-23Na_betadecay.dat ]; then echo ${bold}Linking 23Ne-23Na_betadecay.dat${normal}; ln -s $(NETWORK_PATH)/23Ne-23Na_betadecay.dat .; fi
@if [ ! -f 23Na-23Ne_electroncapture.dat ]; then echo ${bold}Linking 23Na-23Ne_electroncapture.dat${normal}; ln -s $(NETWORK_PATH)/23Na-23Ne_electroncapture.dat .; fi

# Pynucastro networks read rate data from an external file
PYNUCASTRO_FILE := "$(NETWORK_PATH)/reaclib_rate_metadata.dat"
all: pynucastrorates


# do not check to see if the file already exists, just force-link it in
# because different Reaclib networks will have different versions of the file
pynucastrorates:
@if [ -f $(PYNUCASTRO_FILE) ] && [ ! -f ./reaclib_rate_metadata.dat ]; then echo Linking pynucastro rate file; ln -s $(PYNUCASTRO_FILE) .; fi

EXTERN_CORE += $(EOS_HOME)
EXTERN_CORE += $(EOS_PATH)

# the helmholtz EOS has an include file -- also add a target to link
# the table into the problem directory.
ifeq ($(findstring helmholtz, $(EOS_DIR)), helmholtz)
all: table
endif

table:
@if [ ! -f helm_table.dat ]; then echo Linking helm_table.dat; ln -s $(EOS_PATH)/helm_table.dat .; fi

ifeq ($(findstring gamma_law_general, $(EOS_DIR)), gamma_law_general)
DEFINES += -DEOS_GAMMA_LAW_GENERAL
endif

# include the conductivity
ifdef USE_CONDUCTIVITY
ifeq ($(USE_CONDUCTIVITY),TRUE)
DEFINES += -DCONDUCTIVITY
EXTERN_CORE += $(CONDUCTIVITY_HOME)
EXTERN_CORE += $(CONDUCTIVITY_PATH)
endif
endif

# include the network
EXTERN_CORE += $(NETWORK_PATH)

# Note that this should be located after the include of the EOS and
# Network includes since it has actions that depend on variables set
# there.

EXTERN_CORE += $(MICROPHYSICS_HOME)/EOS
EXTERN_CORE += $(MICROPHYSICS_HOME)/networks
include $(MICROPHYSICS_HOME)/Make.Microphysics_extern

Bpack += $(foreach dir, $(EXTERN_CORE), $(dir)/Make.package)
Blocs += $(foreach dir, $(EXTERN_CORE), $(dir))



#------------------------------------------------------------------------------
# include all of the necessary directories
#------------------------------------------------------------------------------
Expand Down
89 changes: 89 additions & 0 deletions Make.Microphysics_extern
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# This is the main include makefile for applications that want to use Microphysics
# You should set NETWORK_OUTPUT_PATH before including this file

EOS_PATH := $(MICROPHYSICS_HOME)/EOS/$(strip $(EOS_DIR))
NETWORK_PATH := $(MICROPHYSICS_HOME)/networks/$(strip $(NETWORK_DIR))
ifeq ($(USE_CONDUCTIVITY), TRUE)
CONDUCTIVITY_PATH := $(MICROPHYSICS_HOME)/conductivity/$(strip $(CONDUCTIVITY_DIR))
endif

# Problems can specify the input file for general_null by setting
# GENERAL_NET_INPUTS directly (full path) or just specifying the name
# of the inputs file as NETWORK_INPUTS and let us sort it out
ifndef GENERAL_NET_INPUTS
ifneq "$(wildcard $(NETWORK_INPUTS))" ""
GENERAL_NET_INPUTS := $(NETWORK_INPUTS)
else
GENERAL_NET_INPUTS := $(MICROPHYSICS_HOME)/networks/general_null/$(NETWORK_INPUTS)
endif
endif

# URCA network has tables
ifeq ($(findstring URCA-simple, $(NETWORK_DIR)), URCA-simple)
all: urcatables
endif

urcatables:
@if [ ! -f 23Ne-23Na_betadecay.dat ]; then echo ${bold}Linking 23Ne-23Na_betadecay.dat${normal}; ln -s $(NETWORK_PATH)/23Ne-23Na_betadecay.dat .; fi
@if [ ! -f 23Na-23Ne_electroncapture.dat ]; then echo ${bold}Linking 23Na-23Ne_electroncapture.dat${normal}; ln -s $(NETWORK_PATH)/23Na-23Ne_electroncapture.dat .; fi

# Pynucastro networks read rate data from an external file
PYNUCASTRO_FILE := "$(NETWORK_PATH)/reaclib_rate_metadata.dat"
all: pynucastrorates


# do not check to see if the file already exists, just force-link it in
# because different Reaclib networks will have different versions of the file
pynucastrorates:
@if [ -f $(PYNUCASTRO_FILE) ] && [ ! -f ./reaclib_rate_metadata.dat ]; then echo Linking pynucastro rate file; ln -s $(PYNUCASTRO_FILE) .; fi

EXTERN_CORE += $(EOS_HOME)
EXTERN_CORE += $(EOS_PATH)

# the helmholtz EOS has an include file -- also add a target to link
# the table into the problem directory.
ifeq ($(findstring helmholtz, $(EOS_DIR)), helmholtz)
all: table
endif

table:
@if [ ! -f helm_table.dat ]; then echo Linking helm_table.dat; ln -s $(EOS_PATH)/helm_table.dat .; fi

ifeq ($(findstring gamma_law_general, $(EOS_DIR)), gamma_law_general)
DEFINES += -DEOS_GAMMA_LAW_GENERAL
endif

# include the network
EXTERN_CORE += $(NETWORK_PATH)


# Note that this should be located after the include of the EOS and
# Network includes since it has actions that depend on variables set
# there.

EXTERN_CORE += $(MICROPHYSICS_HOME)/EOS
EXTERN_CORE += $(MICROPHYSICS_HOME)/networks
EXTERN_CORE += $(MICROPHYSICS_HOME)/interfaces

# include the conductivity
ifeq ($(USE_CONDUCTIVITY),TRUE)
DEFINES += -DCONDUCTIVITY
EXTERN_CORE += $(CONDUCTIVITY_HOME)
EXTERN_CORE += $(CONDUCTIVITY_PATH)
endif


ifeq ($(USE_RAD), TRUE)
ifeq ($(Opacity_dir), null)
$(error The null opacity directory has been removed, please update to rad_power_law)
endif
OPAC_PATH := $(MICROPHYSICS_HOME)/opacity/$(Opacity_dir)
EXTERN_CORE += $(OPAC_PATH)
endif

ifeq ($(USE_EXTRA_THERMO), TRUE)
DEFINES += -DEXTRA_THERMO
endif



7 changes: 7 additions & 0 deletions integration/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ endif

DEFINES += -DINTEGRATOR=$(INTEGRATOR_NUM)

ifeq ($(USE_CUDA), TRUE)
ifneq ($(INTEGRATOR_DIR), VODE)
$(error Only the VODE integrator supports GPUs currently, please change INTEGRATOR_DIR)
endif
endif


# Include all integrators in the build.

ifeq ($(INTEGRATOR_DIR),VODE)
Expand Down
51 changes: 24 additions & 27 deletions networks/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,35 @@ include $(MICROPHYSICS_UTIL_PATH)/Make.package

ifeq ($(USE_REACT), TRUE)

ifeq ($(INTEGRATOR_DIR), VODE90)
override INTEGRATOR_DIR = VODE
$(warn VODE90 has been renamed VODE)
endif
ifeq ($(INTEGRATOR_DIR), VODE90)
override INTEGRATOR_DIR = VODE
$(warn VODE90 has been renamed VODE)
endif

ifneq ($(INTEGRATOR_DIR), VODE)
ifneq ($(INTEGRATOR_DIR), VODE)

INCLUDE_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/LINPACK
VPATH_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/LINPACK
INCLUDE_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/LINPACK
VPATH_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/LINPACK

include $(MICROPHYSICS_UTIL_PATH)/LINPACK/Make.package
else
ifeq ($(USE_CLEANED_CORRECTOR), TRUE)
DEFINES += -DCLEAN_INTEGRATOR_CORRECTION
include $(MICROPHYSICS_UTIL_PATH)/LINPACK/Make.package
else
ifeq ($(USE_CLEANED_CORRECTOR), TRUE)
DEFINES += -DCLEAN_INTEGRATOR_CORRECTION
endif
endif
endif

ifneq ($(USE_SYSTEM_BLAS), TRUE)
ifneq ($(INTEGRATOR_DIR), VODE)
INCLUDE_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/BLAS
VPATH_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/BLAS
ifneq ($(USE_SYSTEM_BLAS), TRUE)
ifneq ($(INTEGRATOR_DIR), VODE)
INCLUDE_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/BLAS
VPATH_LOCATIONS += $(MICROPHYSICS_UTIL_PATH)/BLAS

include $(MICROPHYSICS_UTIL_PATH)/BLAS/Make.package
include $(MICROPHYSICS_UTIL_PATH)/BLAS/Make.package
endif
endif
endif

VPATH_LOCATIONS += $(MICROPHYSICS_HOME)/networks
f90EXE_sources += rate_type.f90

endif
VPATH_LOCATIONS += $(MICROPHYSICS_HOME)/networks
f90EXE_sources += rate_type.f90

ifeq ($(USE_REACT), TRUE)

# we need the actual integrator in the VPATH before the
# integration/ dir to get overrides correct
Expand Down Expand Up @@ -88,15 +85,15 @@ ifeq ($(USE_NEUTRINOS), TRUE)

endif

NETWORK_HEADERS_DIR ?= .
NETWORK_OUTPUT_PATH ?= .

ifneq ($(NETWORK_DIR), general_null)
$(NETWORK_HEADERS_DIR)/network_properties.H: $(NETWORK_HEADERS_DIR)/network_properties.F90
$(NETWORK_OUTPUT_PATH)/network_properties.H: $(NETWORK_OUTPUT_PATH)/network_properties.F90

$(NETWORK_HEADERS_DIR)/network_properties.F90:
$(NETWORK_OUTPUT_PATH)/network_properties.F90:
$(MICROPHYSICS_HOME)/networks/update_headers.py \
--microphysics_path $(MICROPHYSICS_HOME) \
--net $(NETWORK_DIR) \
--odir $(NETWORK_HEADERS_DIR)
--odir $(NETWORK_OUTPUT_PATH)

endif
2 changes: 0 additions & 2 deletions networks/general_null/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ endif
f90EXE_sources += actual_rhs.f90
endif

NETWORK_OUTPUT_PATH ?= $(CURDIR)

$(NETWORK_OUTPUT_PATH)/network_properties.H: $(NETWORK_OUTPUT_PATH)/actual_network.F90

# actual_network.F90 is created at build time for this network
Expand Down