是用的happnear的caffe-windows,但是移植的時候,配置中少了USE_CUDNN,所以報這個錯(轉換數據和調用模型都出現這個問題),然后才知道
最大能力編譯版本,提示invaild argument,說明batchsize還是太大了,爆了緩存
invaild function應該是超出支持能力
invaild argument,就是明顯的爆顯卡了
網上也看到了 Check failed: error == cudaSuccess (8 vs. 0) invalid device function,大致的問題也就是說這個 其實還就是要設置顯卡的計算能力。
我改為這個之后,運行模型,出現了loss=1.#QNAN
網上查了下
QNAN是指Quiet Not a Number,類似的浮點錯誤還有SNaN(Signaling Not a Number),通常如0.0/0.0、給負數開平方根等溢出或無效運算就會產生一個NAN結果的表示值,NaN及兩種浮點錯誤的說明如下:
The value NaN (Not a Number) is used to represent a value that does not represent a real number. NaN’s are represented by a bit pattern with an exponent of all 1s and a non-zero fraction. There are two categories of NaN: QNaN (Quiet NaN) and SNaN (Signalling NaN).
A QNaN is a NaN with the most significant fraction bit set. QNaN’s propagate freely through most arithmetic operations. These values pop out of an operation when the result is not mathematically defined.
An SNaN is a NaN with the most significant fraction bit clear. It is used to signal an exception when used in operations. SNaN’s can be handy to assign to uninitialized variables to trap premature usage.
Semantically, QNaN’s denote indeterminate operations, while SNaN’s denote invalid operations. If a return value is a QNaN, it means that it is impossible to determine the result of the operation, a SNaN means that the operation is invalid.
這樣的特殊浮點數還有INF和IND:INF就是Infinity,表示一個無窮大的數,包括正無窮和負無窮;IND則表示無限小,但不確定。如1.0/0.0會產生一個INF無窮大,-1.0/0.0會產生一個負無窮大。
除0操作的意思是,Quiet Not A Number,也就是不會觸發浮點異常的NaN,而NaN是“不是一個數”的意思。通常你得到這種結果一般通過
-
+/- 無窮大除以+/-無窮大
-
+/- 無窮大之間的加減法
-
sqrt的參數是負數
等
我的問題,應該是我的顯卡是960M,而之前參考的是
常見的GPU的Code Generation如下:
但是
筆記本版本的顯卡和台式機的計算能力是有差距的。所以問題就在這里,把caffelib中Configuration Properties的CUDA C/C++中Device中的Code Generation改為compute_50,sm_50;。就可以了。
感覺,其實 這樣,搞下來,可能 caffe的錯誤,會全部 過一輪。