Skip to content

Commit

Permalink
Add Polaris to GNUMake (AMReX-Codes#2908)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsexton03 committed Aug 18, 2022
1 parent bd5f6a9 commit fa8e20f
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Tools/GNUMake/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ else ifeq ($(USE_CUDA),TRUE)
LINK_WITH_FORTRAN_COMPILER=TRUE
endif

$(info Loading $(AMREX_HOME)/Tools/GNUMake/comps/nvcc.mak...)
include $(AMREX_HOME)/Tools/GNUMake/comps/nvcc.mak

ifeq ($(USE_MPI),TRUE)
Expand Down Expand Up @@ -966,17 +967,17 @@ endif
F90CACHE =

ifeq ($(TP_PROFILING),VTUNE)
$(into Loading $(AMREX_HOME)/Tools/GNUMake/tools/Make.vtune
$(info Loading $(AMREX_HOME)/Tools/GNUMake/tools/Make.vtune
include $(AMREX_HOME)/Tools/GNUMake/tools/Make.vtune
endif

ifeq ($(TP_PROFILING),CRAYPAT)
$(into Loading $(AMREX_HOME)/Tools/GNUMake/tools/Make.craypat
$(info Loading $(AMREX_HOME)/Tools/GNUMake/tools/Make.craypat
include $(AMREX_HOME)/Tools/GNUMake/tools/Make.craypat
endif

ifeq ($(TP_PROFILING),FORGE)
$(into Loading $(AMREX_HOME)/Tools/GNUMake/tools/Make.forge
$(info Loading $(AMREX_HOME)/Tools/GNUMake/tools/Make.forge
include $(AMREX_HOME)/Tools/GNUMake/tools/Make.forge
endif

Expand Down
12 changes: 9 additions & 3 deletions Tools/GNUMake/Make.machines
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ ifdef OLCF_ROCM_ROOT
endif
endif

ifeq ($(findstring theta, $(host_name)), theta)
which_site := alcf
which_computer := theta
ifeq ($(findstring alcf.anl.gov, $(host_name)),alcf.anl.gov)
ifeq ($(findstring theta, $(host_name)), theta)
which_site := alcf
which_computer := theta
endif
ifeq ($(findstring polaris, $(host_name)), polaris)
which_site := alcf
which_computer := polaris
endif
endif

ifeq ($(findstring sierra, $(host_name)), sierra)
Expand Down
75 changes: 75 additions & 0 deletions Tools/GNUMake/sites/Make.alcf
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,78 @@ ifeq ($(which_computer),theta)
LIBRARIES += -lmpichf90
endif
endif

ifeq ($(which_computer),$(filter $(which_computer),polaris))

ifdef PE_ENV
ifneq ($(USE_GPU),TRUE)
lowercase_peenv := $(shell echo $(PE_ENV) | tr A-Z a-z)
ifneq ($(lowercase_peenv),$(lowercase_comp))
has_compiler_mismatch = COMP=$(COMP) does not match PrgEnv-$(lowercase_peenv)
endif
ifeq ($(MAKECMDGOALS),)
ifeq ($(lowercase_peenv),nvidia)
$(error PrgEnv-nvidia cannot be used with CPU-only builds. Try PrgEnv-gnu instead.)
endif
endif
endif
endif

ifeq ($(USE_CUDA),TRUE)
CFLAGS += -Xcompiler='$(wordlist 2,1024,$(shell cc -craype-verbose 2> /dev/null))'
CXXFLAGS += -Xcompiler='$(wordlist 2,1024,$(shell CC -craype-verbose 2> /dev/null))'
else ifeq ($(USE_MPI),FALSE)
CFLAGS += $(wordlist 2,1024,$(shell cc -craype-verbose 2> /dev/null))
CXXFLAGS += $(wordlist 2,1024,$(shell CC -craype-verbose 2> /dev/null))
endif

ifeq ($(USE_MPI),TRUE)
ifneq ($(USE_CUDA),TRUE)
CC = cc
CXX = CC
FC = ftn
F90 = ftn
LIBRARIES += -lmpichf90
endif

includes += $(shell CC --cray-print-opts=cflags)
endif

ifeq ($(USE_CUDA),TRUE)
CUDA_ARCH = 80

ifeq ($(USE_MPI), FALSE)
includes += $(CRAY_CUDATOOLKIT_INCLUDE_OPTS)
endif

comm := ,
ifneq ($(BL_NO_FORT),TRUE)
LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(shell ftn --cray-print-opts=libs))
else
LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(shell CC --cray-print-opts=libs))
endif

ifneq ($(CUDA_ROOT),)
SYSTEM_CUDA_PATH := $(CUDA_ROOT)
COMPILE_CUDA_PATH := $(CUDA_ROOT)
else ifneq ($(CUDA_HOME),)
SYSTEM_CUDA_PATH := $(CUDA_HOME)
COMPILE_CUDA_PATH := $(CUDA_HOME)
else ifneq ($(CUDA_PATH),)
SYSTEM_CUDA_PATH := $(CUDA_PATH)
COMPILE_CUDA_PATH := $(CUDA_PATH)
else ifneq ($(NVIDIA_PATH),)
SYSTEM_CUDA_PATH := $(NVIDIA_PATH)/cuda
COMPILE_CUDA_PATH := $(NVIDIA_PATH)/cuda
else
$(error No CUDA_ROOT nor CUDA_HOME nor CUDA_PATH found. Please load a cuda module.)
endif

# Provide system configuration information.

GPUS_PER_NODE=4
GPUS_PER_SOCKET=4

endif

endif

0 comments on commit fa8e20f

Please sign in to comment.