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

put USE_HDF5 in the GNUMake build system #1047

Merged
merged 5 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 1 addition & 6 deletions Tests/HDF5Benchmark/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DEBUG = FALSE

DIM = 3

COMP = gnu
COMP = gnu

PRECISION = DOUBLE

Expand All @@ -28,11 +28,6 @@ include $(AMREX_HOME)/Tools/GNUMake/Make.rules

USE_HDF5 = TRUE
HDF5_HOME = $(HOME)/hdf5/develop_build/hdf5
ifeq ($(USE_HDF5), TRUE)
DEFINES += -DAMREX_USE_HDF5
INCLUDE_LOCATIONS += $(HDF5_HOME)/include
LIBRARIES += -lhdf5 -lz -ldl -L$(HDF5_HOME)/lib
endif

# To use HDF5 asynchronous I/O VOL connector, follow the instructions at https://bitbucket.hdfgroup.org/projects/HDF5VOL/repos/async/browse
USE_HDF5_ASYNC = FALSE
Expand Down
5 changes: 0 additions & 5 deletions Tests/Slice/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ include $(AMREX_HOME)/Tools/GNUMake/Make.rules

HDF5_HOME = /global/homes/s/sbyna/software/hdf5develop/install
USE_HDF5 = FALSE
ifeq ($(USE_HDF5), TRUE)
DEFINES += -DBL_HDF5
INCLUDE_LOCATIONS += $(HDF5_HOME)/include
LIBRARIES += -lhdf5 -L$(HDF5_HOME)/lib
endif
11 changes: 11 additions & 0 deletions Tools/GNUMake/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ else
USE_SENSEI_INSITU := FALSE
endif

ifdef USE_HDF5
USE_HDF5 := $(strip $(USE_HDF5))
else
USE_HDF5 := FALSE
endif

ifdef EBASE
EBASE := $(strip $(EBASE))
else
Expand Down Expand Up @@ -964,6 +970,11 @@ ifeq ($(USE_SENSEI_INSITU),TRUE)
include $(AMREX_HOME)/Tools/GNUMake/tools/Make.sensei
endif

ifeq ($(USE_HDF5),TRUE)
$(info Loading $(AMREX_HOME)/Tools/GNUMake/packages/Make.hdf5...)
include $(AMREX_HOME)/Tools/GNUMake/packages/Make.hdf5
endif

ifneq ("$(wildcard $(AMREX_HOME)/Tools/GNUMake/Make.local)","")
$(info Loading $(AMREX_HOME)/Tools/GNUMake/Make.local...)
include $(AMREX_HOME)/Tools/GNUMake/Make.local
Expand Down
19 changes: 19 additions & 0 deletions Tools/GNUMake/packages/Make.hdf5
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CPPFLAGS += -DAMREX_USE_HDF5

ifndef AMREX_HDF5_HOME
ifdef HDF5_DIR
AMREX_HDF5_HOME = $(HDF5_DIR)
endif
ifdef HDF5_HOME
AMREX_HDF5_HOME = $(HDF5_HOME)
endif
endif

LIBRARIES += -lhdf5 -lz -ldl

ifdef AMREX_HDF5_HOME
HDF5_ABSPATH = $(abspath $(AMREX_HDF5_HOME))
INCLUDE_LOCATIONS += $(HDF5_ABSPATH)/include
LIBRARY_LOCATIONS += $(HDF5_ABSPATH)/lib
LIBRARIES += -L$(HDF5_ABSPATH)/lib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not needed because the path has already been added to LIBRARY_LOCATIONS. In Make.defs, we have

LDFLAGS += -L. $(addprefix -L, $(LIBRARY_LOCATIONS))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have:

ifeq ($(USE_RPATH),TRUE)
  LDFLAGS += -Xlinker -rpath -Xlinker '$(abspath .)' $(addprefix -Xlinker -rpath -Xlinker , $(abspath $(LIBRARY_LOCATIONS)))
endif

in Make.defs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but USE_RPATH is not defaulted to TRUE.

endif