-
-
Notifications
You must be signed in to change notification settings - Fork 255
/
Makefile
48 lines (38 loc) · 1.58 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
CC=g++
LD=ld
CXXFLAGS=-Wall -std=c++11 -g -O
NVCC=nvcc
cpu_arch=$(shell uname -m)
ifeq ($(cpu_arch), aarch64) # Jetson
chip_id=$(shell cat /sys/module/tegra_fuse/parameters/tegra_chip_id)
ifeq ($(chip_id), 33) # Nano and TX1
compute=53
else ifeq ($(chip_id), 24) # TX2
compute=62
else ifeq ($(chip_id), 25) # AGX Xavier and Xavier NX
compute=72
else
$(error Cannot determine cuda compute automatically, so please modify Makefile manually)
endif
else ifeq ($(cpu_arch), x86_64) # x86_64 PC
$(warning "compute=75" is for GeForce RTX-2080 Ti. Please make sure CUDA compute is set correctly for your system in the Makefile.)
compute=75
else
$(error Unkown CPU architecture: neither "aarch" nor "x86_64")
endif
NVCCFLAGS=-m64 -gencode arch=compute_$(compute),code=sm_$(compute) \
-gencode arch=compute_$(compute),code=compute_$(compute)
# These are the directories where I installed TensorRT on my x86_64 PC.
TENSORRT_INCS=-I"/usr/include/x86_64-linux-gnu"
TENSORRT_LIBS=-L"/usr/lib/x86_64-linux-gnu"
# INCS and LIBS
INCS=-I"/usr/local/cuda/include" $(TENSORRT_INCS) -I"/usr/local/include" -I"plugin"
LIBS=-L"/usr/local/cuda/lib64" $(TENSORRT_LIBS) -L"/usr/local/lib" -Wl,--start-group -lnvinfer -lnvparsers -lnvinfer_plugin -lcudnn -lcublas -lcudart_static -lnvToolsExt -lcudart -lrt -ldl -lpthread -Wl,--end-group
.PHONY: all clean
all: libyolo_layer.so
clean:
rm -f *.so *.o
libyolo_layer.so: yolo_layer.o
$(CC) -shared -o $@ $< $(LIBS)
yolo_layer.o: yolo_layer.cu yolo_layer.h
$(NVCC) -ccbin $(CC) $(INCS) $(NVCCFLAGS) -Xcompiler -fPIC -c -o $@ $<