-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
52 lines (40 loc) · 1.36 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
CUDA_V :=10.1
PGI_V :=19.10
CPP :=g++
NVCC :=/usr/local/cuda-$(CUDA_V)/bin/nvcc
PGI :=/opt/pgi/linux86-64-llvm/$(PGI_V)/bin/pgc++
CFLAGS :=-O3 -std=c++14
PGIFLAGS :=-V$(PGI_V) -acc -Mcuda:cuda$(CUDA_V) -Minfo=accel -ta=tesla:cc70 -ta=time
ARCHES :=-gencode arch=compute_70,code=\"compute_70,sm_70\"
LIBS :=-lopenblas -lcudart -lcublas
SRCDIR :=./src
OBJDIR :=obj
SOURCES := computeWorks_mm \
blas \
cublas \
cuda \
openacc \
openmp
OBJECTS=$(addprefix $(OBJDIR)/, $(SOURCES:%=%.o))
all: build computeWorks_mm
.PHONY: all
build:
@mkdir -p $(OBJDIR)
computeWorks_mm: $(OBJECTS)
$(PGI) $(PGIFLAGS) $(LIBS) $(OBJECTS) -o $@
$(OBJDIR)/computeWorks_mm.o: $(SRCDIR)/computeWorks_mm.cpp
$(NVCC) -x cu -ccbin $(CPP) $(CFLAGS) -c $^ -o $@
$(OBJDIR)/blas.o: $(SRCDIR)/blas.cpp
$(NVCC) -x cu -ccbin $(CPP) $(CFLAGS) -c $^ -o $@
$(OBJDIR)/cublas.o: $(SRCDIR)/cublas.cpp
$(NVCC) -x cu -ccbin $(CPP) -cudart=static $(CFLAGS) ${ARCHES} -c $^ -o $@ -lcublas
$(OBJDIR)/cuda.o: $(SRCDIR)/cuda.cu
$(NVCC) -ccbin $(CPP) -cudart=static $(CFLAGS) ${ARCHES} -c $^ -o $@
$(OBJDIR)/openacc.o: $(SRCDIR)/openacc.cpp
$(PGI) $(PGIFLAGS) $(CFLAGS) -c $^ -o $@
$(OBJDIR)/openmp.o: $(SRCDIR)/openmp.cpp
$(NVCC) -x cu -ccbin $(CPP) -Xcompiler -fopenmp -c $^ -o $@
clean:
@echo 'Cleaning up...'
@echo 'rm -rf $(SOURCES) $(OBJDIR)/*.o'
@rm -rf $(SOURCES) $(OBJDIR)/*.o