Add OpenMP makefile that targets CPUs and GPUs, with common defaults.

This commit is contained in:
Tom Deakin 2017-02-23 15:10:23 +00:00
parent 1d4b809b44
commit 436c3899c7

29
OpenMP.make Normal file
View File

@ -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 $@