Skip to content

Commit 8973282

Browse files
authored
Merge pull request madgraph5#1065 from zeniheisser/minor_fixes
fixed makefiles for madtrex
2 parents 1cce307 + d509d81 commit 8973282

File tree

2 files changed

+57
-33
lines changed

2 files changed

+57
-33
lines changed

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MadtRex/makefiles/cudacpp_driver.mk

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -341,22 +341,34 @@ endif
341341

342342
#=== Configure defaults for OMPFLAGS
343343

344-
# Set the default OMPFLAGS choice
345-
ifneq ($(findstring hipcc,$(GPUCC)),)
346-
override OMPFLAGS = # disable OpenMP MT when using hipcc #802
347-
else ifneq ($(shell $(CXX) --version | egrep '^Intel'),)
348-
override OMPFLAGS = -fopenmp
349-
###override OMPFLAGS = # disable OpenMP MT on Intel (was ok without GPUCC but not ok with GPUCC before #578)
350-
else ifneq ($(shell $(CXX) --version | egrep '^(clang)'),)
351-
override OMPFLAGS = -fopenmp
352-
###override OMPFLAGS = # disable OpenMP MT on clang (was not ok without or with nvcc before #578)
353-
###else ifneq ($(shell $(CXX) --version | egrep '^(Apple clang)'),) # AV for Mac (Apple clang compiler)
354-
else ifeq ($(UNAME_S),Darwin) # OM for Mac (any compiler)
355-
override OMPFLAGS = # AV disable OpenMP MT on Apple clang (builds fail in the CI #578)
356-
###override OMPFLAGS = -fopenmp # OM reenable OpenMP MT on Apple clang? (AV Oct 2023: this still fails in the CI)
344+
# Disable OpenMP by default: enable OpenMP only if USEOPENMP=1 (#758)
345+
ifeq ($(USEOPENMP),1)
346+
###$(info USEOPENMP==1: will build with OpenMP if possible)
347+
ifneq ($(findstring hipcc,$(GPUCC)),)
348+
override OMPFLAGS = # disable OpenMP MT when using hipcc #802
349+
else ifneq ($(shell $(CXX) --version | egrep '^Intel'),)
350+
override OMPFLAGS = -fopenmp
351+
###override OMPFLAGS = # disable OpenMP MT on Intel (was ok without GPUCC but not ok with GPUCC before #578)
352+
else ifneq ($(shell $(CXX) --version | egrep '^clang version 16'),)
353+
###override OMPFLAGS = # disable OpenMP on clang16 #904
354+
$(error OpenMP is not supported by cudacpp on clang16 - issue #904)
355+
else ifneq ($(shell $(CXX) --version | egrep '^clang version 17'),)
356+
###override OMPFLAGS = # disable OpenMP on clang17 #904
357+
$(error OpenMP is not supported by cudacpp on clang17 - issue #904)
358+
else ifneq ($(shell $(CXX) --version | egrep '^(clang)'),)
359+
override OMPFLAGS = -fopenmp
360+
###override OMPFLAGS = # disable OpenMP MT on clang (was not ok without or with nvcc before #578)
361+
###else ifneq ($(shell $(CXX) --version | egrep '^(Apple clang)'),) # AV for Mac (Apple clang compiler)
362+
else ifeq ($(UNAME_S),Darwin) # OM for Mac (any compiler)
363+
override OMPFLAGS = # AV disable OpenMP MT on Apple clang (builds fail in the CI #578)
364+
###override OMPFLAGS = -fopenmp # OM reenable OpenMP MT on Apple clang? (AV Oct 2023: this still fails in the CI)
365+
else
366+
override OMPFLAGS = -fopenmp # enable OpenMP MT by default on all other platforms
367+
###override OMPFLAGS = # disable OpenMP MT on all other platforms (default before #575)
368+
endif
357369
else
358-
override OMPFLAGS = -fopenmp # enable OpenMP MT by default on all other platforms
359-
###override OMPFLAGS = # disable OpenMP MT on all other platforms (default before #575)
370+
###$(info USEOPENMP!=1: will build without OpenMP)
371+
override OMPFLAGS =
360372
endif
361373

362374
#-------------------------------------------------------------------------------

epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT/MadtRex/makefiles/cudacpp_runner.mk

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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 =
204216
endif
205217

206218
#-------------------------------------------------------------------------------
@@ -521,12 +533,12 @@ processid_short=$(shell basename $(CURDIR) | awk -F_ '{print $$(NF-1)"_"$$NF}')
521533
###$(info processid_short=$(processid_short))
522534

523535
MG5AMC_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
525537
cxx_objects_exe=$(BUILDDIR)/CommonRandomNumberKernel_cpp.o $(BUILDDIR)/RamboSamplingKernels_cpp.o
526538

527539
ifneq ($(GPUCC),)
528540
MG5AMC_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
530542
gpu_objects_exe=$(BUILDDIR)/CommonRandomNumberKernel_$(GPUSUFFIX).o $(BUILDDIR)/RamboSamplingKernels_$(GPUSUFFIX).o
531543
endif
532544

0 commit comments

Comments
 (0)