diff --git a/Makefile b/Makefile index a0cb5c5264..03b6846e4d 100644 --- a/Makefile +++ b/Makefile @@ -57,9 +57,6 @@ OBJDIR := $(MAINOBJDIR)/$(ARCH)/$(ONEVERSION) OBJEXTSDIR := $(OBJDIR)/$(EXTSDIR) OBJEXTSINCL := $(foreach dir,$(EXTSPACKAGES),-I'$(OBJEXTSDIR)/$(dir)') TSTDIR := $(MAINTSTDIR)/$(ARCH)/$(ONEVERSION) -ifeq ($(OFFLOAD_CC),) -EXE_NAMES := $(basename $(notdir $(filter-out %.cu, $(ALL_EXE_FILES)))) -endif ifneq ($(LD_SHARED),) ARCHIVE_EXT := .so else @@ -87,31 +84,24 @@ endif # File type is derived from name. Only the following extensions are supported: # .F -> Fortran # .c -> C -# .cu -> CUDA -# .cc -> HIP # .h -> C header -# .hpp -> CUDA or HIP header +# .cu -> CUDA or HIP kernel ALL_SRC_DIRS := $(shell find $(SRCDIR) -type d | awk '{printf("%s:",$$1)}') ALL_PKG_FILES = $(shell find $(SRCDIR) -name "PACKAGE") OBJ_SRC_FILES = $(shell cd $(SRCDIR); find . -name "*.F") OBJ_SRC_FILES += $(shell cd $(SRCDIR); find . -name "*.c") -ifneq (,$(findstring nvcc,$(OFFLOAD_CC))) +ifneq ($(OFFLOAD_CC),) OBJ_SRC_FILES += $(shell cd $(SRCDIR); find . -name "*.cu") endif -ifneq (,$(findstring hipcc,$(OFFLOAD_CC))) -OBJ_SRC_FILES += $(shell cd $(SRCDIR); find . -name "*.cc") -endif - # Included files used by Fypp preprocessor INCLUDED_SRC_FILES = $(notdir $(shell find $(SRCDIR) -name "*.fypp")) # Include also source files which won't compile into an object file ALL_SRC_FILES = $(strip $(subst $(NULL) .,$(NULL) $(SRCDIR),$(NULL) $(OBJ_SRC_FILES))) ALL_SRC_FILES += $(shell find $(SRCDIR) -name "*.h") -ALL_SRC_FILES += $(shell find $(SRCDIR) -name "*.hpp") ALL_OBJECTS = $(addsuffix .o, $(basename $(notdir $(OBJ_SRC_FILES)))) ALL_EXE_OBJECTS = $(addsuffix .o, $(EXE_NAMES)) @@ -489,9 +479,6 @@ vpath %.h $(ALL_SRC_DIRS) vpath %.f90 $(ALL_SRC_DIRS) vpath %.cu $(ALL_SRC_DIRS) vpath %.c $(ALL_SRC_DIRS) -vpath %.cpp $(ALL_SRC_DIRS) -vpath %.cxx $(ALL_SRC_DIRS) -vpath %.cc $(ALL_SRC_DIRS) # # Add additional dependency of cp2k_info.F to git-HEAD. @@ -531,8 +518,15 @@ FYPPFLAGS ?= -n %.o: %.cu $(OFFLOAD_CC) -c $(OFFLOAD_FLAGS) $< +# Disable built-in rules for C++. %.o: %.cc - $(OFFLOAD_CC) -c $(OFFLOAD_FLAGS) $< + @echo "Error: C++ is not supported: $<"; false + +%.o: %.cpp + @echo "Error: C++ is not supported: $<"; false + +%.o: %.C + @echo "Error: C++ is not supported: $<"; false ifneq ($(LIBDIR),) $(LIBDIR)/%: diff --git a/src/dbm/dbm_multiply_gpu.cc b/src/dbm/dbm_multiply_gpu.cc deleted file mode 120000 index 2452325c05..0000000000 --- a/src/dbm/dbm_multiply_gpu.cc +++ /dev/null @@ -1 +0,0 @@ -dbm_multiply_gpu.cu \ No newline at end of file diff --git a/src/grid/hip/grid_hip_collocate.cc b/src/grid/hip/grid_hip_collocate.cu similarity index 100% rename from src/grid/hip/grid_hip_collocate.cc rename to src/grid/hip/grid_hip_collocate.cu diff --git a/src/grid/hip/grid_hip_context.cc b/src/grid/hip/grid_hip_context.cu similarity index 99% rename from src/grid/hip/grid_hip_context.cc rename to src/grid/hip/grid_hip_context.cu index 78c4d5e8e2..c713bfce7d 100644 --- a/src/grid/hip/grid_hip_context.cc +++ b/src/grid/hip/grid_hip_context.cu @@ -26,7 +26,7 @@ extern "C" { #include "../common/grid_library.h" } -#include "grid_hip_context.hpp" +#include "grid_hip_context.h" #include "grid_hip_internal_header.h" #include "grid_hip_task_list.h" diff --git a/src/grid/hip/grid_hip_context.hpp b/src/grid/hip/grid_hip_context.h similarity index 99% rename from src/grid/hip/grid_hip_context.hpp rename to src/grid/hip/grid_hip_context.h index 0f2aa772e4..ad7f5bf4b8 100644 --- a/src/grid/hip/grid_hip_context.hpp +++ b/src/grid/hip/grid_hip_context.h @@ -11,8 +11,8 @@ - Advanced Micro Devices, Inc. */ -#ifndef GRID_HIP_CONTEXT_HPP -#define GRID_HIP_CONTEXT_HPP +#ifndef GRID_HIP_CONTEXT_H +#define GRID_HIP_CONTEXT_H #include #include diff --git a/src/grid/hip/grid_hip_integrate.cc b/src/grid/hip/grid_hip_integrate.cu similarity index 99% rename from src/grid/hip/grid_hip_integrate.cc rename to src/grid/hip/grid_hip_integrate.cu index 1323bdf529..a1d5438aec 100644 --- a/src/grid/hip/grid_hip_integrate.cc +++ b/src/grid/hip/grid_hip_integrate.cu @@ -23,7 +23,7 @@ #include #include -#include "grid_hip_context.hpp" +#include "grid_hip_context.h" #include "grid_hip_internal_header.h" #include "grid_hip_process_vab.h" diff --git a/src/grid/hip/grid_hip_internal_header.h b/src/grid/hip/grid_hip_internal_header.h index 078a37c438..3800bdcdda 100644 --- a/src/grid/hip/grid_hip_internal_header.h +++ b/src/grid/hip/grid_hip_internal_header.h @@ -29,7 +29,7 @@ extern "C" { #include "../common/grid_constants.h" } -#include "grid_hip_context.hpp" +#include "grid_hip_context.h" namespace rocm_backend { diff --git a/src/pw/gpu/pw_gpu_kernels_hip.cc b/src/pw/gpu/pw_gpu_kernels_hip.cc deleted file mode 120000 index 6b0c313e2f..0000000000 --- a/src/pw/gpu/pw_gpu_kernels_hip.cc +++ /dev/null @@ -1 +0,0 @@ -pw_gpu_kernels_cuda.cu \ No newline at end of file diff --git a/tools/precommit/precommit.py b/tools/precommit/precommit.py index 2728ab7899..5aa5bbb843 100755 --- a/tools/precommit/precommit.py +++ b/tools/precommit/precommit.py @@ -187,11 +187,11 @@ def process_file(fn, allow_modifications): run_local_tool("./tools/doxify/doxify.sh", fn) run_prettify(fn) - if re.match(r".*\.(c|cu|cc|h|hpp)$", fn): + if re.match(r".*\.(c|cu|h)$", fn): run_remote_tool("clangformat", fn) - if re.match(r".*\.(cpp|cxx|hcc|hxx)$", fn): - raise Exception(f"File extension not supported by build system.") + if re.match(r".*\.(cc|cpp|cxx|hcc|hpp|hxx)$", fn): + raise Exception(f"C++ is not supported.") if re.match(r"(.*/PACKAGE)|(.*\.py)$", fn): ast.parse(orig_content, filename=fn)