本帖最后由 岁月轻狂 于 2013-4-24 15:27 编辑
各位版主好: 之前写好的基于上述环境的CUDA程序在debug和release下编译和执行都没问题,结果正确,但是现在想今天确发现它只能在debug下执行了,而在release下编译成功,执行错误,并且错误的部分是一段opencv代码:
- Mat Gen_sensing_matrix_mat(Mat y)
- { //Create the coded mask temp to return based on the input mixing spectral image x
- int col=y.cols-bands+1;
- int row=y.rows;
- Mat temp=Mat::zeros(row,col,CV_8UC1);//这句代码出错
- randu(temp, Scalar::all(0), Scalar::all(2));
- temp.convertTo(temp,CV_32FC1);
- return temp;
- }
复制代码
错误位置如代码中所示:
为了便于发现问题,我把cuda相关的程序代码删除,只保留了opencv相关的代码,发现当我把*.cu文件的
项类型由cuda c++改为 c++编译器时,opencv相关的这段代码在debug和release下均可执行正确:
这里debug和release分别包含相应的*.lib;
辛苦斑竹帮忙分析一下,谢谢了
|