Skip to content

Commit 7dfed7e

Browse files
committed
move from sourceforge net
1 parent 2a715bf commit 7dfed7e

File tree

269 files changed

+117120
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+117120
-0
lines changed

ridge_detection/cpu_common.mk

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# @file cpu_common.mk
2+
# @author Adam Rogowiec
3+
#
4+
# This file is an integral part of the master thesis entitled:
5+
# "Elaboration and implementation in CUDA technology parallel version of
6+
# estimation of multidimensional random variable density function ridge
7+
# detection algorithm.",
8+
# which is supervised by prof. dr hab. inż. Marek Nałęcz.
9+
#
10+
# Institute of Control and Computation Engineering
11+
# Faculty of Electronics and Information Technology
12+
# Warsaw University of Technology 2016
13+
#
14+
15+
#-------------------------------------------------------------------------------
16+
# Commandline Options
17+
#-------------------------------------------------------------------------------
18+
19+
# [debug=<0|1>] Generate debug mode code
20+
ifeq ($(debug), 1)
21+
CCFLAGS += -g3 -ggdb3 -Og
22+
DEFINES += -DRD_DEBUG
23+
BUILD_SUFFIX = dbg
24+
else
25+
CCFLAGS += -O3
26+
LDFLAGS += -O3
27+
BUILD_SUFFIX = release
28+
endif
29+
30+
# [omp=<0|1>] use openmp
31+
ifeq ($(omp), 1)
32+
CCFLAGS += -fopenmp
33+
LDFLAGS += -fopenmp
34+
DEFINES += -DRD_USE_OPENMP
35+
OPENMP_SUFFIX = omp
36+
else
37+
OPENMP_SUFFIX = noomp
38+
endif
39+
40+
# [profile=<0|1>] profile
41+
ifeq ($(profile), 1)
42+
DEFINES += -DRD_PROFILE
43+
BUILD_SUFFIX = prof
44+
endif
45+
46+
CC := /usr/bin/g++-5
47+
CCFLAGS += -std=c++11 -Wall -Wextra
48+
LDFLAGS += -std=c++11 -Wall -Wextra
49+
50+
CPU_ARCH = x86_64
51+
BIN_SUFFIX = $(CPU_ARCH)_$(OPENMP_SUFFIX)_$(BUILD_SUFFIX)
52+
53+
#-------------------------------------------------------------------------------
54+
# Include/library directories and libraries variables
55+
#-------------------------------------------------------------------------------
56+
57+
BASE_DIR = $(dir $(lastword $(MAKEFILE_LIST)))
58+
RD_DIR = $(BASE_DIR)rd
59+
VIS_DIR = $(BASE_DIR)vis
60+
61+
INC =
62+
LIBS =
63+
64+
INC += -I $(BASE_DIR) -I $(BASE_DIR)third-party
65+
66+
67+
#-------------------------------------------------------------------------------
68+
# Dependency Lists
69+
#-------------------------------------------------------------------------------
70+
71+
72+
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
73+
74+
75+
RD_DEPS = $(call rwildcard, $(RD_DIR),*.hpp) \
76+
$(call rwildcard, $(RD_DIR),*.h) \
77+
$(call rwildcard, $(RD_DIR),*.inl)

