Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0f07b4a5
提交
0f07b4a5
authored
7月 15, 2014
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1966 from abergeron/cublas_v2
Switch to cublas v2
上级
a9553206
bcf62111
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
27 行增加
和
14 行删除
+27
-14
cuda_ndarray.cu
theano/sandbox/cuda/cuda_ndarray.cu
+0
-0
cuda_ndarray.cuh
theano/sandbox/cuda/cuda_ndarray.cuh
+27
-14
没有找到文件。
theano/sandbox/cuda/cuda_ndarray.cu
浏览文件 @
0f07b4a5
差异被折叠。
点击展开。
theano/sandbox/cuda/cuda_ndarray.cuh
浏览文件 @
0f07b4a5
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
#endif
#endif
#include <cublas.h>
#include <cublas
_v2
.h>
#ifdef _WIN32
#ifdef _WIN32
#ifdef _CUDA_NDARRAY_C
#ifdef _CUDA_NDARRAY_C
...
@@ -81,6 +81,9 @@ typedef float real;
...
@@ -81,6 +81,9 @@ typedef float real;
#define VERBOSE_DEVICE_MALLOC 1
#define VERBOSE_DEVICE_MALLOC 1
#define NO_VERBOSE_DEVICE_MALLOC 0
#define NO_VERBOSE_DEVICE_MALLOC 0
/* Use this handle to make cublas calls */
extern
cublasHandle_t
handle
;
/**
/**
* Allocation and freeing of device memory should go through these functions so that the lib can track memory usage.
* Allocation and freeing of device memory should go through these functions so that the lib can track memory usage.
*
*
...
@@ -365,8 +368,8 @@ static int CudaNdarray_alloc_contiguous(CudaNdarray *self, const int nd,
...
@@ -365,8 +368,8 @@ static int CudaNdarray_alloc_contiguous(CudaNdarray *self, const int nd,
//Detect overflow on unsigned integer
//Detect overflow on unsigned integer
if
(
dim
[
i
]
!=
0
&&
size
>
(
SIZE_MAX
/
dim
[
i
]))
{
if
(
dim
[
i
]
!=
0
&&
size
>
(
SIZE_MAX
/
dim
[
i
]))
{
PyErr_Format
(
PyExc_AssertionError
,
PyErr_Format
(
PyExc_AssertionError
,
"Can't store in size_t for the bytes requested"
,
"Can't store in size_t for the bytes requested
%llu
"
,
size
);
(
unsigned
long
long
)
size
);
return
-
1
;
return
-
1
;
}
}
size
=
size
*
dim
[
i
];
size
=
size
*
dim
[
i
];
...
@@ -382,8 +385,8 @@ static int CudaNdarray_alloc_contiguous(CudaNdarray *self, const int nd,
...
@@ -382,8 +385,8 @@ static int CudaNdarray_alloc_contiguous(CudaNdarray *self, const int nd,
//Detect overflow on unsigned integer
//Detect overflow on unsigned integer
if
(
dim
[
i
]
!=
0
&&
size
>
(
SIZE_MAX
/
dim
[
i
]))
{
if
(
dim
[
i
]
!=
0
&&
size
>
(
SIZE_MAX
/
dim
[
i
]))
{
PyErr_Format
(
PyExc_AssertionError
,
PyErr_Format
(
PyExc_AssertionError
,
"Can't store in size_t for the bytes requested"
,
"Can't store in size_t for the bytes requested
%llu
"
,
size
);
(
unsigned
long
long
)
size
);
return
-
1
;
return
-
1
;
}
}
size
=
size
*
dim
[
i
];
size
=
size
*
dim
[
i
];
...
@@ -583,23 +586,33 @@ DllExport int CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_othe
...
@@ -583,23 +586,33 @@ DllExport int CudaNdarray_inplace_elemwise(PyObject* py_self, PyObject * py_othe
DllExport
int
CudaNdarray_prep_output
(
CudaNdarray
**
arr
,
int
nd
,
DllExport
int
CudaNdarray_prep_output
(
CudaNdarray
**
arr
,
int
nd
,
const
int
*
dims
,
int
fortran
=
0
);
const
int
*
dims
,
int
fortran
=
0
);
DllExport
inline
const
char
*
ALWAYS_INLINE
cublasGetErrorString
(
cublasStatus
err
){
DllExport
inline
const
char
*
ALWAYS_INLINE
cublasGetErrorString
(
cublasStatus_t
err
){
if
(
CUBLAS_STATUS_SUCCESS
==
err
)
switch
(
err
)
{
case
CUBLAS_STATUS_SUCCESS
:
return
"success"
;
return
"success"
;
else
if
(
CUBLAS_STATUS_NOT_INITIALIZED
==
err
)
case
CUBLAS_STATUS_NOT_INITIALIZED
:
return
"the library was not initialized"
;
return
"the library was not initialized"
;
else
if
(
CUBLAS_STATUS_ALLOC_FAILED
==
err
)
case
CUBLAS_STATUS_ALLOC_FAILED
:
return
"the resource allocation failed"
;
return
"the resource allocation failed"
;
else
if
(
CUBLAS_STATUS_INVALID_VALUE
==
err
)
case
CUBLAS_STATUS_INVALID_VALUE
:
return
"the parameters n<0 or incx,incy=0"
;
return
"the parameters n<0 or incx,incy=0"
;
else
if
(
CUBLAS_STATUS_MAPPING_ERROR
==
err
)
#ifdef CUBLAS_STATUS_ARCH_MISMATCH
case
CUBLAS_STATUS_ARCH_MISMATCH
:
return
"required device feature not present"
;
#endif
case
CUBLAS_STATUS_MAPPING_ERROR
:
return
"an access to GPU memory space failed"
;
return
"an access to GPU memory space failed"
;
else
if
(
CUBLAS_STATUS_EXECUTION_FAILED
==
err
)
case
CUBLAS_STATUS_EXECUTION_FAILED
:
return
"the function failed to launch on the GPU"
;
return
"the function failed to launch on the GPU"
;
else
if
(
CUBLAS_STATUS_INTERNAL_ERROR
==
err
)
case
CUBLAS_STATUS_INTERNAL_ERROR
:
return
"an internal operation failed"
;
return
"an internal operation failed"
;
else
#ifdef CUBLAS_STATUS_NOT_SUPPORTED
case
CUBLAS_STATUS_NOT_SUPPORTED
:
return
"unsupported function"
;
#endif
default:
return
"unknow code"
;
return
"unknow code"
;
}
}
}
#endif
#endif
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论