Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5f219fca
提交
5f219fca
authored
5月 27, 2014
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1874 from abergeron/gpuarray_nvcc
Make a proxy NVCC_compiler that does not create a second context on the card as a side effect.
上级
8477307a
4a98bd66
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
63 行增加
和
8 行删除
+63
-8
__init__.py
theano/sandbox/gpuarray/__init__.py
+4
-0
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+0
-1
comp.py
theano/sandbox/gpuarray/comp.py
+52
-0
conv.py
theano/sandbox/gpuarray/conv.py
+1
-1
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+2
-3
neighbours.py
theano/sandbox/gpuarray/neighbours.py
+1
-1
nnet.py
theano/sandbox/gpuarray/nnet.py
+1
-1
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+2
-1
没有找到文件。
theano/sandbox/gpuarray/__init__.py
浏览文件 @
5f219fca
...
...
@@ -39,6 +39,10 @@ def init_dev(dev):
pygpu_activated
=
True
if
config
.
print_active_device
:
print
>>
sys
.
stderr
,
"Using device
%
s:
%
s"
%
(
dev
,
context
.
devname
)
# remember the active device
init_dev
.
device
=
dev
init_dev
.
device
=
None
if
pygpu
:
try
:
...
...
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
5f219fca
...
...
@@ -12,7 +12,6 @@ from theano.gof.python25 import any
from
theano.gof.utils
import
MethodNotDefined
from
theano.compat
import
PY3
from
theano.sandbox.cuda.nvcc_compiler
import
NVCC_compiler
try
:
import
pygpu
from
pygpu
import
gpuarray
,
elemwise
...
...
theano/sandbox/gpuarray/comp.py
0 → 100644
浏览文件 @
5f219fca
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
(
"-D NPY_ARRAY_ENSURECOPY=NPY_ENSURECOPY"
)
flags
.
append
(
"-D NPY_ARRAY_ALIGNED=NPY_ALIGNED"
)
flags
.
append
(
"-D NPY_ARRAY_WRITEABLE=NPY_WRITEABLE"
)
flags
.
append
(
"-D NPY_ARRAY_UPDATE_ALL=NPY_UPDATE_ALL"
)
flags
.
append
(
"-D NPY_ARRAY_C_CONTIGUOUS=NPY_C_CONTIGUOUS"
)
flags
.
append
(
"-D NPY_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
.
sandbox
.
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/conv.py
浏览文件 @
5f219fca
...
...
@@ -3,7 +3,7 @@ import os
import
theano
from
theano
import
config
,
gof
from
theano.sandbox.
cuda.nvcc_compiler
import
NVCC_compiler
from
theano.sandbox.
gpuarray.comp
import
NVCC_compiler
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
theano.sandbox.gpuarray.basic_ops
import
as_gpuarray_variable
...
...
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
5f219fca
...
...
@@ -8,9 +8,8 @@ import theano
from
theano
import
Apply
,
scalar
,
config
from
theano
import
scalar
as
scal
from
theano.scalar
import
Scalar
from
theano.tensor.elemwise
import
(
Elemwise
,
DimShuffle
,
CAReduceDtype
)
from
theano.sandbox.cuda.nvcc_compiler
import
NVCC_compiler
from
theano.tensor.elemwise
import
(
Elemwise
,
DimShuffle
,
CAReduceDtype
)
from
theano.sandbox.gpuarray.comp
import
NVCC_compiler
try
:
import
pygpu
...
...
theano/sandbox/gpuarray/neighbours.py
浏览文件 @
5f219fca
...
...
@@ -2,7 +2,6 @@ import numpy
from
theano
import
Op
,
Apply
,
config
from
theano.gof
import
local_optimizer
from
theano.sandbox.cuda.nvcc_compiler
import
NVCC_compiler
from
theano.sandbox.neighbours
import
Images2Neibs
import
theano.tensor
as
T
...
...
@@ -17,6 +16,7 @@ from theano.sandbox.gpuarray.basic_ops import (as_gpuarray_variable,
from
theano.sandbox.gpuarray.opt
import
register_opt
as
register_gpu_opt
from
theano.sandbox.gpuarray.opt
import
op_lifter
as
op_lifter
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
theano.sandbox.gpuarray.comp
import
NVCC_compiler
class
GpuImages2Neibs
(
Images2Neibs
,
Op
):
...
...
theano/sandbox/gpuarray/nnet.py
浏览文件 @
5f219fca
...
...
@@ -2,7 +2,7 @@ import numpy
from
theano
import
Op
,
Apply
,
config
from
theano.compat.six
import
StringIO
from
theano.sandbox.
cuda.nvcc_compiler
import
NVCC_compiler
from
theano.sandbox.
gpuarray.comp
import
NVCC_compiler
try
:
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
5f219fca
...
...
@@ -7,7 +7,6 @@ from theano import tensor, gof, Op
from
theano.gof.python25
import
all
,
any
from
theano.tensor.subtensor
import
IncSubtensor
,
Subtensor
,
get_idx_list
import
theano.tensor.inplace
from
theano.sandbox.cuda.nvcc_compiler
import
NVCC_compiler
try
:
import
pygpu
...
...
@@ -18,6 +17,8 @@ except ImportError:
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
theano.sandbox.gpuarray.basic_ops
import
as_gpuarray_variable
,
HideC
from
theano.sandbox.gpuarray.elemwise
import
GpuElemwise
from
theano.sandbox.gpuarray.comp
import
NVCC_compiler
class
GpuSubtensor
(
HideC
,
Subtensor
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论