提交 9f62985e authored 作者: Sander Dieleman's avatar Sander Dieleman 提交者: Mathieu Germain

hacked together support for cudnn v5 EA

上级 adc2387b
...@@ -241,7 +241,8 @@ class GpuDnnConvDesc(GpuOp): ...@@ -241,7 +241,8 @@ class GpuDnnConvDesc(GpuOp):
} }
} }
err = cudnnSetConvolutionNdDescriptor_v3( // err = cudnnSetConvolutionNdDescriptor_v3(
err = cudnnSetConvolutionNdDescriptor(
%(desc)s, %(desc)s,
%(nb_dim)d, %(nb_dim)d,
pad, subsample, upscale, pad, subsample, upscale,
...@@ -1361,7 +1362,7 @@ class GpuDnnPoolDesc(GpuOp): ...@@ -1361,7 +1362,7 @@ class GpuDnnPoolDesc(GpuOp):
int win[%(nd)d] = {%(win)s}; int win[%(nd)d] = {%(win)s};
int pad[%(nd)d] = {%(pad)s}; int pad[%(nd)d] = {%(pad)s};
int str[%(nd)d] = {%(str)s}; int str[%(nd)d] = {%(str)s};
err = cudnnSetPoolingNdDescriptor( err = cudnnSetPoolingNdDescriptor_v3(
%(desc)s, %(mode_flag)s, %(nd)d, %(desc)s, %(mode_flag)s, %(nd)d,
win, pad, str); win, pad, str);
} }
...@@ -1543,7 +1544,7 @@ for(int i = 0; i < %(nd)d; i++) { ...@@ -1543,7 +1544,7 @@ for(int i = 0; i < %(nd)d; i++) {
for(int i = 0; i < %(nd)d; i++) { for(int i = 0; i < %(nd)d; i++) {
str[i] = *((npy_intp*)PyArray_GETPTR1(%(str)s, i)); str[i] = *((npy_intp*)PyArray_GETPTR1(%(str)s, i));
} }
err = cudnnSetPoolingNdDescriptor( err = cudnnSetPoolingNdDescriptor_v3(
pool%(name)s, %(mode_flag)s, %(nd)d, pool%(name)s, %(mode_flag)s, %(nd)d,
win, pad, str); win, pad, str);
...@@ -1821,7 +1822,7 @@ for(int i = 0; i < %(nd)d; i++) { ...@@ -1821,7 +1822,7 @@ for(int i = 0; i < %(nd)d; i++) {
for(int i = 0; i < %(nd)d; i++) { for(int i = 0; i < %(nd)d; i++) {
str[i] = *((npy_intp*)PyArray_GETPTR1(%(str)s, i)); str[i] = *((npy_intp*)PyArray_GETPTR1(%(str)s, i));
} }
err%(name)s = cudnnSetPoolingNdDescriptor( err%(name)s = cudnnSetPoolingNdDescriptor_v3(
pool%(name)s, %(mode_flag)s, %(nd)d, pool%(name)s, %(mode_flag)s, %(nd)d,
win, pad, str); win, pad, str);
......
...@@ -54,8 +54,8 @@ c_set_filterNd(CudaNdarray *var, cudnnFilterDescriptor_t desc) { ...@@ -54,8 +54,8 @@ c_set_filterNd(CudaNdarray *var, cudnnFilterDescriptor_t desc) {
return -1; return -1;
} }
int dim = CudaNdarray_NDIM(var); int dim = CudaNdarray_NDIM(var);
cudnnStatus_t err = cudnnSetFilterNdDescriptor(desc, CUDNN_DATA_FLOAT, dim, cudnnStatus_t err = cudnnSetFilterNdDescriptor_v3(desc, CUDNN_DATA_FLOAT, dim,
CudaNdarray_HOST_DIMS(var)); CudaNdarray_HOST_DIMS(var));
if (err != CUDNN_STATUS_SUCCESS) { if (err != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
"Could not set filter descriptor: %s." "Could not set filter descriptor: %s."
......
...@@ -179,8 +179,8 @@ APPLY_SPECIFIC(conv_fwd)(CudaNdarray *input, CudaNdarray *kerns, ...@@ -179,8 +179,8 @@ APPLY_SPECIFIC(conv_fwd)(CudaNdarray *input, CudaNdarray *kerns,
int upscale[2]; int upscale[2];
cudnnConvolutionMode_t mode; cudnnConvolutionMode_t mode;
cudnnDataType_t data_type; cudnnDataType_t data_type;
err = cudnnGetConvolutionNdDescriptor_v3(desc, 2, &nd, pad, stride, err = cudnnGetConvolutionNdDescriptor(desc, 2, &nd, pad, stride,
upscale, &mode, &data_type); upscale, &mode, &data_type);
if (err != CUDNN_STATUS_SUCCESS) { if (err != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
......
...@@ -178,8 +178,8 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output, ...@@ -178,8 +178,8 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output,
int upscale[2]; int upscale[2];
cudnnConvolutionMode_t mode; cudnnConvolutionMode_t mode;
cudnnDataType_t data_type; cudnnDataType_t data_type;
err = cudnnGetConvolutionNdDescriptor_v3(desc, 2, &nd, pad, stride, err = cudnnGetConvolutionNdDescriptor(desc, 2, &nd, pad, stride,
upscale, &mode, &data_type); upscale, &mode, &data_type);
if (err != CUDNN_STATUS_SUCCESS) { if (err != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
...@@ -237,7 +237,7 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output, ...@@ -237,7 +237,7 @@ APPLY_SPECIFIC(conv_gi)(CudaNdarray *kerns, CudaNdarray *output,
return 1; return 1;
// Perform the convolution // Perform the convolution
err = cudnnConvolutionBackwardData_v3( err = cudnnConvolutionBackwardData(
_handle, _handle,
(void *)&alpha, (void *)&alpha,
APPLY_SPECIFIC(kerns), CudaNdarray_DEV_DATA(kerns), APPLY_SPECIFIC(kerns), CudaNdarray_DEV_DATA(kerns),
......
...@@ -173,8 +173,8 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output, ...@@ -173,8 +173,8 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output,
int upscale[2]; int upscale[2];
cudnnConvolutionMode_t mode; cudnnConvolutionMode_t mode;
cudnnDataType_t data_type; cudnnDataType_t data_type;
err = cudnnGetConvolutionNdDescriptor_v3(desc, 2, &nd, pad, stride, err = cudnnGetConvolutionNdDescriptor(desc, 2, &nd, pad, stride,
upscale, &mode, &data_type); upscale, &mode, &data_type);
if (err != CUDNN_STATUS_SUCCESS) { if (err != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
...@@ -221,7 +221,7 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output, ...@@ -221,7 +221,7 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output,
return 1; return 1;
// Perform the convolution // Perform the convolution
err = cudnnConvolutionBackwardFilter_v3( err = cudnnConvolutionBackwardFilter(
_handle, _handle,
(void *)&alpha, (void *)&alpha,
APPLY_SPECIFIC(input), CudaNdarray_DEV_DATA(input), APPLY_SPECIFIC(input), CudaNdarray_DEV_DATA(input),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论