挖矿cudaerror
Ⅰ cuda缂栫▼闂棰 杩愯屽嚭閿
Compiling CUDA source file ..\..\src\caffe\layers\bnll_layer.cu...
1>
1> D:\Caffe\WindowsCaffe_detect\Caffe_Windows_Detection-master\build\MSVC2013>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version 2013 -ccbin "D:\gzSoft\vs2013\VC\bin\x86_amd64" -I../../3rdparty/include -I../../src -I../../include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\cuda\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static --verbose --keep -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= -D_VARIADIC_MAX=10 -DWIN32 -D_DEBUG -D_CONSOLE -D_UNICODE -DUNICODE -Xcompiler "/EHsc /W1 /nologo /Od /Zi /RTC1 /MDd " -o Debug\bnll_layer.cu.obj "D:\Caffe\WindowsCaffe_detect\Caffe_Windows_Detection-master\src\caffe\layers\bnll_layer.cu"
1> #$ _SPACE_=
1> #$ _CUDART_=cudart
1> #$ _HERE_=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin
1> #$ _THERE_=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin
1> #$ _TARGET_SIZE_=
1> #$ _TARGET_DIR_=
1> #$ _TARGET_SIZE_=64
1> #$ _WIN_PLATFORM_=x64
1> #$ TOP=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/..
1> #$ NVVMIR_LIBRARY_DIR=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../nvvm/libdevice
1> #$ PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../open64/bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../nvvm/bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../lib;D:\gzSoft\vs2013\VC\bin\x86_amd64;D:\gzSoft\vs2013\VC\bin;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools;D:\gzSoft\vs2013\Common7\Tools\bin;D:\gzSoft\vs2013\Common7\tools;D:\gzSoft\vs2013\Common7\ide;C:\Program Files (x86)\HTML Help Workshop;;C:\Program Files (x86)\MSBuild\12.0\bin\;C:\Windows\Microsoft.NET\Framework\v4.0.30319\;;C:\Program Files\DahuaTech\MV Viewer\Runtime\x64\;C:\Program Files\DahuaTech\MV Viewer\Runtime\x64\GenICam_v2_4\bin\Win64_x64\;C:\Program Files\DahuaTech\MV Viewer\Runtime\Win32\;C:\Program Files\DahuaTech\MV Viewer\Runtime\Win32\GenICam_v2_4\bin\Win32_i86\;C:\Program Files\Basler\pylon 4\pylon\bin\x64;C:\Program Files\Basler\pylon 4\pylon\bin\Win32;C:\Program Files\Basler\pylon 4\genicam\Bin\Win64_x64;C:\Program Files\Basler\pylon 4\genicam\Bin\Win32_i86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\gzSoft\opencv2.4.11\build_Sour\vc11\bin;D:\gzSoft\opencv2.4.10\build_Sour\vc10\bin;D:\gzSoft\qt5.2.1\5.2.1\msvc2012\bin;D:\MinGW\MinGW\bin;D:\gzSoft\vs2012\VC\bin;D:\gzSoft\javaTool\jdk1.7\bin;D:\gzSoft\javaTool\jdk1.7\jre\bin;D:\gzSoft\matlab\runtime\win64;D:\gzSoft\matlab\bin;D:\gzSoft\matlab\polyspace\bin;D:\software\eslib\bin;D:\gzSoft\lualib;D:\gzSoft\halcon12\bin\x86sse2-win32;D:\gzSoft\halcon12\FLEXlm\x86sse2-win32 ;C:\Program Files (x86)\Toshiba Teli\TeliCamSDK\TeliCamApi\bin\x86;C:\Program Files (x86)\CMake\bin\;D:\Program\opencv_pro\opencv-3.3.0\opencv-3.3.0\bulid\install\x86\vc11\bin;D:\gzSoft\doxygen\bin;D:\gzSoft\python2.7.10;D:\gzSoft\python2.7.10\Scripts;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;D:\Caffe\WindowsCaffeProject\caffe-master\Build\x64\Debug;
1> #$ INCLUDES="-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../include"
1> #$ LIBRARIES= "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin/../lib/x64"
1> #$ CUDAFE_FLAGS=--sdk_dir "C:\Program Files (x86)\Windows Kits\8.1"
1> #$ PTXAS_FLAGS=
1> bnll_layer.cu
1> nvcc fatal : Failed to create the host compiler response file 'x64/Debug/bnll_layer.compute_52.cpp1.ii.res'
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 7.5.targets(604,9): error MSB3721: 鍛戒护鈥"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_35,code=\"sm_35,compute_35\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env --cl-version 2013 -ccbin "D:\gzSoft\vs2013\VC\bin\x86_amd64" -I../../3rdparty/include -I../../src -I../../include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\cuda\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static --verbose --keep -Xcudafe "--diag_suppress=exception_spec_override_incompat --diag_suppress=useless_using_declaration --diag_suppress=field_without_dll_interface" -D_SCL_SECURE_NO_WARNINGS -DGFLAGS_DLL_DECL= -D_VARIADIC_MAX=10 -DWIN32 -D_DEBUG -D_CONSOLE -D_UNICODE -DUNICODE -Xcompiler "/EHsc /W1 /nologo /Od /Zi /RTC1 /MDd " -o Debug\bnll_layer.cu.obj "D:\Caffe\WindowsCaffe_detect\Caffe_Windows_Detection-master\src\caffe\layers\bnll_layer.cu"鈥濆凡閫鍑猴紝杩斿洖浠g爜涓 1銆
========== 鐢熸垚: 鎴愬姛 0 涓锛屽け璐 1 涓锛屾渶鏂 0 涓锛岃烦杩 0 涓 ==========
Ⅱ cuda error out of memory 怎么解决
今天刚把服务器搭建起来 结果程序就跑不起来 当时差点把自己吓尿了
错误类型:CUDA_ERROE_OUT_OF_MEMORY
E tensorflow/stream_executor/cuda/cuda_driver.cc:924] failed to alloc 17179869184 bytes on host: CUDA_ERROR_OUT_OF_MEMORY
W ./tensorflow/core/common_runtime/gpu/pool_allocator.h:195] could not allocate pinned host memory of size: 17179869184
Killed
其实很容易理解 大致意思就是 服务器的GPU大小为M
tensorflow只能申请N(N<M)
也就是tensorflow告诉你 不能申请到GPU的全部资源 然后就不干了
解决方法:
找到代码中Session
在session定义前 增加
config = tf.ConfigProto(allow_soft_placement=True)
#最多占gpu资源的70%
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.7)
#开始不会给tensorflow全部gpu资源 而是按需增加
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
这样就没问题了
其实tensorflow 算是一个比较贪心的工具了
就算用device_id指定gpu 也会占用别的GPU的显存资源 必须在执行程序前
执行 export CUDA_VISIBLE_DEVICES=n(n为可见的服务器编号)
再去执行Python 代码.py 才不会占用别的GPU资源
最近刚开始搞tensorflow 之前都是caffe
这周连续3天被实验室的人 举报 占用过多服务器资源 真是心累 只要用上面的方法
也就是执行代码前 执行 export CUDA_VISIBLE_DEVICES=n
只让1个或者个别GPU可见 其他GPU看不见 就行了
Ⅲ 瑙e喅锛欳UDA_ERROR_OUT_OF_MEMORY 闂棰
鍓嶈█锛氬湪鐢↘eras鎴栫洿鎺Tensorflow璁缁冨ぇ鍨嬬綉缁滄椂锛岀粡甯镐細鎶ュ傞樼洰涓" 鏄惧瓨涓嶈冻 "涓嶈冻鐨勯敊璇銆傚叾瀹炵粷澶у氭暟鎯呭喌锛氬彧鏄痶ensorflow涓涓浜烘妸鎵鏈夌殑鏄惧瓨閮藉厛缁欏崰浜嗭紙绋嬪簭榛樿ょ殑锛夛紝瀵艰嚧鍏朵粬闇瑕佹樉瀛樼殑绋嬪簭閮ㄥ垎鎶ラ敊锛
瀹屾暣鐨勫勭悊寰堢畝鍗曪紝鍙鍒嗕笅闈㈢畝鍗曠殑3姝ワ細
鍏跺疄鎿嶄綔寰堢畝鍗曪紝鐪嬩笅闈㈢殑渚嬪瓙鍗冲彲锛氬亣瀹氱洿鎺ョ敤鐨凨eras
鍙﹀栵紝鏈夋椂batch_size鐨勫ぇ灏忎篃浼氬艰嚧鏄惧瓨闂棰橈紒涓鑸涓嶈佸お澶э紝涔熶笉瑕佸お灏忋
Ⅳ CUDA程序报错 invalid argument
cudaSafeCall() Runtime API error in file...../matrix.cu,line 20: invalid argument 非法的值,数组出界
20行用的数组出界
Ⅳ CUDA程序出错“no instance of overloaded function“,求解决办法
cudaMallocPitch函数原型是下面这样的:
cudaError_t cudaMallocPitch (void ** devPtr, size_t * pitch, size_t width, size_t height)
你的pitch是不是size_t类型的,看上面好像你写成int了,改成size_t试试。再不行的话,把后面两个参数也用size_t类型的试试。
Ⅵ 如何解决CUDA error的问题
cuda中有cudaError_t这个类别,可以记录cuda错误。所有的cuda库函数,几乎都返回一个cudaError_t。
《GPU高性能编程》中使用HANDLE_ERROR宏函数,处理每个函数返回的cudaerror
static void HandleError( cudaError_t err,const char *file,int line ) {
if (err != cudaSuccess) {
printf( "%s in %s at line %d\n", cudaGetErrorString( err ), file, line );
exit( EXIT_FAILURE );
}
}
Ⅶ 挖矿需要安装cuda吗
需要。根据查询今日头条得知,挖矿需要安装cuda。CUDA,是显卡厂商NVIDIA推出的运算平台。