-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsconscript
113 lines (98 loc) · 2.61 KB
/
sconscript
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
#! /bin/python
import os
Import('env')
cppdefines = []
cpppath = [
'.',
'./hydrazine',
'/usr/local/cuda/include'
]
cxx = ['g++']
cxxflags = [
'-std=c++0x'
]
libpath = [
'/usr/local/cuda/lib64'
]
if env['no_debug'] == '1':
cppdefines.append('NDEBUG')
else:
cxxflags.append('-g3')
if env['cdp'] == '1':
cppdefines.append('ENABLE_CDP')
env.Replace(
CC = cxx,
CPPDEFINES = cppdefines, # pre-processor defines (e.g. -DFOO)
CPPPATH = cpppath, # pre-processor paths (e.g. -Ifoo/bar)
CXX = cxx, # c++ compiler
CXXFLAGS = cxxflags, # compiler flags (not pre-processor or linker)
LIBPATH = libpath # compile-time library paths (e.g. -L)
)
hydrazine_src = []
hydrazine_dirs = [
'hydrazine/hydrazine/implementation',
'hydrazine/hydrazine/interface'
]
exts = ['*.cpp']
for dirname in hydrazine_dirs:
for extname in exts:
src = Glob(os.path.join(dirname, extname))
hydrazine_src.extend(src)
hydrazine_lib = env.StaticLibrary('libhydrazine', hydrazine_src, LIBS=['-lrt'])
NVCC = '/usr/local/cuda/bin/nvcc '
NVCCFLAGS = ' -m64 -O3 '
#NVCCFLAGS = ' -m64 -g -G '
actionCommon = NVCC + NVCCFLAGS + ' -I. -I./hydrazine $SOURCES -o $TARGET $LIBS ' + env['_CPPDEFFLAGS']
env.Append(BUILDERS = {
'Cuda_20' : Builder(
action = actionCommon + ' -arch=sm_20 ',
src_suffix = '.cu'
),
'Cuda_35' : Builder(
action = actionCommon + ' -arch=sm_35 ',
src_suffix = '.cu'
),
'Cuda_35_CDP' : Builder(
action = actionCommon + ' -arch=sm_35 -rdc=true -lcudadevrt',
src_sufficx = '.cu'
)})
dragon_li_src = []
dragon_li_header = []
dragon_li_dirs = [
'tests',
'dragon_li/util',
'dragon_li/bfs',
'dragon_li/amr',
'dragon_li/join',
'dragon_li/sssp'
]
dragon_li_install = env['install_path']
srcexts = ['*.cu']
headerexts = ['*.h', '*.cuh']
for dirname in dragon_li_dirs:
for extname in srcexts:
src = env.Glob(os.path.join(dirname, extname))
dragon_li_src.extend(src)
for extname in headerexts:
header = env.Glob(os.path.join(dirname, extname))
dragon_li_header.extend(header)
for app in dragon_li_src:
appfile = os.path.split(str(app))[1]
appname = os.path.splitext(appfile)[0]
if env['sm20'] == '1':
buildApp = env.Cuda_20(os.path.join('bin', appname), app,
LIBS = [hydrazine_lib,
'-lcudart'
])
elif env['cdp'] == '1':
buildApp = env.Cuda_35_CDP(os.path.join('bin', appname), app,
LIBS = [hydrazine_lib,
'-lcudart'
])
else:
buildApp = env.Cuda_35(os.path.join('bin', appname), app,
LIBS = [hydrazine_lib,
'-lcudart'
])
env.Depends(buildApp, [dragon_li_header, hydrazine_lib])
env.Install(dragon_li_install, [buildApp])