C++ 在OpenCV中使用地址消毒器
我正试图将谷歌的应用于CUDA项目,更准确地说是OpenCV CUDA功能。然而,我在第一次cuda呼叫时出现了“内存不足”错误C++ 在OpenCV中使用地址消毒器,c++,opencv,clang++,sanitizer,address-sanitizer,C++,Opencv,Clang++,Sanitizer,Address Sanitizer,我正试图将谷歌的应用于CUDA项目,更准确地说是OpenCV CUDA功能。然而,我在第一次cuda呼叫时出现了“内存不足”错误 OpenCV Error: Gpu API call (out of memory) in getDevice, file opencv-2.4.11/src/opencv-2.4.11/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp, line 664 terminate called aft
OpenCV Error: Gpu API call (out of memory) in getDevice, file opencv-2.4.11/src/opencv-2.4.11/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp, line 664
terminate called after throwing an instance of 'cv::Exception'
what(): opencv-2.4.11/src/opencv-2.4.11/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp:664: error: (-217) out of memory in function getDevice
它可以用计算机复制
#include <opencv2/gpu/gpu.hpp>
int main()
{
cv::gpu::printCudaDeviceInfo(cv::gpu::getDevice());
return 0;
}
我在gcc中得到了相同的结果。
我还尝试将cuda函数列入黑名单,但没有结果
现在在不使用opencv的情况下使用cuda:
#include <cuda_runtime.h>
int main()
{
int count = -1;
cudaGetDevice(&count);
cout << "Device count: " << count << endl;
return 0;
}
clang++ -O1 -g -fsanitize=address -fsanitize-blacklist=asan.blacklist -stdlib=libstdc++ -lstdc++ -I/opt/cuda/include -L/opt/cuda/lib64 -lcudart -o sanitizer sanitizer.cpp && ./sanitizer
#包括
int main()
{
整数计数=-1;
CUDAGET设备(计数和计数);
GitHub上的cout相关问题:
#include <cuda_runtime.h>
int main()
{
int count = -1;
cudaGetDevice(&count);
cout << "Device count: " << count << endl;
return 0;
}
clang++ -O1 -g -fsanitize=address -fsanitize-blacklist=asan.blacklist -stdlib=libstdc++ -lstdc++ -I/opt/cuda/include -L/opt/cuda/lib64 -lcudart -o sanitizer sanitizer.cpp && ./sanitizer
=================================================================
==25344==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 136 byte(s) in 1 object(s) allocated from:
#0 0x4bc4a2 (/home/pluc/work/tests/sanitizer+0x4bc4a2)
#1 0x7f71f0fa69ba (<unknown module>)
SUMMARY: AddressSanitizer: 136 byte(s) leaked in 1 allocation(s).