diff --git a/Tools/GNUMake/sites/Make.nersc b/Tools/GNUMake/sites/Make.nersc index 9e0577ee215..fb84f3473d6 100644 --- a/Tools/GNUMake/sites/Make.nersc +++ b/Tools/GNUMake/sites/Make.nersc @@ -24,6 +24,22 @@ ifeq ($(which_computer),$(filter $(which_computer),perlmutter)) endif endif + ifeq ($(USE_CUDA),TRUE) + ifdef MPICH_ROOT + CFLAGS += -Xcompiler='$(filter-out -Wl%, $(wordlist 2,1024,$(shell mpicc -show 2> /dev/null)))' + CXXFLAGS += -Xcompiler='$(filter-out -Wl%, $(wordlist 2,1024,$(shell mpicxx -show 2> /dev/null)))' + else ifdef OPENMPI_ROOT + CFLAGS += -Xcompiler='$(filter-out -Wl%, $(wordlist 2,1024,$(shell mpicc -show 2> /dev/null)))' + CXXFLAGS += -Xcompiler='$(filter-out -Wl%, $(wordlist 2,1024,$(shell mpicxx -show 2> /dev/null)))' + else + CFLAGS += -Xcompiler='$(wordlist 2,1024,$(shell cc -craype-verbose 2> /dev/null))' + CXXFLAGS += -Xcompiler='$(wordlist 2,1024,$(shell CC -craype-verbose 2> /dev/null))' + endif + 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_CUDA),TRUE) ifdef NPE_VERSION CFLAGS += -Xcompiler='$(filter-out -Wl%, $(wordlist 2,1024,$(shell mpicc -show 2> /dev/null)))' @@ -64,13 +80,20 @@ ifeq ($(which_computer),$(filter $(which_computer),perlmutter)) comm := , ifneq ($(BL_NO_FORT),TRUE) - ifdef NPE_VERSION + ifdef MPICH_ROOT +# Set to mpicxx to avoid this warning: +# cc1plus: warning: command-line option '-fallow-argument-mismatch' is valid for Fortran but not for C++ +# Can just be filtered out, or is cxx fine? + LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(wordlist 2,1024,$(shell mpicxx -show))) + else ifdef OPENMPI_ROOT LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(wordlist 2,1024,$(shell mpifort -show))) else LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(shell ftn --cray-print-opts=libs)) endif else - ifdef NPE_VERSION + ifdef MPICH_ROOT + LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(wordlist 2,1024,$(shell mpicxx -show))) + else ifdef OPENMPI_ROOT LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(wordlist 2,1024,$(shell mpicxx -show))) else LIBRARIES += $(subst -Wl$(comm),-Xlinker=,$(shell CC --cray-print-opts=libs))