cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

nou
Exemplar

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

EDIT: this guide is no more relevant as from catalyst 14.12 omega it is supported to run OpenCL applications without Xserver. read discussion below.

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

0 Likes
18 Replies
natasha
Elite

Good afternoon.

I have tried this with my laptop,

# lspci | grep 'VGA\|ATI'

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)

01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Mars [Radeon HD 8670A/8670M/8750M]

hoping to enable discrete AMD card for OpenCL (I cannot start X in ordinary way, the problem is described in Intel HD 4000 + AMD Radeon HD 8750M + Linux). I have installed driver with change as it is described, rebooted to the multiuser level, without X. But running clinfo as root leads to "Segmentation fault". With independently written OpenCLInfo I found that this is in the stage of clGetPlatformIDs.

Could you tell, what is wrong and how is it possible to fix this (if possible, of course)?

Thank you in advance,

Natalia

0 Likes
yurtesen
Miniboss

This does not seem to work anymore with the Omega drivers.

With omega drivers it is not need to patch driver anymore. Just build packages as normally with --buildpkg option and install only fglrx-core_*.deb package. After restart you need to run clinfo as root once so it load devices in /dev/ati. You can use script from original post. After that you can run any OpenCL program as normal user without X server. Oh and there is bug that cause driver crash if it doesn't find "/etc/ati/amdpcsdb.default" file which is inside fglrx_*.deb package. So extract this file from fglrx package and put it into /etc/ati directory.

0 Likes

Are you sure? I just used the installer to install omega packages and as root I see 3 GPUs (1 integrated 2 discrete) but as normal user only the ones which are mentioned in xorg.conf are mentioned. Also when X is not running, user sees no GPUs.

I see

  Device OpenCL C version:     OpenCL C 2.0
  Driver version:     1642.5 (VM)

In the clinfo. So pretty sure that the driver is installed (also I installed it several times over itself, rebooted the machine etc. in between.

Yet, it just doesnt seem to be working? (on Linux)

0 Likes

I am sure. I have testing Ubuntu server installation. I installed only fglrx-core package and after initial "sudo clinfo" I can run OpenCL programs on GPU. It spit some error about permission but then it runs fine.

I also had issues getting it to work, but it turned out to be because the AMD APP SDK was installed on the machine, and LD_LIBRARY_PATH and OPENCL_VENDOR_PATH were set to point to that installation. When running with sudo, the environment variables were cleared (an effect of sudo), which made things work.

0 Likes

bmerry, your last sentence was confusing... the way it's written you are saying "sudo clearing the environmental variables made things work." Please clarify, did you end up using "sudo -E clinfo"?

0 Likes
yurtesen
Miniboss

Hmm, you seem to be correct. Thanks for the info. I have found out that I only see GPUs set in the X config when I export the COMPUTE=:0 env variable (the DISPLAY env variable seem to have no effect). EDIT: I meant the 3rd GPU does not appear when COMPUTE=:0 is set.

0 Likes
fizxmike
Journeyman III

I am running Ubuntu 12.04. I uninstalled my xserver-xorg packages (I am running a server).

I built the fglrx packages using:

./ati-installer.sh 14.501.1003 --buildpkg Ubuntu/precise

I extracted /etc/ati/amdpcsdb.default from fglrx_*.deb

I installed using:

dpkg -i fglrx-core_14.501-0ubuntu1_amd64.deb

I rebooted.

I can run /opt/AMDAPPSDK-3.0-0-Beta/bin/x86_64/clinfo as root, but it hangs for about 2 to 3 minutes, then spits out the AMD card and Intel processor information.

Then I do "chmod 666 /dev/ati/*"

When I run /opt/AMDAPPSDK-3.0-0-Beta/bin/x86_64/clinfo as a regular user, it likewise hangs for about 2 to 3 minutes, then spits out the AMD card and Intel processor information.

However, If I do "export COMPUTE=:0" as a regular user and run /opt/AMDAPPSDK-3.0-0-Beta/bin/x86_64/clinfo, there is no hang, BUT, the AMD card DOES NOT show up, only the Intel processor.


Any ideas on how to eliminate the hang or make the AMD card show up after "export COMPUTE=:0"


Thanks in advance,

Michael

0 Likes

I am running 14.04 server. So maybe there is difference.

0 Likes

Same issue with Ubuntu 14.04 server (clean install).

I used the pre-built packages from here (Installed the Dev files, and the Non-X support driver, and extracted /etc/ati/amdpcsdb.default from the standard package):

http://support.amd.com/en-us/download/desktop?os=Ubuntu+x86+64

And still got the long hang for 2-3 minutes and eventual completion of clinfo in AMD APP SDK 2.9.

Which AMD APP SDK did you install?

Is anyone else really using AMD cards in a server/cluster environment? Should I try Red Had instead?

0 Likes

I didn’t install SDK. I just manually extracted the examples to test them.

0 Likes

Just to chime in here:

I've got the latest Catalyst drivers installed and clinfo will show GPU device on a local X. However, through ssh as a normal user, clinfo gives the error

No protocol specified

No protocol specified

Error: No root privilege. Please check with the system-admin.

No protocol specified

No protocol specified

If I then run clinfo as sudo I get

No protocol specified

No protocol specified

No protocol specified

No protocol specified

In both cases, no GPU device is shown I've changed the permissions in /dev/ati. This is on Ubuntu 14.04 with no AMD SDK.

Any help would be much appreciated! (AMD making this stuff just work would be even more appreciated ).

0 Likes

Just want to let you know driver engineers are digging into this. If/when we get something solid, we'll post it here.

Is there an update to this?

0 Likes

Try to read this.

0 Likes

Just to be clear, headless = no X, no DISPLAY, etc.

0 Likes

Hi All,

Since this guide is no more relevant as from catalyst 14.12 omega it is supported to run OpenCL applications without

X server.

     I request, some one please share the steps to start Opencl development on AMD APU 7850K based systems.

      Which drivers and SDKs do I need to install so that I can use the 7850K without X server and program in OpenCL.

      Thanks in advance.

Regards,

Ameet