-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (77 loc) · 3.61 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
CUDA_PATH ?= /usr/local/cuda
BUILD_DIR := ./build
SRCDIR := ./src
CXX := g++
NVCC := $(CUDA_PATH)/bin/nvcc
USE_DLA_STANDALONE_MODE := 1
ALL_CCFLAGS += --std=c++17 -Wno-deprecated-declarations -Wall -fopenmp
ifeq ($(USE_DLA_STANDALONE_MODE),1)
ALL_CCFLAGS += -DUSE_DLA_STANDALONE_MODE
ifeq ($(USE_DETERMINISTIC_SEMAPHORE),1)
ALL_CCFLAGS += -DUSE_DETERMINISTIC_SEMAPHORE
endif
endif
ifeq ($(DEBUG),1)
ALL_CCFLAGS += -g
else
ALL_CCFLAGS += -O3
endif
NVCC_FLAGS := -gencode arch=compute_87,code=sm_87
OPENCV_INCLUDE_PATH ?= /usr/include/opencv4/
OPENCV_LIB_PATH ?= /usr/lib/aarch64-linux-gnu/
INCLUDES += -I $(CUDA_PATH)/include \
-I $(OPENCV_INCLUDE_PATH) \
-I /usr/include/jsoncpp/ \
-I /usr/include \
-I /home/autoware/develop/nvsci_headers
LIBRARIES += -l cudla -L$(CUDA_PATH)/lib64 \
-l cuda -l cudart -l nvinfer \
-L $(OPENCV_LIB_PATH) \
-l pthread \
-l opencv_objdetect -l opencv_highgui -l opencv_imgproc -l opencv_core -l opencv_imgcodecs -l opencv_dnn \
-l jsoncpp \
-L /usr/lib/aarch64-linux-gnu/nvidia/ -lnvscibuf \
-L /usr/lib/aarch64-linux-gnu/nvidia/ -lnvscisync
CXXSRCS := $(wildcard $(SRCDIR)/*.cc)
CXXOBJS := $(patsubst %.cc,$(BUILD_DIR)/%.o,$(notdir $(CXXSRCS)))
NVCCSRCS := $(wildcard $(SRCDIR)/*.cu)
NVCCOBJS := $(patsubst %.cu,$(BUILD_DIR)/%.o,$(notdir $(NVCCSRCS)))
all: cudla_yoloxp
$(BUILD_DIR)/%.o: $(SRCDIR)/%.cc | $(BUILD_DIR)
$(CXX) $(INCLUDES) $(ALL_CCFLAGS) -c -o $@ $<
@echo "Compiled cxx object file: $@ from $<"
$(BUILD_DIR)/%.o: $(SRCDIR)/%.cu | $(BUILD_DIR)
$(NVCC) $(INCLUDES) $(NVCC_FLAGS) -c -o $@ $<
@echo "Compiled nvcc object file: $@"
cudla_yoloxp: $(NVCCOBJS) $(CXXOBJS) | $(BUILD_DIR)
$(CXX) $(ALL_CCFLAGS) $(INCLUDES) $(ALL_LDFLAGS) -o $(BUILD_DIR)/$@ $+ $(LIBRARIES)
run_fp16: cudla_yoloxp
./$(BUILD_DIR)/cudla_yoloxp --engine ./data/loadable/yoloxp.fp16.fp16chwin.fp16chwout.standalone.bin --image /home/autoware/develop/cudla_dev/data/evaluation_dataset_v1/JPEGImages --backend cudla_fp16
run_int8: cudla_yoloxp
./$(BUILD_DIR)/cudla_yoloxp --engine ./data/loadable/yoloxp.int8.int8chwin.fp16chwout.standalone.bin --image /home/autoware/develop/cudla_dev/data/evaluation_dataset_v1/JPEGImages --backend cudla_int8
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
clean:
rm -f $(BUILD_DIR)/*
# export LD_LIBRARY_PATH=./src/matx_reformat/build/:$(OPENCV_LIB_PATH):$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$(OPENCV_LIB_PATH):$LD_LIBRARY_PATH