@@ -185,22 +185,34 @@ endif
185185
186186# === Configure defaults for OMPFLAGS
187187
188- # Set the default OMPFLAGS choice
189- ifneq ($(findstring hipcc,$(GPUCC ) ) ,)
190- override OMPFLAGS = # disable OpenMP MT when using hipcc #802
191- else ifneq ($(shell $(CXX ) --version | egrep '^Intel') ,)
192- override OMPFLAGS = -fopenmp
193- # ##override OMPFLAGS = # disable OpenMP MT on Intel (was ok without GPUCC but not ok with GPUCC before #578)
194- else ifneq ($(shell $(CXX) --version | egrep '^(clang)'),)
195- override OMPFLAGS = -fopenmp
196- # ##override OMPFLAGS = # disable OpenMP MT on clang (was not ok without or with nvcc before #578)
197- # ##else ifneq ($(shell $(CXX) --version | egrep '^(Apple clang)'),) # AV for Mac (Apple clang compiler)
198- else ifeq ($(UNAME_S),Darwin) # OM for Mac (any compiler)
199- override OMPFLAGS = # AV disable OpenMP MT on Apple clang (builds fail in the CI #578)
200- # ##override OMPFLAGS = -fopenmp # OM reenable OpenMP MT on Apple clang? (AV Oct 2023: this still fails in the CI)
201- else
202- override OMPFLAGS = -fopenmp # enable OpenMP MT by default on all other platforms
203- # ##override OMPFLAGS = # disable OpenMP MT on all other platforms (default before #575)
188+ # Disable OpenMP by default: enable OpenMP only if USEOPENMP=1 (#758)
189+ ifeq ($(USEOPENMP ) ,1)
190+ # ##$(info USEOPENMP==1: will build with OpenMP if possible)
191+ ifneq ($(findstring hipcc,$(GPUCC)),)
192+ override OMPFLAGS = # disable OpenMP MT when using hipcc #802
193+ else ifneq ($(shell $(CXX ) --version | egrep '^Intel') ,)
194+ override OMPFLAGS = -fopenmp
195+ # ##override OMPFLAGS = # disable OpenMP MT on Intel (was ok without GPUCC but not ok with GPUCC before #578)
196+ else ifneq ($(shell $(CXX) --version | egrep '^clang version 16'),)
197+ # ##override OMPFLAGS = # disable OpenMP on clang16 #904
198+ $(error OpenMP is not supported by cudacpp on clang16 - issue # 904)
199+ else ifneq ($(shell $(CXX) --version | egrep '^clang version 17'),)
200+ # ##override OMPFLAGS = # disable OpenMP on clang17 #904
201+ $(error OpenMP is not supported by cudacpp on clang17 - issue # 904)
202+ else ifneq ($(shell $(CXX) --version | egrep '^(clang)'),)
203+ override OMPFLAGS = -fopenmp
204+ # ##override OMPFLAGS = # disable OpenMP MT on clang (was not ok without or with nvcc before #578)
205+ # ##else ifneq ($(shell $(CXX) --version | egrep '^(Apple clang)'),) # AV for Mac (Apple clang compiler)
206+ else ifeq ($(UNAME_S),Darwin) # OM for Mac (any compiler)
207+ override OMPFLAGS = # AV disable OpenMP MT on Apple clang (builds fail in the CI #578)
208+ # ##override OMPFLAGS = -fopenmp # OM reenable OpenMP MT on Apple clang? (AV Oct 2023: this still fails in the CI)
209+ else
210+ override OMPFLAGS = -fopenmp # enable OpenMP MT by default on all other platforms
211+ # ##override OMPFLAGS = # disable OpenMP MT on all other platforms (default before #575)
212+ endif
213+ else
214+ # ##$(info USEOPENMP!=1: will build without OpenMP)
215+ override OMPFLAGS =
204216endif
205217
206218# -------------------------------------------------------------------------------
@@ -521,12 +533,12 @@ processid_short=$(shell basename $(CURDIR) | awk -F_ '{print $$(NF-1)"_"$$NF}')
521533# ##$(info processid_short=$(processid_short))
522534
523535MG5AMC_CXXLIB = mg5amc_$(processid_short ) _cpp
524- cxx_objects_lib =$(BUILDDIR ) /CPPProcess_cpp.o $(BUILDDIR ) /MatrixElementKernels_cpp.o $(BUILDDIR ) /BridgeKernels_cpp.o $(BUILDDIR ) /CrossSectionKernels_cpp.o
536+ cxx_objects_lib =$(BUILDDIR ) /CPPProcess_cpp.o $(BUILDDIR ) /color_sum_cpp.o $( BUILDDIR ) / MatrixElementKernels_cpp.o $(BUILDDIR ) /BridgeKernels_cpp.o $(BUILDDIR ) /CrossSectionKernels_cpp.o
525537cxx_objects_exe =$(BUILDDIR ) /CommonRandomNumberKernel_cpp.o $(BUILDDIR ) /RamboSamplingKernels_cpp.o
526538
527539ifneq ($(GPUCC ) ,)
528540MG5AMC_GPULIB = mg5amc_$(processid_short ) _$(GPUSUFFIX )
529- gpu_objects_lib =$(BUILDDIR ) /CPPProcess_$(GPUSUFFIX ) .o $(BUILDDIR ) /MatrixElementKernels_$(GPUSUFFIX ) .o $(BUILDDIR ) /BridgeKernels_$(GPUSUFFIX ) .o $(BUILDDIR ) /CrossSectionKernels_$(GPUSUFFIX ) .o
541+ gpu_objects_lib =$(BUILDDIR ) /CPPProcess_$(GPUSUFFIX ) .o $(BUILDDIR ) /color_sum_ $( GPUSUFFIX ) .o $( BUILDDIR ) / MatrixElementKernels_$(GPUSUFFIX ) .o $(BUILDDIR ) /BridgeKernels_$(GPUSUFFIX ) .o $(BUILDDIR ) /CrossSectionKernels_$(GPUSUFFIX ) .o
530542gpu_objects_exe =$(BUILDDIR ) /CommonRandomNumberKernel_$(GPUSUFFIX ) .o $(BUILDDIR ) /RamboSamplingKernels_$(GPUSUFFIX ) .o
531543endif
532544
0 commit comments