-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add toolchain flag --with-amd to facilitate builds with the AMD AOCC … (
- Loading branch information
Showing
6 changed files
with
316 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
#!/bin/bash | ||
# | ||
# CP2K AMD arch file for a serial x86_64 binary | ||
# | ||
# Tested with: AMD AOCC 5.0.0 | ||
# | ||
# Usage: Source this arch file and then run make as instructed. | ||
# | ||
# Last update: 15.10.2024 | ||
# | ||
# \ | ||
if [[ "${0}" == "${BASH_SOURCE}" ]]; then \ | ||
echo "ERROR: Script ${0##*/} must be sourced"; \ | ||
echo "Usage: source ${0##*/}"; \ | ||
exit 1; \ | ||
fi; \ | ||
this_file=${BASH_SOURCE##*/}; \ | ||
cd tools/toolchain; \ | ||
rm -rf build; \ | ||
[[ -z "${target_cpu}" ]] && target_cpu="native"; \ | ||
./install_cp2k_toolchain.sh -j${maxtasks} --mpi-mode=no --no-arch-files --target-cpu=${target_cpu} --with-amd --with-dftd4=no; \ | ||
source ./install/setup; \ | ||
cd ../..; \ | ||
echo; \ | ||
echo "Check the output above for error messages and consistency!"; \ | ||
echo; \ | ||
echo "If everything is OK, you can build a CP2K production binary with"; \ | ||
echo " make -j ARCH=${this_file%.*} VERSION=${this_file##*.} TARGET_CPU=${target_cpu}"; \ | ||
echo "Further checks are performed, if DO_CHECKS=yes is added."; \ | ||
echo; \ | ||
return | ||
|
||
# Set options | ||
DO_CHECKS := no | ||
TARGET_CPU := native | ||
|
||
# Retrieve package versions | ||
AMD_VER := $(shell clang -dumpversion) | ||
#USE_DFTD4 := $(DFTD4_VER) | ||
USE_FFTW := $(FFTW_VER) | ||
USE_LIBGRPP := $(LIBGRPP_VER) | ||
USE_LIBINT := $(LIBINT_VER) | ||
USE_LIBVORI := $(LIBVORI_VER) | ||
USE_LIBXC := $(LIBXC_VER) | ||
USE_LIBXSMM := $(LIBXSMM_VER) | ||
USE_OPENBLAS := $(OPENBLAS_VER) | ||
USE_SPGLIB := $(SPGLIB_VER) | ||
|
||
LMAX := 5 | ||
MAX_CONTR := 4 | ||
|
||
CC := clang | ||
CXX := clang++ | ||
FC := flang | ||
LD := flang | ||
AR := ar -r | ||
|
||
ifeq ($(TARGET_CPU), generic) | ||
CFLAGS := -O2 -fPIC -fopenmp -g -mtune=$(TARGET_CPU) | ||
else | ||
CFLAGS := -O2 -fPIC -fopenmp -g -march=$(TARGET_CPU) -mtune=$(TARGET_CPU) | ||
endif | ||
CFLAGS += -mllvm -enable-newgvn=true | ||
|
||
DFLAGS += -D__MAX_CONTR=$(strip $(MAX_CONTR)) | ||
|
||
INSTALL_PATH := $(PWD)/tools/toolchain/install | ||
|
||
# Settings for regression testing | ||
ifeq ($(DO_CHECKS), yes) | ||
DFLAGS += -D__CHECK_DIAG | ||
endif | ||
|
||
ifneq ($(USE_LIBVORI),) | ||
USE_LIBVORI := $(strip $(USE_LIBVORI)) | ||
LIBVORI_LIB := $(INSTALL_PATH)/libvori-$(USE_LIBVORI)/lib | ||
DFLAGS += -D__LIBVORI | ||
LIBS += $(LIBVORI_LIB)/libvori.a | ||
endif | ||
|
||
ifneq ($(USE_LIBXC),) | ||
USE_LIBXC := $(strip $(USE_LIBXC)) | ||
LIBXC_INC := $(INSTALL_PATH)/libxc-$(USE_LIBXC)/include | ||
LIBXC_LIB := $(INSTALL_PATH)/libxc-$(USE_LIBXC)/lib | ||
CFLAGS += -I$(LIBXC_INC) | ||
DFLAGS += -D__LIBXC | ||
LIBS += $(LIBXC_LIB)/libxcf03.a | ||
LIBS += $(LIBXC_LIB)/libxc.a | ||
endif | ||
|
||
ifneq ($(USE_DFTD4),) | ||
USE_DFTD4 := $(strip $(USE_DFTD4)) | ||
DFTD4_INC := $(INSTALL_PATH)/dftd4-$(USE_DFTD4)/include | ||
DFTD4_LIB := $(INSTALL_PATH)/dftd4-$(USE_DFTD4)/lib64 | ||
CFLAGS += -I$(DFTD4_INC)/dftd4/AMD-$(AMD_VER) | ||
DFLAGS += -D__DFTD4 | ||
LIBS += $(DFTD4_LIB)/libdftd4.a | ||
LIBS += $(DFTD4_LIB)/libmstore.a | ||
LIBS += $(DFTD4_LIB)/libmulticharge.a | ||
LIBS += $(DFTD4_LIB)/libmctc-lib.a | ||
endif | ||
|
||
ifneq ($(USE_LIBGRPP),) | ||
USE_LIBGRPP := $(strip $(USE_LIBGRPP)) | ||
LIBGRPP_INC := $(INSTALL_PATH)/libgrpp-main-$(USE_LIBGRPP)/include | ||
LIBGRPP_LIB := $(INSTALL_PATH)/libgrpp-main-$(USE_LIBGRPP)/lib | ||
CFLAGS += -I$(LIBGRPP_INC) | ||
DFLAGS += -D__LIBGRPP | ||
LIBS += $(LIBGRPP_LIB)/liblibgrpp.a | ||
endif | ||
|
||
ifneq ($(USE_LIBINT),) | ||
USE_LIBINT := $(strip $(USE_LIBINT)) | ||
LMAX := $(strip $(LMAX)) | ||
LIBINT_INC := $(INSTALL_PATH)/libint-v$(USE_LIBINT)-cp2k-lmax-$(LMAX)/include | ||
LIBINT_LIB := $(INSTALL_PATH)/libint-v$(USE_LIBINT)-cp2k-lmax-$(LMAX)/lib | ||
CFLAGS += -I$(LIBINT_INC) | ||
DFLAGS += -D__LIBINT | ||
LIBS += $(LIBINT_LIB)/libint2.a | ||
endif | ||
|
||
ifneq ($(USE_SPGLIB),) | ||
USE_SPGLIB := $(strip $(USE_SPGLIB)) | ||
SPGLIB_INC := $(INSTALL_PATH)/spglib-$(USE_SPGLIB)/include | ||
SPGLIB_LIB := $(INSTALL_PATH)/spglib-$(USE_SPGLIB)/lib | ||
CFLAGS += -I$(SPGLIB_INC) | ||
DFLAGS += -D__SPGLIB | ||
LIBS += $(SPGLIB_LIB)/libsymspg.a | ||
endif | ||
|
||
ifneq ($(USE_LIBXSMM),) | ||
USE_LIBXSMM := $(strip $(USE_LIBXSMM)) | ||
LIBXSMM_INC := $(INSTALL_PATH)/libxsmm-$(USE_LIBXSMM)/include | ||
LIBXSMM_LIB := $(INSTALL_PATH)/libxsmm-$(USE_LIBXSMM)/lib | ||
CFLAGS += -I$(LIBXSMM_INC) | ||
DFLAGS += -D__LIBXSMM | ||
ifeq ($(SHARED), yes) | ||
LIBS += -Wl,-rpath=$(LIBXSMM_LIB) -L$(LIBXSMM_LIB) -lxsmmf -lxsmmext -lxsmm | ||
else | ||
LIBS += $(LIBXSMM_LIB)/libxsmmf.a | ||
LIBS += $(LIBXSMM_LIB)/libxsmmext.a | ||
LIBS += $(LIBXSMM_LIB)/libxsmm.a | ||
endif | ||
endif | ||
|
||
ifneq ($(USE_FFTW),) | ||
USE_FFTW := $(strip $(USE_FFTW)) | ||
FFTW_INC := $(INSTALL_PATH)/fftw-$(USE_FFTW)/include | ||
FFTW_LIB := $(INSTALL_PATH)/fftw-$(USE_FFTW)/lib | ||
CFLAGS += -I$(FFTW_INC) | ||
DFLAGS += -D__FFTW3 | ||
LIBS += $(FFTW_LIB)/libfftw3_omp.a | ||
LIBS += $(FFTW_LIB)/libfftw3.a | ||
endif | ||
|
||
ifneq ($(USE_OPENBLAS),) | ||
USE_OPENBLAS := $(strip $(USE_OPENBLAS)) | ||
OPENBLAS_INC := $(INSTALL_PATH)/openblas-$(USE_OPENBLAS)/include | ||
OPENBLAS_LIB := $(INSTALL_PATH)/openblas-$(USE_OPENBLAS)/lib | ||
CFLAGS += -I$(OPENBLAS_INC) | ||
LIBS += $(OPENBLAS_LIB)/libopenblas.a | ||
endif | ||
|
||
CFLAGS += $(DFLAGS) $(CFLAGS_DEBUG) | ||
|
||
FCFLAGS := $(CFLAGS) $(FCFLAGS_DEBUG) $(WFLAGS) | ||
FCFLAGS += -ffree-form | ||
FCFLAGS += -Mbackslash | ||
|
||
LDFLAGS += $(FCFLAGS) | ||
LDFLAGS_C := -fno-fortran-main | ||
|
||
LIBS += -Wl,--whole-archive -lpthread -ldl -Wl,--no-whole-archive -lstdc++ | ||
|
||
# End |
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
Oops, something went wrong.