forked from jefflarkin/openacc-interoperability
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
68 lines (57 loc) · 1.42 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
EXES=cuda_main openacc_c_main openacc_c_cublas thrust cuda_map
ifeq "$(PE_ENV)" "CRAY"
# Cray Compiler
CXX=CC
CXXFLAGS=-hlist=a
CC=cc
CFLAGS=-hlist=a
CUDAC=nvcc
CUDAFLAGS=
FC=ftn
FFLAGS=-ra
LDFLAGS=-L$(CUDA_HOME)/lib64 -lcudart
else
# PGI Compiler
EXES+=cuf_main cuf_openacc_main openacc_cublas
CXX=pgCC
CXXFLAGS=-fast -acc -ta=nvidia -Minfo=accel
CC=pgcc
CFLAGS=-fast -acc -ta=nvidia -Minfo=accel
CUDAC=nvcc
CUDAFLAGS=
FC=pgfortran
FFLAGS=-fast -acc -ta=nvidia -Minfo=accel
LDFLAGS=-L$(CUDA_HOME)/lib64 -lcudart -Mcuda
endif
all: $(EXES)
openacc_cublas: openacc_cublas.o
$(FC) -o $@ $(CFLAGS) $^ $(LDFLAGS) -lcublas
openacc_c_cublas: openacc_c_cublas.o
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) -lcublas
openacc_c_main: saxpy_cuda.o openacc_c_main.o
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS)
cuda_main: saxpy_openacc_c.o cuda_main.o
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS)
cuf_main: cuf_main.o
$(FC) -o $@ $(FFLAGS) $^ $(LDFLAGS)
cuf_openacc_main: kernels.o openacc_main.o
$(FC) -o $@ $(FFLAGS) $^ $(LDFLAGS)
thrust: saxpy_openacc_c.o thrust.o
$(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) -lstdc++
cuda_map: saxpy_openacc_c_mapped.o cuda_map.o
$(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS)
.SUFFIXES:
.SUFFIXES: .c .o .f90 .cu .cpp .cuf
.c.o:
$(CC) $(CFLAGS) -c $<
.cpp.o:
$(CXX) $(CXXFLAGS) -c $<
.f90.o:
$(FC) $(FFLAGS) -c $<
.cuf.o:
$(FC) $(FFLAGS) -c $<
.cu.o:
$(CUDAC) $(CUDAFLAGS) -c $<
.PHONY: clean
clean:
rm -rf *.o *.ptx *.cub *.lst *.mod $(EXES)