Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8b7af488
提交
8b7af488
authored
5月 09, 2016
作者:
slefrancois
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added backward compatibility with sandbox.gpuarray, removed comp.py
上级
87d521fb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
11 行增加
和
58 行删除
+11
-58
comp.py
theano/gpuarray/comp.py
+0
-56
__init__.py
theano/sandbox/gpuarray/__init__.py
+9
-0
test_flake8.py
theano/tests/test_flake8.py
+2
-2
没有找到文件。
theano/gpuarray/comp.py
deleted
100644 → 0
浏览文件 @
87d521fb
from
__future__
import
absolute_import
,
print_function
,
division
import
os
import
numpy
import
theano
from
theano
import
config
# This is a big hack to avoid creating a second context on the card.
from
theano.sandbox.cuda.nvcc_compiler
import
(
NVCC_compiler
as
NVCC_base
,
hash_from_file
)
class
NVCC_compiler
(
NVCC_base
):
@staticmethod
def
compile_args
():
"""
Re-implementation of compile_args that does not create an
additionnal context on the GPU.
"""
flags
=
[
flag
for
flag
in
config
.
nvcc
.
flags
.
split
(
' '
)
if
flag
]
if
config
.
nvcc
.
fastmath
:
flags
.
append
(
'-use_fast_math'
)
cuda_ndarray_cuh_hash
=
hash_from_file
(
os
.
path
.
join
(
os
.
path
.
split
(
theano
.
sandbox
.
cuda
.
__file__
)[
0
],
'cuda_ndarray.cuh'
))
flags
.
append
(
'-DCUDA_NDARRAY_CUH='
+
cuda_ndarray_cuh_hash
)
# numpy 1.7 deprecated the following macros but they didn't
# exist in the past
numpy_ver
=
[
int
(
n
)
for
n
in
numpy
.
__version__
.
split
(
'.'
)[:
2
]]
if
bool
(
numpy_ver
<
[
1
,
7
]):
flags
.
append
(
"-DNPY_ARRAY_ENSURECOPY=NPY_ENSURECOPY"
)
flags
.
append
(
"-DNPY_ARRAY_ALIGNED=NPY_ALIGNED"
)
flags
.
append
(
"-DNPY_ARRAY_WRITEABLE=NPY_WRITEABLE"
)
flags
.
append
(
"-DNPY_ARRAY_UPDATE_ALL=NPY_UPDATE_ALL"
)
flags
.
append
(
"-DNPY_ARRAY_C_CONTIGUOUS=NPY_C_CONTIGUOUS"
)
flags
.
append
(
"-DNPY_ARRAY_F_CONTIGUOUS=NPY_F_CONTIGUOUS"
)
# If the user didn't specify architecture flags add them
if
not
any
([
'-arch=sm_'
in
f
for
f
in
flags
]):
dev
=
theano
.
gpuarray
.
init_dev
.
device
if
dev
is
None
:
raise
Exception
(
"Trying to compile GPU code without a context"
)
if
dev
.
startswith
(
"opencl"
):
raise
Exception
(
"Trying to call nvcc with an OpenCL context"
)
assert
dev
.
startswith
(
'cuda'
)
if
dev
==
'cuda'
:
n
=
theano
.
sandbox
.
cuda
.
use
.
device_number
else
:
n
=
int
(
dev
[
4
:])
p
=
theano
.
sandbox
.
cuda
.
device_properties
(
n
)
flags
.
append
(
'-arch=sm_'
+
str
(
p
[
'major'
])
+
str
(
p
[
'minor'
]))
return
flags
theano/sandbox/gpuarray/__init__.py
0 → 100644
浏览文件 @
8b7af488
"""Placeholder for new gpuarray backend in sandbox. Supports old pickles
which refered to theano.sandbox.gpuarray."""
import
warnings
from
theano.gpuarray
import
*
message
=
"theano.sandbox.gpuarray has been moved to theano.gpuarray."
+
\
" Please update your code and pickles."
warnings
.
warn
(
message
)
theano/tests/test_flake8.py
浏览文件 @
8b7af488
...
@@ -39,6 +39,8 @@ whitelist_flake8 = [
...
@@ -39,6 +39,8 @@ whitelist_flake8 = [
"compile/profiling.py"
,
"compile/profiling.py"
,
"compile/sandbox/__init__.py"
,
"compile/sandbox/__init__.py"
,
"compile/tests/__init__.py"
,
"compile/tests/__init__.py"
,
"gpuarray/__init__.py"
,
"gpuarray/tests/__init__.py"
,
"typed_list/__init__.py"
,
"typed_list/__init__.py"
,
"typed_list/tests/__init__.py"
,
"typed_list/tests/__init__.py"
,
"tensor/__init__.py"
,
"tensor/__init__.py"
,
...
@@ -108,7 +110,6 @@ whitelist_flake8 = [
...
@@ -108,7 +110,6 @@ whitelist_flake8 = [
"sandbox/cuda/tests/test_extra_ops.py"
,
"sandbox/cuda/tests/test_extra_ops.py"
,
"sandbox/cuda/tests/test_gemmcorr3d.py"
,
"sandbox/cuda/tests/test_gemmcorr3d.py"
,
"sandbox/cuda/tests/test_viewop.py"
,
"sandbox/cuda/tests/test_viewop.py"
,
"gpuarray/tests/__init__.py"
,
"sandbox/scan_module/scan_utils.py"
,
"sandbox/scan_module/scan_utils.py"
,
"sandbox/scan_module/scan.py"
,
"sandbox/scan_module/scan.py"
,
"sandbox/scan_module/scan_op.py"
,
"sandbox/scan_module/scan_op.py"
,
...
@@ -119,7 +120,6 @@ whitelist_flake8 = [
...
@@ -119,7 +120,6 @@ whitelist_flake8 = [
"sandbox/linalg/__init__.py"
,
"sandbox/linalg/__init__.py"
,
"sandbox/linalg/tests/__init__.py"
,
"sandbox/linalg/tests/__init__.py"
,
"sandbox/linalg/tests/test_linalg.py"
,
"sandbox/linalg/tests/test_linalg.py"
,
"gpuarray/__init__.py"
,
"scan_module/scan_utils.py"
,
"scan_module/scan_utils.py"
,
"scan_module/scan_views.py"
,
"scan_module/scan_views.py"
,
"scan_module/scan.py"
,
"scan_module/scan.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论