Add help messages to OpenMP.make and refactor
This commit is contained in:
parent
8fee86a232
commit
1aec057e48
49
OpenMP.make
49
OpenMP.make
@ -1,52 +1,57 @@
|
|||||||
|
|
||||||
ifndef COMPILER
|
ifndef COMPILER
|
||||||
$(info Define a compiler to set common defaults, i.e make COMPILER=GNU)
|
define compiler_help
|
||||||
|
Set COMPILER to change flags (defaulting to GNU).
|
||||||
|
Available compilers are:
|
||||||
|
CLANG CRAY GNU INTEL
|
||||||
|
|
||||||
|
endef
|
||||||
|
$(info $(compiler_help))
|
||||||
|
COMPILER=GNU
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef TARGET
|
ifndef TARGET
|
||||||
$(info No target defined. Specify CPU or GPU. Defaulting to CPU)
|
define target_help
|
||||||
|
Set TARGET to change device (defaulting to CPU).
|
||||||
|
Available targets are:
|
||||||
|
CPU NVIDIA
|
||||||
|
|
||||||
|
endef
|
||||||
|
$(info $(target_help))
|
||||||
TARGET=CPU
|
TARGET=CPU
|
||||||
endif
|
endif
|
||||||
|
|
||||||
COMPILER_ = $(CXX)
|
|
||||||
COMPILER_GNU = g++
|
COMPILER_GNU = g++
|
||||||
COMPILER_INTEL = icpc
|
COMPILER_INTEL = icpc
|
||||||
COMPILER_CRAY = CC
|
COMPILER_CRAY = CC
|
||||||
COMPILER_CLANG = clang++
|
COMPILER_CLANG = clang++
|
||||||
CXX = $(COMPILER_$(COMPILER))
|
CXX = $(COMPILER_$(COMPILER))
|
||||||
|
|
||||||
FLAGS_ = -O3 -std=c++11
|
|
||||||
FLAGS_GNU = -O3 -std=c++11
|
FLAGS_GNU = -O3 -std=c++11
|
||||||
FLAGS_INTEL = -O3 -std=c++11 -xHOST
|
FLAGS_INTEL = -O3 -std=c++11 -xHOST
|
||||||
FLAGS_CRAY = -O3 -hstd=c++11
|
FLAGS_CRAY = -O3 -hstd=c++11
|
||||||
FLAGS_CLANG = -O3 -std=c++11
|
FLAGS_CLANG = -O3 -std=c++11
|
||||||
CXXFLAGS = $(FLAGS_$(COMPILER))
|
CXXFLAGS = $(FLAGS_$(COMPILER))
|
||||||
|
|
||||||
OMP_ =
|
# OpenMP flags for CPUs
|
||||||
OMP_GNU = -fopenmp
|
OMP_GNU_CPU = -fopenmp
|
||||||
OMP_INTEL = -qopenmp
|
OMP_INTEL_CPU = -qopenmp
|
||||||
OMP_CRAY =
|
OMP_CRAY_CPU =
|
||||||
OMP_CLANG = -fopenmp=libomp
|
OMP_CLANG_CPU = -fopenmp=libomp
|
||||||
OMP = $(OMP_$(COMPILER))
|
|
||||||
|
|
||||||
OMP_TARGET_ =
|
# OpenMP flags for NVIDIA
|
||||||
OMP_TARGET_GNU = -fopenmp
|
OMP_CRAY_NVIDIA = -DOMP_TARGET_GPU
|
||||||
OMP_TARGET_INTEL =
|
OMP_CLANG_NVIDIA = -DOMP_TARGET_GPU -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda
|
||||||
OMP_TARGET_CRAY =
|
|
||||||
OMP_TARGET_CLANG = -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda
|
|
||||||
OMP_TARGET = $(OMP_TARGET_$(COMPILER))
|
|
||||||
|
|
||||||
ifeq ($(TARGET), CPU)
|
ifndef OMP_$(COMPILER)_$(TARGET)
|
||||||
OMP = $(OMP_$(COMPILER))
|
$(error Targeting $(TARGET) with $(COMPILER) not supported)
|
||||||
else ifeq ($(TARGET), GPU)
|
|
||||||
OMP = $(OMP_TARGET_$(COMPILER))
|
|
||||||
OMP += -DOMP_TARGET_GPU
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OMP = $(OMP_$(COMPILER)_$(TARGET))
|
||||||
|
|
||||||
omp-stream: main.cpp OMPStream.cpp
|
omp-stream: main.cpp OMPStream.cpp
|
||||||
$(CXX) $(CXXFLAGS) -DOMP $^ $(OMP) $(EXTRA_FLAGS) -o $@
|
$(CXX) $(CXXFLAGS) -DOMP $^ $(OMP) $(EXTRA_FLAGS) -o $@
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f omp-stream
|
rm -f omp-stream
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user