From 436c3899c777c7712aff16efa47e8cd2ff40561b Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Thu, 23 Feb 2017 15:10:23 +0000 Subject: [PATCH] Add OpenMP makefile that targets CPUs and GPUs, with common defaults. --- OpenMP.make | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 OpenMP.make diff --git a/OpenMP.make b/OpenMP.make new file mode 100644 index 0000000..115c678 --- /dev/null +++ b/OpenMP.make @@ -0,0 +1,29 @@ + +ifndef COMPILER +$(info Define a compiler to set common defaults, i.e make COMPILER=GNU) +endif + +COMPILER_ = $(CXX) +COMPILER_GNU = g++ +COMPILER_INTEL = icpc +COMPILER_CRAY = CC +CC = $(COMPILER_$(COMPILER)) + +FLAGS_ = -O3 +FLAGS_GNU = -O3 -std=c++11 +FLAGS_INTEL = -O3 -std=c++11 +FLAGS_CRAY = -O3 -hstd=c++11 +CFLAGS = $(FLAGS_$(COMPILER)) + +OMP_ = +OMP_GNU = -fopenmp +OMP_INTEL = -qopenmp +OMP_CRAY = +OMP = $(OMP_$(COMPILER)) + +omp-stream: main.cpp OMPStream.cpp + $(CC) -O3 -std=c++11 -DOMP $^ $(OMP) -o $@ + +omp-target-stream: main.cpp OMPStream.cpp + $(CC) -O3 -std=c++11 -DOMP -DOMP_TARGET_GPU $^ $(OMP) -o $@ +