yurtesen

Ubuntu 12.04/12.10 - Enable OpenCL with headless/ssh with few easy steps...

Discussion created by yurtesen on Aug 6, 2012

I thought it might be useful for everyone to put this on a thread. X must be running obviously, but you dont have to login to run OpenCL programs and any user who can ssh into the box can access the GPUs.

 

1- Install Ubuntu 12.04 (confirmed to work on Ubuntu 12.10 also)

2- Edit the 'lightdm' user's shell using 'chsh lightdm' command and set it to /bin/bash

3- Open /etc/rc.local and add the following line before 'exit 0' . I realized sometimes rc.local was ran before GUI started therefore the delay is needed using sleep. Please let me know if you have a better way to run a command after lightdm loads

 

su -l lightdm -c "sleep 30 ; export DISPLAY=:0 ; xhost +local:"

 

4- Create a file /etc/profile.d/compute.sh and add the following inside (and execute 'chmod 755 /etc/profile.d/compute.sh' ):

 

#!/bin/sh

export COMPUTE=:0

#export DISPLAY=:0

#export GPU_MAX_ALLOC_PRCENT=100

#export GPU_MAX_HEAP_SIZE=100

 

if [ ! -z "$DISPLAY" ]; then

  xhost +local:

fi

 

 

(enabling the commented out entries are for your own consideration...)

 

5- X setup resets if one logs in/out from the lightdm, so it might be advisable to add the following into /etc/lightdm/lightdm.conf

 

greeter-show-manual-login=true

greeter-setup-script=/etc/profile.d/compute.sh

session-setup-script=/etc/profile.d/compute.sh

 

That seems to do the trick. Let us know your success stories.

 

Thanks,

Outcomes