Add OpenMP makefile that targets CPUs and GPUs, with common defaults.
This commit is contained in:
parent
1d4b809b44
commit
436c3899c7
29
OpenMP.make
Normal file
29
OpenMP.make
Normal 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 $@
|
||||
|
||||
Loading…
Reference in New Issue
Block a user