forked from NVIDIA/thrust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
164 lines (130 loc) · 4.86 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Copyright 2010-2020 NVIDIA Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Makefile for building Thrust unit test driver
# Force C++11 mode. NVCC will ignore it if the host compiler doesn't support it.
export CXX_STD := c++11
export CCCL_ENABLE_DEPRECATIONS := 1
export VERBOSE := 1
ifndef PROFILE
ifdef VULCAN_TOOLKIT_BASE
include $(VULCAN_TOOLKIT_BASE)/build/getprofile.mk
include $(VULCAN_TOOLKIT_BASE)/build/config/$(PROFILE).mk
else
include ../build/getprofile.mk
include ../build/config/$(PROFILE).mk
endif
endif
SOLNDIR := .
ifdef VULCAN_TOOLKIT_BASE
include $(VULCAN_TOOLKIT_BASE)/build/config/DetectOS.mk
else
include ../build/config/DetectOS.mk
endif
TMP_DIR := built
TMP_PREFIX := $(ROOTDIR)
TMP_ARCH := $(ARCH)_$(PROFILE)_agnostic
THRUST_MKDIR := $(TMP_PREFIX)/$(TMP_DIR)/$(TMP_ARCH)/thrust/mk
THRUST_DIR := $(ROOTDIR)/thrust
res:=$(shell $(PYTHON) ./generate_mk.py $(THRUST_MKDIR) $(THRUST_DIR))
# Use these environment variables to control what gets built:
#
# TEST_ALL
# TEST_UNITTESTS
# TEST_EXAMPLES
# TEST_BENCH
# TEST_OTHER
ifneq ($(TEST_ALL),)
override TEST_UNITTESTS := 1
override TEST_EXAMPLES := 1
override TEST_BENCH := 1
override TEST_OTHER := 1
endif
ifeq ($(TEST_UNITTESTS)$(TEST_EXAMPLES)$(TEST_BENCH)$(TEST_OTHER),)
override TEST_UNITTESTS := 1
override TEST_EXAMPLES := 1
override TEST_BENCH := 1
override TEST_OTHER := 1
endif
ifneq ($(TEST_OTHER),)
PROJECTS += internal/build/warningstester
endif
ifneq ($(TEST_BENCH),)
PROJECTS += internal/benchmark/bench
endif
ifneq ($(TEST_UNITTESTS),)
# copy existing projects
PROJECTS_COPY := $(PROJECTS)
# empty PROJECTS
PROJECTS :=
# populate PROJECTS with unit tests.
include $(THRUST_MKDIR)/testing.mk
# Once PROJECTS is populated with unit tests, re-add the previous projects.
PROJECTS += $(PROJECTS_COPY)
endif
ifneq ($(TEST_EXAMPLES),)
# Copy existing projects.
PROJECTS_COPY := $(PROJECTS)
# Empty PROJECTS.
PROJECTS :=
# Populate PROJECTS with examples.
include $(THRUST_MKDIR)/examples.mk
# Once PROJECTS is populated with examples, re-add the previous projects.
PROJECTS += $(PROJECTS_COPY)
endif
ifdef VULCAN_TOOLKIT_BASE
include $(VULCAN_TOOLKIT_BASE)/build/common.mk
else
include ../build/common.mk
endif
ifeq ($(OS), win32)
CREATE_DVS_PACKAGE = $(ZIP) -r built/CUDA-thrust-package.zip bin thrust/internal/test thrust/internal/scripts thrust/internal/benchmark $(DVS_COMMON_TEST_PACKAGE_FILES)
APPEND_H_DVS_PACKAGE = $(ZIP) -rg built/CUDA-thrust-package.zip thrust -9 -i *.h
APPEND_INL_DVS_PACKAGE = $(ZIP) -rg built/CUDA-thrust-package.zip thrust -9 -i *.inl
APPEND_CUH_DVS_PACKAGE = $(ZIP) -rg built/CUDA-thrust-package.zip thrust -9 -i *.cuh
MAKE_DVS_PACKAGE = $(CREATE_DVS_PACKAGE) && $(APPEND_H_DVS_PACKAGE) && $(APPEND_INL_DVS_PACKAGE) && $(APPEND_CUH_DVS_PACKAGE)
else
CREATE_DVS_PACKAGE = tar -cvh -f built/CUDA-thrust-package.tar bin thrust/internal/test thrust/internal/scripts thrust/internal/benchmark $(DVS_COMMON_TEST_PACKAGE_FILES)
APPEND_H_DVS_PACKAGE = find -L thrust -name "*.h" | xargs tar rvf built/CUDA-thrust-package.tar
APPEND_INL_DVS_PACKAGE = find -L thrust -name "*.inl" | xargs tar rvf built/CUDA-thrust-package.tar
APPEND_CUH_DVS_PACKAGE = find -L thrust -name "*.cuh" | xargs tar rvf built/CUDA-thrust-package.tar
COMPRESS_DVS_PACKAGE = bzip2 --force built/CUDA-thrust-package.tar
MAKE_DVS_PACKAGE = $(CREATE_DVS_PACKAGE) && $(APPEND_H_DVS_PACKAGE) && $(APPEND_INL_DVS_PACKAGE) && $(APPEND_CUH_DVS_PACKAGE) && $(COMPRESS_DVS_PACKAGE)
endif
COPY_CUB_FOR_PACKAGING = rm -rf cub && cp -r ../cub/cub cub
DVS_OPTIONS :=
ifneq ($(TARGET_ARCH),$(HOST_ARCH))
DVS_OPTIONS += TARGET_ARCH=$(TARGET_ARCH)
endif
ifeq ($(TARGET_ARCH),ARMv7)
DVS_OPTIONS += ABITYPE=$(ABITYPE)
endif
THRUST_DVS_BUILD = release
pack:
$(COPY_CUB_FOR_PACKAGING)
cd .. && $(MAKE_DVS_PACKAGE)
dvs:
$(COPY_CUB_FOR_PACKAGING)
# Build the CUDA Runtime in GVS, because GVS has no CUDA Runtime component.
# This is a temporary workaround until the Tegra team adds a CUDA Runtime
# component, which they have promised to do.
ifdef GVS
$(MAKE) $(DVS_OPTIONS) -s -C ../cuda $(THRUST_DVS_BUILD)
endif
$(MAKE) $(DVS_OPTIONS) $(THRUST_DVS_BUILD) THRUST_DVS=1
cd .. && $(MAKE_DVS_PACKAGE)
dvs_release:
$(MAKE) dvs THRUST_DVS_BUILD=release
dvs_debug:
$(MAKE) dvs THRUST_DVS_BUILD=debug
include $(THRUST_MKDIR)/dependencies.mk