Skip to content

Commit

Permalink
[fpe] in CODEGEN cudacpp.mk, add the option to build without OpenMP i…
Browse files Browse the repository at this point in the history
…f OMPFLAGS is set externally to an empty string (madgraph5#758)
  • Loading branch information
valassi committed Jun 28, 2024
1 parent b3046e1 commit cb67911
Showing 1 changed file with 29 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,22 +369,36 @@ endif

#=== Configure defaults for OMPFLAGS

# Set the default OMPFLAGS choice
ifneq ($(findstring hipcc,$(GPUCC)),)
override OMPFLAGS = # disable OpenMP MT when using hipcc #802
else ifneq ($(shell $(CXX) --version | egrep '^Intel'),)
override OMPFLAGS = -fopenmp
###override OMPFLAGS = # disable OpenMP MT on Intel (was ok without GPUCC but not ok with GPUCC before #578)
else ifneq ($(shell $(CXX) --version | egrep '^(clang)'),)
override OMPFLAGS = -fopenmp
###override OMPFLAGS = # disable OpenMP MT on clang (was not ok without or with nvcc before #578)
###else ifneq ($(shell $(CXX) --version | egrep '^(Apple clang)'),) # AV for Mac (Apple clang compiler)
else ifeq ($(UNAME_S),Darwin) # OM for Mac (any compiler)
override OMPFLAGS = # AV disable OpenMP MT on Apple clang (builds fail in the CI #578)
###override OMPFLAGS = -fopenmp # OM reenable OpenMP MT on Apple clang? (AV Oct 2023: this still fails in the CI)
# To build without OpenMP, you must set externally OMPFLAGS to an empty string (#758)
ifeq ($(origin OMPFLAGS),undefined)
###$(info OMPFLAGS was not set externally: will override it to a default value)
override override_OMPFLAGS=true
else ifeq ($(OMPFLAGS),)
$(info OMPFLAGS was set externally to an empty string: will build without OpenMP)
override override_OMPFLAGS=false
else
override OMPFLAGS = -fopenmp # enable OpenMP MT by default on all other platforms
###override OMPFLAGS = # disable OpenMP MT on all other platforms (default before #575)
###$(info OMPFLAGS was set externally to a non-empty string: will override it to a default value)
override override_OMPFLAGS=true
endif

# Set the default OMPFLAGS choice
ifeq ($(override_OMPFLAGS),true)
ifneq ($(findstring hipcc,$(GPUCC)),)
override OMPFLAGS = # disable OpenMP MT when using hipcc #802
else ifneq ($(shell $(CXX) --version | egrep '^Intel'),)
override OMPFLAGS = -fopenmp
###override OMPFLAGS = # disable OpenMP MT on Intel (was ok without GPUCC but not ok with GPUCC before #578)
else ifneq ($(shell $(CXX) --version | egrep '^(clang)'),)
override OMPFLAGS = -fopenmp
###override OMPFLAGS = # disable OpenMP MT on clang (was not ok without or with nvcc before #578)
###else ifneq ($(shell $(CXX) --version | egrep '^(Apple clang)'),) # AV for Mac (Apple clang compiler)
else ifeq ($(UNAME_S),Darwin) # OM for Mac (any compiler)
override OMPFLAGS = # AV disable OpenMP MT on Apple clang (builds fail in the CI #578)
###override OMPFLAGS = -fopenmp # OM reenable OpenMP MT on Apple clang? (AV Oct 2023: this still fails in the CI)
else
override OMPFLAGS = -fopenmp # enable OpenMP MT by default on all other platforms
###override OMPFLAGS = # disable OpenMP MT on all other platforms (default before #575)
endif
endif

#-------------------------------------------------------------------------------
Expand Down

0 comments on commit cb67911

Please sign in to comment.