-
Notifications
You must be signed in to change notification settings - Fork 302
/
Makefile
54 lines (42 loc) · 1.43 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
ifneq ("$(wildcard /usr/bin/nvcc)", "")
CUDAPATH ?= /usr
else ifneq ("$(wildcard /usr/local/cuda/bin/nvcc)", "")
CUDAPATH ?= /usr/local/cuda
endif
IS_JETSON ?= $(shell if grep -Fwq "Jetson" /proc/device-tree/model 2>/dev/null; then echo true; else echo false; fi)
NVCC := ${CUDAPATH}/bin/nvcc
CCPATH ?=
override CFLAGS ?=
override CFLAGS += -O3
override CFLAGS += -Wno-unused-result
override CFLAGS += -I${CUDAPATH}/include
override CFLAGS += -std=c++11
override CFLAGS += -DIS_JETSON=${IS_JETSON}
override LDFLAGS ?=
override LDFLAGS += -lcuda
override LDFLAGS += -L${CUDAPATH}/lib64
override LDFLAGS += -L${CUDAPATH}/lib64/stubs
override LDFLAGS += -L${CUDAPATH}/lib
override LDFLAGS += -L${CUDAPATH}/lib/stubs
override LDFLAGS += -Wl,-rpath=${CUDAPATH}/lib64
override LDFLAGS += -Wl,-rpath=${CUDAPATH}/lib
override LDFLAGS += -lcublas
override LDFLAGS += -lcudart
COMPUTE ?= 50
CUDA_VERSION ?= 11.8.0
IMAGE_DISTRO ?= ubi8
override NVCCFLAGS ?=
override NVCCFLAGS += -I${CUDAPATH}/include
override NVCCFLAGS += -arch=compute_$(subst .,,${COMPUTE})
IMAGE_NAME ?= gpu-burn
.PHONY: clean
gpu_burn: gpu_burn-drv.o compare.ptx
g++ -o $@ $< -O3 ${LDFLAGS}
%.o: %.cpp
g++ ${CFLAGS} -c $<
%.ptx: %.cu
PATH="${PATH}:${CCPATH}:." ${NVCC} ${NVCCFLAGS} -ptx $< -o $@
clean:
$(RM) *.ptx *.o gpu_burn
image:
docker build --build-arg CUDA_VERSION=${CUDA_VERSION} --build-arg IMAGE_DISTRO=${IMAGE_DISTRO} -t ${IMAGE_NAME} .