Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
82e61360
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
82e61360
编写于
7月 18, 2018
作者:
D
Dong Li
提交者:
Liangliang Zhang
7月 18, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tools: added cuda_library and cuda_binary rules
上级
b6b8005e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
81 addition
and
4 deletion
+81
-4
WORKSPACE.in
WORKSPACE.in
+3
-3
third_party/cuda.BUILD
third_party/cuda.BUILD
+3
-1
tools/cuda_library.bzl
tools/cuda_library.bzl
+75
-0
未找到文件。
WORKSPACE.in
浏览文件 @
82e61360
...
...
@@ -157,7 +157,7 @@ new_local_repository(
new_local_repository(
name = "cuda",
build_file = "third_party/cuda.BUILD",
path = "/usr/local/cuda
/include
",
path = "/usr/local/cuda",
)
# Local-integ
...
...
@@ -194,12 +194,12 @@ http_archive(
new_local_repository(
name = "jsoncpp",
build_file = "third_party/jsoncpp.BUILD",
path = "/usr/local/apollo/jsoncpp/"
path = "/usr/local/apollo/jsoncpp/"
,
)
#adv_plat
new_local_repository(
name = "adv_plat",
build_file = "third_party/adv_plat.BUILD",
path = "/usr/local/apollo/adv_plat"
path = "/usr/local/apollo/adv_plat"
,
)
third_party/cuda.BUILD
浏览文件 @
82e61360
...
...
@@ -2,9 +2,11 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"])
cc_library(
name = "cuda",
includes = ["
.
"],
includes = ["
include
"],
linkopts = [
"-L/usr/local/cuda/lib64",
"-lOpenCL",
...
...
tools/cuda_library.bzl
0 → 100644
浏览文件 @
82e61360
cuda_srcs
=
FileType
([
".cu"
,
".cc"
,
".cpp"
,
])
cuda_headers
=
FileType
([
".h"
,
".hpp"
,
])
cuda_arch
=
[
"-arch=sm_30"
,
"-gencode=arch=compute_30,code=sm_30"
,
"-gencode=arch=compute_50,code=sm_50"
,
"-gencode=arch=compute_52,code=sm_52"
,
"-gencode=arch=compute_60,code=sm_60"
,
"-gencode=arch=compute_61,code=sm_61"
,
"-gencode=arch=compute_61,code=compute_61"
,
]
def
cuda_library_impl
(
ctx
):
s
=
set
()
flags
=
' '
.
join
(
ctx
.
attr
.
flags
)
output
=
ctx
.
outputs
.
out
lib_flags
=
[
"--shared"
,
"--compiler-options '-fPIC'"
]
args
=
ctx
.
attr
.
flags
+
[
f
.
path
for
f
in
ctx
.
files
.
srcs
]
+
[
f
.
path
for
f
in
ctx
.
files
.
hdrs
]
+
[
f
.
path
for
f
in
ctx
.
files
.
deps
]
ctx
.
actions
.
run_shell
(
inputs
=
ctx
.
files
.
srcs
+
ctx
.
files
.
hdrs
,
outputs
=
[
ctx
.
outputs
.
out
],
arguments
=
args
,
env
=
{
'PATH'
:
'/usr/local/cuda/bin:/usr/local/bin:/usr/bin:/bin'
,
},
command
=
"/usr/local/cuda/bin/nvcc %s %s -o %s %s"
%
(
' '
.
join
(
cuda_arch
),
' '
.
join
(
lib_flags
),
output
.
path
,
" "
.
join
(
args
))
)
def
cuda_binary_impl
(
ctx
):
flags
=
' '
.
join
(
ctx
.
attr
.
flags
)
args
=
ctx
.
attr
.
flags
+
[
f
.
path
for
f
in
ctx
.
files
.
srcs
]
+
[
f
.
path
for
f
in
ctx
.
files
.
hdrs
]
+
[
f
.
path
for
f
in
ctx
.
attr
.
deps
]
output
=
ctx
.
outputs
.
out
ctx
.
actions
.
run_shell
(
inputs
=
ctx
.
files
.
srcs
+
ctx
.
files
.
hdrs
,
outputs
=
[
ctx
.
outputs
.
out
],
arguments
=
args
,
env
=
{
'PATH'
:
'/usr/local/cuda/bin:/usr/local/bin:/usr/bin:/bin'
,
},
command
=
"/usr/local/cuda/bin/nvcc %s -o %s %s"
%
(
' '
.
join
(
cuda_arch
),
output
.
path
,
" "
.
join
(
args
)),
)
cuda_library
=
rule
(
attrs
=
{
"hdrs"
:
attr
.
label_list
(
allow_files
=
cuda_headers
),
"srcs"
:
attr
.
label_list
(
allow_files
=
cuda_srcs
,
mandatory
=
True
,
),
"deps"
:
attr
.
label_list
(
allow_files
=
False
),
"flags"
:
attr
.
label_list
(
allow_files
=
False
),
},
outputs
=
{
"out"
:
"lib%{name}.so"
},
implementation
=
cuda_library_impl
,
)
cuda_binary
=
rule
(
attrs
=
{
"hdrs"
:
attr
.
label_list
(
allow_files
=
cuda_headers
),
"srcs"
:
attr
.
label_list
(
allow_files
=
cuda_srcs
,
mandatory
=
True
,
),
"deps"
:
attr
.
label_list
(
allow_files
=
False
),
"flags"
:
attr
.
label_list
(
allow_files
=
False
),
},
executable
=
True
,
outputs
=
{
"out"
:
"%{name}"
},
implementation
=
cuda_binary_impl
,
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录