Reputation: 1299
I have searched for the reason but no luck. It fails on such a simple program:
#include <iostream>
using namespace std;
int main() {
int* n;
cout << cudaMallocManaged(&n, 4 * sizeof(int)) << endl;
return 0;
}
The return code is 30, unknown error. cudaMalloc
also fails with same code.
This is my hardware:
$ lspci | grep NV
01:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/820M / GT 620M/625M/630M/720M] (rev a1)
$ nvidia-smi
Sat Mar 7 14:02:04 2015
+------------------------------------------------------+
| NVIDIA-SMI 331.113 Driver Version: 331.113 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 NVS 5200M Off | 0000:01:00.0 N/A | N/A |
| N/A 53C N/A N/A / N/A | 279MiB / 1023MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Compute processes: GPU Memory |
| GPU PID Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+
I am using Ubuntu 14.10, with CUDA 6.0 from official repository(hopefully, if Ubuntu does not mess it up).
It is a Lenovo T430s labtop, the card is on Optimus so that might cause some problem. I have tested on another machine and the same code works.
Update 1
OK, nvidia_uvm
is not loaded...
$ lsmod |grep nv
nvidia 10744914 65
nvram 14362 1 thinkpad_acpi
drm 310919 6 i915,drm_kms_helper,nvidia
$ sudo modprobe nvidia_uvm
modprobe: ERROR: ../libkmod/libkmod-module.c:816 kmod_module_insert_module() could not find module by name='nvidia_331_updates_uvm'
modprobe: ERROR: could not insert 'nvidia_331_updates_uvm': Function not implemented
Update 2
OK, I reinstalled nvidia-331-updates-uvm and the module was loaded.
$ lsmod | grep nv
nvidia_uvm 34855 0
nvidia 10744914 66 nvidia_uvm
nvram 14362 1 thinkpad_acpi
drm 310919 6 i915,drm_kms_helper,nvidia
However, the code still returns error 30.
Update 3
After some more testing (mainly tried running as root), now I get error 71: operation not supported. However, if I am just using cudaMalloc
it succeeded. I will also check whether my device support unified memory addressing.
Update 4
OK, my card only supports SM 2.1, so it does not support Unified Memory.
Upvotes: 1
Views: 4330
Reputation: 4110
AFAIK nvidia_uvm
kernel module is required for CUDA to work.
You need to install package with that kernel module, e.g. nvidia-331-uvm
and
enable it's autoloading by installing nvidia-modprobe
package:
sudo apt-get install nvidia-modprobe nvidia-331-uvm
If you don't want to reboot after installing nvidia-modprobe
, you can try to run your program as root (e.g. sudo ./a.out
) — module should be loaded during run as root.
Upvotes: 1