GPU access to a newly created user in Linux (Ubuntu)

08
2014-07
  • user1953384

    I have a desktop computer with an Nvidia GPU, and the Python machine learning library Theano installed on it. Theano uses the GPU for carrying out certain computations.

    When I start IPython and import Theano, I get a notification that the GPU is being used. Likewise, when I run a test script, I get a confirmation about the same. However, I recently added a new user to my computer as follows:

    sudo useradd -m -g fbar -G plugdev -s /bin/bash -c "Foo Bar" fbar
    

    This user is unable to access the GPU in the same two cases I just described which worked for me.

    I'll also post this in the Theano users group as I'm not sure whether it's a problem with access at the OS level or Python level or the module level. Please let me know if you need any additional information.

    Thanks!

    EDIT:

    On Rich's suggestion, I tried id with both users. Initially the second user (who cannot access the GPU) was not in some of the groups the first one was in. I made them both the members of the same groups. So now id returns the following for both users:

    uid=1000(myusername) gid=1000(myusername) groups=1000(myusername),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare)
    

    Only difference is that for the second user uid and gid are 1001. Still he cannot access the GPU.

    The output of

    $ ls -l /dev/nvidia*
    

    looks like this:

    crw-rw-rw- 1 root root 195,   0 May 30 17:42 /dev/nvidia0
    crw-rw-rw- 1 root root 195, 255 May 30 17:42 /dev/nvidiactl
    

    Any other suggestions? I'll go read what those columns mean. Thanks!

  • Answers
  • user1953384

    Ok, so it turns out I was barking up the wrong tree. The group permissions, etc. were all ok. I just had to create a .theanorc file in the second user's home folder with the following code

    [global]
    device=gpu
    

    I should really pay more attention while reading the library documentation. Thanks to those who tried to help!


  • Related Question

    Linux Ubuntu Lucid doesn't detect my second GPU card
  • jldupont

    Since I have upgraded to Ubuntu 10.04 Lucid Lynx, my second graphics card isn't detected by X server. When I do an lspci I get both listed though.

    What could be the issue?

    I am using NVidia's driver v195.36.24


  • Related Answers
  • kmarsh

    Try this shell command (may need to be root, may need to add path to nvidia-xconfig to PATH):

    nvidia-xconfig --sli=Auto