Quantcast
Channel: Community : All Content - OpenCL
Viewing all articles
Browse latest Browse all 2400

Guide to run OpenCL headless, without X server and as normal user

$
0
0

You may know that you can run OpenCL program as root without Xserver. I found patch which enable running the OpenCL programs even without

 

Download catalyst driver. Then run

chmod +x amd-driver-installer-*-x86.x86_64.run
./amd-driver-installer-*-x86.x86_64.run --extract ./fglrx
cd fglrx

 

Open file common/lib/modules/fglrx/build_mod/firegl_public.c and find KCL_PosixSecurityCapCheck function.

modify this function to this

int ATI_API_CALL KCL_PosixSecurityCapCheck(KCL_ENUM_PosixSecurityCap cap)
{    if(cap == KCL_SECURITY_CAP_GENERAL_SYS_ADMIN) {        return 1;    }    if (cap >= KCL_SECURITY_CAP_NUM)    {        return 0;    }    return capable(KCL_MAP_PosixSecurityCap[cap]);
}

 

then run. change according to distro you use.

./ati-installer.sh 13.35.1005 --buildpkg Ubuntu/saucy
cd ..
sudo dpkg -i fglrx*.deb

 

reboot. now if you run clinfo it will still find only CPU. that is because there is no devices in /dev/ati/. If you run "sudo clinfo" once it will create them. after that you must change permission on them with "sudo chmod 666 /dev/ati/*" after this you can run any OpenCL program without Xserver running and as a normal user. To setup /dev/ati permission you can add upstart job. Place this script to /etc/init/opencl.conf

description "Set up /dev/ati/"

start on filesystem

script
    clinfo > /dev/null    chmod 666 /dev/ati/*
end script

 

This can enable privilege escalation. Use on your own risk.

 

Thanks to lgeek/catalyst-test-compat-headless-opencl · GitHub


Viewing all articles
Browse latest Browse all 2400

Trending Articles