mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2025-04-12 20:38:31 +08:00
Merge ffbeb84dfa
into 9c688d7ff7
This commit is contained in:
commit
ea54a9097b
|
@ -305,13 +305,24 @@ LIBRARIES :=
|
|||
# Attempt to compile a minimal OpenMP application. If a.out exists, OpenMP is properly set up.
|
||||
ifneq (,$(filter $(TARGET_OS),linux android))
|
||||
|
||||
# Special treatment for Clang to not use standard OMP Library and fix OMP 5 bug in Clang 13
|
||||
ifneq (,$(findstring "clang",$(HOST_COMPILER)))
|
||||
ifneq (,$(filter $(TARGET_OS), android))
|
||||
LIBRARIES += -lomp
|
||||
else
|
||||
LIBRARIES += -lgomp
|
||||
endif
|
||||
|
||||
ALL_CCFLAGS += -Xcompiler -fopenmp
|
||||
else
|
||||
ALL_CCFLAGS += -Xcompiler -fopenmp
|
||||
ALL_LDFLAGS += -Xcompiler -fopenmp
|
||||
COMPILER_VERSION= $(shell $(HOST_COMPILER) --version)
|
||||
ifneq (,$(findstring 13.,$(COMPILER_VERSION)))
|
||||
ALL_CCFLAGS += -Xcompiler -fopenmp -Xcompiler -fopenmp-version=45
|
||||
ALL_LDFLAGS += -Xcompiler -fopenmp -Xcompiler -fopenmp-version=45
|
||||
endif
|
||||
endif
|
||||
|
||||
$(shell echo "#include <omp.h>" > test.c ; echo "int main() { omp_get_num_threads(); return 0; }" >> test.c ; $(HOST_COMPILER) -fopenmp test.c)
|
||||
OPENMP ?= $(shell find a.out 2>/dev/null)
|
||||
|
||||
|
|
|
@ -311,13 +311,25 @@ LIBRARIES :=
|
|||
# Attempt to compile a minimal OpenMP application. If a.out exists, OpenMP is properly set up.
|
||||
ifneq (,$(filter $(TARGET_OS),linux android))
|
||||
|
||||
|
||||
# Special treatment for Clang to not use standard OMP Library and fix OMP 5 bug in Clang 13
|
||||
ifneq (,$(findstring "clang",$(HOST_COMPILER)))
|
||||
ifneq (,$(filter $(TARGET_OS), android))
|
||||
LIBRARIES += -lomp
|
||||
else
|
||||
LIBRARIES += -lgomp
|
||||
endif
|
||||
|
||||
ALL_CCFLAGS += -Xcompiler -fopenmp
|
||||
else
|
||||
ALL_CCFLAGS += -Xcompiler -fopenmp
|
||||
ALL_LDFLAGS += -Xcompiler -fopenmp
|
||||
COMPILER_VERSION= $(shell $(HOST_COMPILER) --version)
|
||||
ifneq (,$(findstring 13.,$(COMPILER_VERSION)))
|
||||
ALL_CCFLAGS += -Xcompiler -fopenmp -Xcompiler -fopenmp-version=45
|
||||
ALL_LDFLAGS += -Xcompiler -fopenmp -Xcompiler -fopenmp-version=45
|
||||
endif
|
||||
endif
|
||||
|
||||
$(shell echo "#include <omp.h>" > test.c ; echo "int main() { omp_get_num_threads(); return 0; }" >> test.c ; $(HOST_COMPILER) -fopenmp test.c)
|
||||
OPENMP ?= $(shell find a.out 2>/dev/null)
|
||||
|
||||
|
|
|
@ -168,6 +168,10 @@ NVCCFLAGS := -m${TARGET_SIZE}
|
|||
CCFLAGS :=
|
||||
LDFLAGS :=
|
||||
|
||||
# Special treatment for Clang
|
||||
ifneq (,$(findstring clang,$(HOST_COMPILER)))
|
||||
CCFLAGS+= -fPIE
|
||||
endif
|
||||
# build flags
|
||||
|
||||
# Link flag for customized HOST_COMPILER with gcc realpath
|
||||
|
|
Loading…
Reference in New Issue
Block a user