-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.single
31 lines (22 loc) · 1.12 KB
/
Makefile.single
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
# When building a library with CUDA code we should support diverse scenarios,
# where the CUDA code in the library may be used by:
# - host code in the library itself (i.e. a kernel defined and used within the library)
# - host code in a user program or library (i.e. a kernel defined in the library)
# - CUDA code in a user program or library (i.e. __device__ code in the library)
.PHONY: all clean
BUILD:=build$(suffix $(word 1, $(MAKEFILE_LIST)))
CUDA_BASE=/usr/local/cuda-9.2
CUDA_ARCH=sm_35 sm_50 sm_61
CUDA_CXXFLAGS=$(foreach ARCH,$(CUDA_ARCH),-gencode arch=$(ARCH:sm_%=compute_%),code=$(ARCH))
HOST_CXX=g++
HOST_CXXFLAGS=-fPIC -Wall
CXXFLAGS=-std=c++14 -O2 -I$(CUDA_BASE)/include -I.
CUDA_LDFLAGS=-L$(CUDA_BASE)/lib64/stubs -L$(CUDA_BASE)/lib64 -lcudadevrt -lcudart -lrt -lpthread -ldl
all: $(BUILD)/app
echo ./$(BUILD)/app
clean:
rm -rf $(BUILD)
$(BUILD)/app: particle/particle.cu particle/v3.cu propagate/propagate.cu main.cc
@mkdir -p $(dir $@)
# call the host linker to build the executable
cat $^ | $(CUDA_BASE)/bin/nvcc -x cu $(CXXFLAGS) $(CUDA_CXXFLAGS) -ccbin $(HOST_CXX) -Xcompiler '$(HOST_CXXFLAGS)' - -o $@