Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
580367c1
提交
580367c1
authored
7月 01, 2011
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added rpaths parameter to nvcc_module_compile_str
上级
dfa86140
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
3 行删除
+14
-3
nvcc_compiler.py
theano/sandbox/cuda/nvcc_compiler.py
+14
-3
没有找到文件。
theano/sandbox/cuda/nvcc_compiler.py
浏览文件 @
580367c1
...
@@ -71,9 +71,14 @@ if config.cuda.root == "AUTO":
...
@@ -71,9 +71,14 @@ if config.cuda.root == "AUTO":
is_nvcc_available
()
#to set nvcc_path correctly and get the version
is_nvcc_available
()
#to set nvcc_path correctly and get the version
rpath_defaults
=
[]
def
add_standard_rpath
(
rpath
):
rpath_defaults
.
append
(
rpath
)
def
nvcc_module_compile_str
(
def
nvcc_module_compile_str
(
module_name
,
src_code
,
module_name
,
src_code
,
location
=
None
,
include_dirs
=
[],
lib_dirs
=
[],
libs
=
[],
preargs
=
[]):
location
=
None
,
include_dirs
=
[],
lib_dirs
=
[],
libs
=
[],
preargs
=
[],
rpaths
=
rpath_defaults
):
"""
"""
:param module_name: string (this has been embedded in the src_code
:param module_name: string (this has been embedded in the src_code
:param src_code: a complete c or c++ source listing for the module
:param src_code: a complete c or c++ source listing for the module
...
@@ -82,6 +87,7 @@ def nvcc_module_compile_str(
...
@@ -82,6 +87,7 @@ def nvcc_module_compile_str(
:param lib_dirs: a list of library search path directory names (each gets prefixed with -L)
:param lib_dirs: a list of library search path directory names (each gets prefixed with -L)
:param libs: a list of libraries to link with (each gets prefixed with -l)
:param libs: a list of libraries to link with (each gets prefixed with -l)
:param preargs: a list of extra compiler arguments
:param preargs: a list of extra compiler arguments
:param rpaths: list of rpaths to use with Xlinker. Defaults to `rpath_defaults`.
:returns: dynamically-imported python module of the compiled code.
:returns: dynamically-imported python module of the compiled code.
...
@@ -89,6 +95,8 @@ def nvcc_module_compile_str(
...
@@ -89,6 +95,8 @@ def nvcc_module_compile_str(
Otherwise nvcc never finish.
Otherwise nvcc never finish.
"""
"""
rpaths
=
list
(
rpaths
)
if
sys
.
platform
==
"win32"
:
if
sys
.
platform
==
"win32"
:
# Remove some compilation args that cl.exe does not understand.
# Remove some compilation args that cl.exe does not understand.
# cl.exe is the compiler used by nvcc on Windows.
# cl.exe is the compiler used by nvcc on Windows.
...
@@ -171,10 +179,13 @@ def nvcc_module_compile_str(
...
@@ -171,10 +179,13 @@ def nvcc_module_compile_str(
cmd
.
extend
([
'-Xcompiler'
,
','
.
join
(
preargs2
)])
cmd
.
extend
([
'-Xcompiler'
,
','
.
join
(
preargs2
)])
if
config
.
cuda
.
root
and
os
.
path
.
exists
(
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)):
if
config
.
cuda
.
root
and
os
.
path
.
exists
(
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)):
cmd
.
extend
([
'-Xlinker'
,
','
.
join
([
'-rpath'
,
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)])]
)
rpaths
.
append
(
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)
)
if
sys
.
platform
!=
'darwin'
:
if
sys
.
platform
!=
'darwin'
:
# the 64bit CUDA libs are in the same files as are named by the function above
# the 64bit CUDA libs are in the same files as are named by the function above
cmd
.
extend
([
'-Xlinker'
,
','
.
join
([
'-rpath'
,
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib64'
)])])
rpaths
.
append
(
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib64'
))
for
rpath
in
rpaths
:
cmd
.
extend
([
'-Xlinker'
,
','
.
join
([
'-rpath'
,
rpath
])])
nvccflags
=
[
flag
for
flag
in
config
.
cuda
.
nvccflags
.
split
(
' '
)
if
flag
]
nvccflags
=
[
flag
for
flag
in
config
.
cuda
.
nvccflags
.
split
(
' '
)
if
flag
]
cmd
.
extend
(
nvccflags
)
cmd
.
extend
(
nvccflags
)
cmd
.
extend
(
'-I
%
s'
%
idir
for
idir
in
include_dirs
)
cmd
.
extend
(
'-I
%
s'
%
idir
for
idir
in
include_dirs
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论