FS#39203 - [nvidia] CUDA (and OpenCL) not working with nvidia 334.21; works with 331.38
Attached to Project:
Arch Linux
Opened by Ochi (ochi) - Thursday, 06 March 2014, 18:26 GMT
Last edited by Felix Yan (felixonmars) - Saturday, 29 March 2014, 02:41 GMT
Opened by Ochi (ochi) - Thursday, 06 March 2014, 18:26 GMT
Last edited by Felix Yan (felixonmars) - Saturday, 29 March 2014, 02:41 GMT
|
Details
Description:
Neither CUDA nor OpenCL applications seem to be able to run with nvidia 334.21, but they are working with 331.38 (and earlier versions). Using CUDA 5.0 or 5.5 does not seem to make a difference. Steps to reproduce: For testing CUDA, try running e.g. the "vectorAdd" example from the cuda package. The result using nvidia 334.21 is: >./vectorAdd [Vector addition of 50000 elements] Failed to allocate device vector A (error code unknown error)! For testing OpenCL, you may use this minimal program that tries to get the available platforms: http://pastebin.com/1x9gpXMf Result with 331.38 is Count = 1, Error = 0. Result with 334.21 is Count = 0, Error = -1001 (CL_PLATFORM_NOT_FOUND_KHR). |
This task depends upon
Closed by Felix Yan (felixonmars)
Saturday, 29 March 2014, 02:41 GMT
Reason for closing: Fixed
Additional comments about closing: Added nvidia-modprobe to nvidia-utils as a workaround. Real fix should be on nvidia side.
Saturday, 29 March 2014, 02:41 GMT
Reason for closing: Fixed
Additional comments about closing: Added nvidia-modprobe to nvidia-utils as a workaround. Real fix should be on nvidia side.
the installed package versions are:
nvidia 334.21-2 <- note pkgrel 2
nvidia-utils 334.21-1
nvidia-libgl 334.21-1
opencl-nvidia 334.21-1
opencl-headers 2:1.1.20110526-1
libcl 1.1-3
cuda 5.5.22-1
nvidia 334.21-2
opencl-nvidia 334.21-3
boinc 7.2.42-1
Was also working fine before 334.21 as per the initial report, and my gpu (gtx570) is picked up with the *-304xx-* packages.
-edit-
also notice that libcl has been out of date for a few months. Does this have anything to do with it?
https://www.archlinux.org/packages/extra/x86_64/libcl/
nvidia 334.21-2
opencl-nvidia 334.21-3
https://devtalk.nvidia.com/default/topic/699610/linux/334-21-driver-returns-999-on-cuinit-cuda-/post/4148890/#4148890
I'm not sure if we should do setsid though...
Moreover, upstream suggests distro-specific module loading methods over this toy:
https://github.com/NVIDIA/nvidia-modprobe/blob/master/nvidia-modprobe.c#L18
c /dev/nvidia-uvm 0644 - - - M:m
where M and m are the major and minor, respectively, of /dev/nvidia-uvm.
c /dev/nvidia-uvm 0666 root root - 246:0 (which as far as I can see matches the dev node automatically generated by nvidia)
and then your suggestion
c /dev/nvidia-uvm 0644 - - - 246:0
but it still does not work for me (e.g. the vectorAdd example from the CUDA package) even though the /dev/nvidia-uvm device nodes are generated already at boot. Starting that example application once as root makes it work... for whatever reason. Am I missing something? By the way, the 246:0 are the major/minor numbers that my device nodes generated by nvidia seem to have.
https://github.com/NVIDIA/nvidia-modprobe/blob/master/nvidia-modprobe.c#L194
These seem to be character devices with major 195. Can you add:
c /dev/nvidiactl0 0666 - - - 195:0
I'm not 100% sure about the device node name here. If it isn't nvidiactl0, it's nvidia0. I'd also be interested to know what the minimum permissions are for both of these nodes we're adding...
The problem is, the major for nvidia-uvm differs from machine to machine (and maybe even from boot to boot if hardware replaced?), the official CUDA guide [1] uses the following line to get it:
grep nvidia-uvm /proc/devices | awk '{print $1}'
I'm not sure how to implement this correctly in tmpfiles.d way though. Any ideas?
[1] http://developer.download.nvidia.com/compute/cuda/6_0/rc/docs/CUDA_Getting_Started_Linux.pdf
Quoting:
> Writing rules is not a workaround for the problem where no device nodes for your particular device exist
Anyway, the rule & script I wrote (works for me):
/etc/udev/rules.d/60-nvidia-uvm.rules
KERNEL=="nvidia_uvm", RUN+="/usr/local/bin/nvidia-uvm-probe"
/usr/local/bin/nvidia-uvm-probe
#!/bin/sh
MAJOR=$(grep nvidia-uvm /proc/devices | awk '{print $1}')
/usr/bin/mknod -m 660 /dev/nvidia-uvm c $MAJOR 0
/usr/bin/chgrp video /dev/nvidia-uvm
[1] http://www.reactivated.net/writing_udev_rules.html
================= UPDATE =================
Finally worked out an one liner udev rule (still not in the right way though):
/etc/udev/rules.d/60-nvidia-uvm.rules
KERNEL=="nvidia_uvm", RUN+="/usr/bin/bash -c '/usr/bin/mknod -m 660 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0; /usr/bin/chgrp video /dev/nvidia-uvm'"
(There're two spaces after cut -d \, but flyspray ate one when displaying :/)