-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 838 Bytes
/
Makefile
File metadata and controls
44 lines (34 loc) · 838 Bytes
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
# cuda compiler
NVCC = nvcc
# compile options
NVCCFLAGS = -Xcompiler "-fopenmp" -Xcompiler -Wall -rdc=true -lmpi
# C compiler
CC = g++
# compile options
CFLAGS = -Wall -O3 -std=c++11 -fopenmp -lm
# MPI compiler
MPICC = mpicc
# MPI compile options
MPICFLAGS = -Wall -O3 -fopenmp
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda11/lib64
# link options
LDFLAGS = -L/usr/local/cuda/lib64 -lcudart -lcudadevrt
# source files
CFILES = $(wildcard *.c)
CUFILES = $(wildcard *.cu)
OBJECTS = $(CFILES:.c=.o) $(CUFILES:.cu=.o)
EXECUTABLE = mymoc
# target
all:
$(NVCC) -c $(NVCCFLAGS) $(INCLUDES) $(CUFILES)
$(NVCC) -c $(NVCCFLAGS) $(INCLUDES) $(CFILES)
$(NVCC) $(NVCCFLAGS) $(LDFLAGS) $(OBJECTS) -o $(EXECUTABLE)
# clean
clean:
rm -f ./*.o
rm -f $(EXECUTABLE)
# rebuild
rebuild:
@make clean
@make all
.PHONY: all clean rebuild