ridge_detection/gpu_common.mk

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
#/******************************************************************************
2+
# * Copyright (c) 2011, Duane Merrill. All rights reserved.
3+
# * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved.
4+
# *
5+
# * Redistribution and use in source and binary forms, with or without
6+
# * modification, are permitted provided that the following conditions are met:
7+
# * * Redistributions of source code must retain the above copyright
8+
# * notice, this list of conditions and the following disclaimer.
9+
# * * Redistributions in binary form must reproduce the above copyright
10+
# * notice, this list of conditions and the following disclaimer in the
11+
# * documentation and/or other materials provided with the distribution.
12+
# * * Neither the name of the NVIDIA CORPORATION nor the
13+
# * names of its contributors may be used to endorse or promote products
14+
# * derived from this software without specific prior written permission.
15+
# *
16+
# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
# * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
# * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
# * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20+
# * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
# * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
# * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
# * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
# * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
# * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
# *
27+
#******************************************************************************/
28+
29+
#/***************************************************************************
30+
# * Author: Adam Rogowiec
31+
# * Modified for use in Master diploma project.
32+
# *
33+
# ***************************************************************************/
34+
35+
#-------------------------------------------------------------------------------
36+
# Commandline Options
37+
#-------------------------------------------------------------------------------
38+
39+
# [sm=<XXX,...>] Compute-capability to compile for, e.g., "sm=200,300,350" (SM35 by default).
40+
41+
COMMA = ,
42+
ifdef sm
43+
SM_ARCH = $(subst $(COMMA),-,$(sm))
44+
else
45+
SM_ARCH = 350
46+
endif
47+
48+
##
49+
## -gencode=arch=compute_52,code=\"sm_52,compute_52\"
50+
## means:
51+
## -gencode=arch=compute_52 - compile code for the vritual architecture 52,
52+
## -code=\"sm_52,compute_52\" - generate binary code for real sm_52 architecture and include
53+
## ptx code for virtual arch 52, for JIT compilation on
54+
## higer architectures
55+
##
56+
ifeq (520, $(findstring 520, $(SM_ARCH)))
57+
SM_TARGETS += -gencode=arch=compute_52,code=\"sm_52,compute_52\"
58+
SM_DEF += -DSM520
59+
TEST_ARCH = 520
60+
endif
61+
ifeq (500, $(findstring 500, $(SM_ARCH)))
62+
SM_TARGETS += -gencode=arch=compute_50,code=\"sm_50,compute_50\"
63+
SM_DEF += -DSM500
64+
TEST_ARCH = 500
65+
endif
66+
ifeq (370, $(findstring 370, $(SM_ARCH)))
67+
SM_TARGETS += -gencode=arch=compute_35,code=\"sm_37,compute_37\"
68+
SM_DEF += -DSM370
69+
TEST_ARCH = 370
70+
endif
71+
ifeq (350, $(findstring 350, $(SM_ARCH)))
72+
SM_TARGETS += -gencode=arch=compute_35,code=\"sm_35,compute_35\"
73+
SM_DEF += -DSM350
74+
TEST_ARCH = 350
75+
endif
76+
ifeq (300, $(findstring 300, $(SM_ARCH)))
77+
SM_TARGETS += -gencode=arch=compute_30,code=\"sm_30,compute_30\"
78+
SM_DEF += -DSM300
79+
TEST_ARCH = 300
80+
endif
81+
ifeq (210, $(findstring 210, $(SM_ARCH)))
82+
SM_TARGETS += -gencode=arch=compute_20,code=\"sm_21,compute_20\"
83+
SM_DEF += -DSM210
84+
TEST_ARCH = 210
85+
endif
86+
ifeq (200, $(findstring 200, $(SM_ARCH)))
87+
SM_TARGETS += -gencode=arch=compute_20,code=\"sm_20,compute_20\"
88+
SM_DEF += -DSM200
89+
TEST_ARCH = 200
90+
endif
91+
92+
93+
DEFINES += $(SM_DEF)
94+
95+
# [cdp=<0|1>] CDP enable option (default: no) ---> CUDA Dynamic Parallelism
96+
ifeq ($(cdp), 1)
97+
DEFINES += -DCUB_CDP
98+
NVCCFLAGS += -rdc=true -lcudadevrt
99+
CDP_SUFFIX += cdp
100+
else
101+
CDP_SUFFIX += nocdp
102+
endif
103+
104+
105+
# [force32=<0|1>] Device addressing mode option (64-bit device pointers by default)
106+
ifeq ($(force32), 1)
107+
CPU_ARCH = -m32
108+
CPU_ARCH_SUFFIX = i386
109+
else
110+
CPU_ARCH = -m64
111+
CPU_ARCH_SUFFIX = x86_64
112+
endif
113+
114+
115+
# [abi=<0|1>] CUDA ABI option (enabled by default)
116+
ifneq ($(abi), 0)
117+
ABI_SUFFIX = abi
118+
else
119+
NVCCFLAGS += -Xptxas -abi=no
120+
ABI_SUFFIX = noabi
121+
endif
122+
123+
124+
# [open64=<0|1>] Middle-end compiler option (nvvm by default)
125+
ifeq ($(open64), 1)
126+
NVCCFLAGS += -open64
127+
PTX_SUFFIX = open64
128+
else
129+
PTX_SUFFIX = nvvm
130+
endif
131+
132+
133+
# [verbose=<0|1|2>] Verbose toolchain output from nvcc option
134+
# and verbose kernel properties (regs, smem, cmem, etc.);
135+
ifeq ($(verbose), 1)
136+
NVCCFLAGS += -v
137+
else ifeq ($(verbose), 2)
138+
# NVCCFLAGS += -v -Xptxas -v
139+
NVCCFLAGS += -v --resource-usage
140+
endif
141+
142+
143+
# [keep=<0|1>] Keep intermediate compilation artifacts option
144+
# passing additionally --clean-targets or -clean will clean all files that would be otherwise created by given command
145+
ifeq ($(keep), 1)
146+
NVCCFLAGS += -keep
147+
endif
148+
149+
# [debug=<0|1|2>] Generate debug mode code
150+
ifeq ($(debug), 1)
151+
# -g - host debug informations
152+
# -g3 - host debug inf level 3(max)
153+
# -0g - host debug optimizations (recommended by gcc documentation)
154+
NVCCFLAGS += -G -g -Xcompiler -rdynamic -Xptxas -g -Xcompiler -g3 -Xcompiler -Og
155+
DEFINES += -DRD_DEBUG
156+
BUILD_SUFFIX = dbg1
157+
else ifeq ($(debug), 2)
158+
NVCCFLAGS += -g -lineinfo -Xcompiler -rdynamic -Xptxas -g -Xcompiler -g3 -Xcompiler -Og
159+
DEFINES += -DRD_DEBUG
160+
BUILD_SUFFIX = dbg2
161+
else
162+
NVCCFLAGS += -O3
163+
BUILD_SUFFIX = release
164+
endif
165+
166+
# [omp=<0|1>] use openmp
167+
ifeq ($(omp), 1)
168+
NVCCFLAGS += -Xcompiler -fopenmp
169+
DEFINES += -DRD_USE_OPENMP
170+
OPENMP_SUFFIX = omp
171+
else
172+
OPENMP_SUFFIX = noomp
173+
endif
174+
175+
# [profile=<0|1>] turn on profiling
176+
ifeq ($(profile), 1)
177+
DEFINES += -DRD_PROFILE
178+
NVCCFLAGS += -lineinfo
179+
LIBS += -lnvToolsExt
180+
BUILD_SUFFIX = prof
181+
endif
182+
183+
ifeq ($(cubin), 1)
184+
NVCCFLAGS += -Xptxas -preserve-relocs --nvlink-options -preserve-relocs -lineinfo
185+
endif
186+
#-------------------------------------------------------------------------------
187+
# Compiler and compilation platform
188+
#-------------------------------------------------------------------------------
189+
190+
NVCC = "$(shell which nvcc)"
191+
ifdef nvccver
192+
NVCC_VERSION = $(nvccver)
193+
else
194+
NVCC_VERSION = $(strip $(shell nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//'))
195+
endif
196+
197+
# detect OS
198+
OSUPPER = $(shell uname -s 2>/dev/null | tr [:lower:] [:upper:])
199+
200+
# Default flags: warnings; runtimes for compilation phases
201+
NVCCFLAGS += -Xcompiler -Wall -Xcompiler -Wextra -Xcudafe -\#
202+
203+
ifeq (WIN_NT, $(findstring WIN_NT, $(OSUPPER)))
204+
# For MSVC
205+
# Disable excess x86 floating point precision that can lead to results being labeled incorrectly
206+
NVCCFLAGS += -Xcompiler /fp:strict
207+
# Help the compiler/linker work with huge numbers of kernels on Windows
208+
NVCCFLAGS += -Xcompiler /bigobj -Xcompiler /Zm500
209+
CC = cl
210+
ifneq ($(force32), 1)
211+
CUDART_CYG = "$(shell dirname $(NVCC))/../lib/Win32/cudart.lib"
212+
else
213+
CUDART_CYG = "$(shell dirname $(NVCC))/../lib/x64/cudart.lib"
214+
endif
215+
CUDART = "$(shell cygpath -w $(CUDART_CYG))"
216+
else
217+
# For g++
218+
# Disable excess x86 floating point precision that can lead to results being labeled incorrectly
219+
NVCCFLAGS += -Xcompiler -ffloat-store
220+
CC = g++
221+
222+
ifeq ($(NVCC_VERSION), 7.0)
223+
NVCCFLAGS += -ccbin=/usr/bin/g++-4.9 -std=c++11
224+
endif
225+
ifeq ($(NVCC_VERSION), 7.5)
226+
# --expt-relaxed-constexpr
227+
# however above flag is useful when working with c++ numeric_limits, it causes erros when
228+
# compiling with debug flags
229+
NVCCFLAGS += -ccbin=/usr/bin/g++-4.9 -std=c++11
230+
endif
231+
ifeq ($(NVCC_VERSION), 8.0)
232+
NVCCFLAGS += -ccbin=/usr/bin/g++-4.9 -std=c++11
233+
endif
234+
# TODO: version checking!
235+
# ifeq ($(shell test $(NVCC_VERSION) -ge 7; echo $$?),0)
236+
# NVCCFLAGS += -ccbin=/usr/bin/g++-4.9 -std=c++11
237+
# endif
238+
239+
ifneq ($(force32), 1)
240+
CUDART = "$(shell dirname $(NVCC))/../lib/libcudart_static.a"
241+
else
242+
CUDART = "$(shell dirname $(NVCC))/../lib64/libcudart_static.a"
243+
endif
244+
endif
245+
246+
# Suffix to append to each binary
247+
BIN_SUFFIX = sm$(SM_ARCH)_$(NVCC_VERSION)_$(CDP_SUFFIX)_$(CPU_ARCH_SUFFIX)_$(OPENMP_SUFFIX)_$(BUILD_SUFFIX)
248+
249+
#-------------------------------------------------------------------------------
250+
# Include/library directories and libraries variables
251+
#-------------------------------------------------------------------------------
252+
253+
BASE_DIR = $(dir $(lastword $(MAKEFILE_LIST)))
254+
INC =
255+
# LIBS =
256+
257+
258+
INC += -I /usr/local/cuda/samples/common/inc/
259+
INC += -I $(BASE_DIR) -I $(BASE_DIR)third-party
260+
261+
262+
#-------------------------------------------------------------------------------
263+
# Dependency Lists
264+
#-------------------------------------------------------------------------------
265+
266+
RD_DIR = $(BASE_DIR)rd
267+
CUB_DIR = $(BASE_DIR)third-party/cub
268+
VIS_DIR = $(BASE_DIR)vis
269+
270+
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
271+
272+
RD_DEPS = $(call rwildcard, $(RD_DIR) $(CUB_DIR),*.cuh) \
273+
$(call rwildcard, $(RD_DIR) $(CUB_DIR),*.hpp) \
274+
$(call rwildcard, $(RD_DIR) $(CUB_DIR),*.h ) \
275+
$(call rwildcard, $(RD_DIR) $(CUB_DIR),*.inl)
276+

0 commit comments

Comments
 (0)