Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
08f190b1
提交
08f190b1
authored
4月 14, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
df19095d
5554d3a1
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
0 行删除
+22
-0
cmodule.py
theano/gof/cmodule.py
+7
-0
nvcc_compiler.py
theano/sandbox/cuda/nvcc_compiler.py
+15
-0
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
08f190b1
...
@@ -656,6 +656,13 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[]
...
@@ -656,6 +656,13 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[]
if
python_inc
.
count
(
'Python.framework'
)
>
0
and
config
.
cmodule
.
mac_framework_link
:
if
python_inc
.
count
(
'Python.framework'
)
>
0
and
config
.
cmodule
.
mac_framework_link
:
preargs
.
extend
([
'-framework'
,
'Python'
])
preargs
.
extend
([
'-framework'
,
'Python'
])
# patch from Benjamin Schrauwen
# April 14, 2009
if
distutils
.
sysconfig
.
get_config_var
(
'CFLAGS'
)
.
rfind
(
'x86_64'
)
<
0
:
# If on mac, and not a 64-bit version of python, switch to 32 bit compilation
preargs
.
extend
([
'-m32'
])
# sometimes, the linker cannot find -lpython so we need to tell it
# sometimes, the linker cannot find -lpython so we need to tell it
# explicitly where it is located
# explicitly where it is located
# this returns somepath/lib/python2.x
# this returns somepath/lib/python2.x
...
...
theano/sandbox/cuda/nvcc_compiler.py
浏览文件 @
08f190b1
...
@@ -3,6 +3,7 @@ from theano.gof.cmodule import (std_libs, std_lib_dirs, std_include_dirs, dlimpo
...
@@ -3,6 +3,7 @@ from theano.gof.cmodule import (std_libs, std_lib_dirs, std_include_dirs, dlimpo
get_lib_extension
)
get_lib_extension
)
from
theano
import
config
from
theano
import
config
import
distutils
import
distutils
import
commands
_logger
=
logging
.
getLogger
(
"theano.sandbox.cuda.nvcc_compiler"
)
_logger
=
logging
.
getLogger
(
"theano.sandbox.cuda.nvcc_compiler"
)
_logger
.
setLevel
(
logging
.
WARN
)
_logger
.
setLevel
(
logging
.
WARN
)
...
@@ -68,8 +69,18 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
...
@@ -68,8 +69,18 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
lib_dirs
=
std_lib_dirs
()
+
lib_dirs
lib_dirs
=
std_lib_dirs
()
+
lib_dirs
if
cuda_root
:
if
cuda_root
:
lib_dirs
.
append
(
os
.
path
.
join
(
cuda_root
,
'lib'
))
lib_dirs
.
append
(
os
.
path
.
join
(
cuda_root
,
'lib'
))
# from Benjamin Schrauwen April 14 2010
if
sys
.
platform
!=
'darwin'
:
# No 64 bit CUDA libraries available on the mac, yet..
lib_dirs
.
append
(
os
.
path
.
join
(
cuda_root
,
'lib64'
))
lib_dirs
.
append
(
os
.
path
.
join
(
cuda_root
,
'lib64'
))
if
sys
.
platform
==
'darwin'
:
# On the mac, nvcc is not able to link using -framework Python, so we have
# manually add the correct library and paths
darwin_python_lib
=
commands
.
getoutput
(
'python-config --ldflags'
)
else
:
# sometimes, the linker cannot find -lpython so we need to tell it
# sometimes, the linker cannot find -lpython so we need to tell it
# explicitly where it is located
# explicitly where it is located
# this returns somepath/lib/python2.x
# this returns somepath/lib/python2.x
...
@@ -99,6 +110,8 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
...
@@ -99,6 +110,8 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
cmd
.
extend
([
'-Xcompiler'
,
','
.
join
(
pa
for
pa
in
preargs
if
not
pa
.
startswith
(
'-O'
))])
cmd
.
extend
([
'-Xcompiler'
,
','
.
join
(
pa
for
pa
in
preargs
if
not
pa
.
startswith
(
'-O'
))])
if
os
.
path
.
exists
(
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)):
if
os
.
path
.
exists
(
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)):
cmd
.
extend
([
'-Xlinker'
,
','
.
join
([
'-rpath'
,
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)])])
cmd
.
extend
([
'-Xlinker'
,
','
.
join
([
'-rpath'
,
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib'
)])])
if
sys
.
platform
!=
'darwin'
:
# No 64 bit CUDA libraries available on the mac, yet..
cmd
.
extend
([
'-Xlinker'
,
','
.
join
([
'-rpath'
,
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib64'
)])])
cmd
.
extend
([
'-Xlinker'
,
','
.
join
([
'-rpath'
,
os
.
path
.
join
(
config
.
cuda
.
root
,
'lib64'
)])])
cmd
.
extend
(
'-I
%
s'
%
idir
for
idir
in
include_dirs
)
cmd
.
extend
(
'-I
%
s'
%
idir
for
idir
in
include_dirs
)
cmd
.
extend
([
'-o'
,
lib_filename
])
cmd
.
extend
([
'-o'
,
lib_filename
])
...
@@ -107,6 +120,8 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
...
@@ -107,6 +120,8 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
cmd
.
append
(
os
.
path
.
join
(
os
.
path
.
split
(
cppfilename
)[
0
],
'..'
,
'cuda_ndarray'
,
'cuda_ndarray.so'
))
cmd
.
append
(
os
.
path
.
join
(
os
.
path
.
split
(
cppfilename
)[
0
],
'..'
,
'cuda_ndarray'
,
'cuda_ndarray.so'
))
cmd
.
extend
([
'-L
%
s'
%
ldir
for
ldir
in
lib_dirs
])
cmd
.
extend
([
'-L
%
s'
%
ldir
for
ldir
in
lib_dirs
])
cmd
.
extend
([
'-l
%
s'
%
l
for
l
in
libs
])
cmd
.
extend
([
'-l
%
s'
%
l
for
l
in
libs
])
if
sys
.
platform
==
'darwin'
:
cmd
.
extend
(
darwin_python_lib
.
split
())
debug
(
'Running cmd'
,
' '
.
join
(
cmd
))
debug
(
'Running cmd'
,
' '
.
join
(
cmd
))
p
=
subprocess
.
Popen
(
cmd
,
stderr
=
subprocess
.
PIPE
)
p
=
subprocess
.
Popen
(
cmd
,
stderr
=
subprocess
.
PIPE
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论