CAFFE 报错 Check failed: error == cudaSuccess (74 vs. 0) misaligned address的简单解决方法

Check failed: error == cudaSuccess (74 vs. 0) misaligned address

在caffe库中找到src\caffe\layers\cudnn_conv_layer.cpp
在文件cudnn_caffe_layer.cpp文件中,查找
size_t total_max_workspace = max_workspace * (this->group_ * CUDNN_STREAMS_PER_GROUP);
在该行的上面添加如下代码:

size_t m = 32;
max_workspace = (max_workspace + m - 1) / m * m; //align address to be multiples of m

在文件cudnn_caffe_layer.cpp文件中,查找
for (int g = 0; g < (this->group_ * CUDNN_STREAMS_PER_GROUP); g++)
在for循环大括号里加入

workspace[g] = reinterpret_cast(workspaceData)+g*max_workspace;

亲测绝对可用,不能用欢迎投诉 [email protected]

你可能感兴趣的:(c++编程)