On Ubuntu 16.04, fglrx support was dropped and currently the opensource driver AMDGPU is still in an early stage and only supports very limited devices. I attempted to make the OpenCL part of fglrx working and made a modified fglrx package providing OpenCL support on Ubuntu 16.04. There is still no X support, so if you want to use X you have to use another GPU with X11 driver. The modified driver can co-exist with radeon, so you can just grab a low-end AMD card for display only. The followings are the changes I made:
The modified package can be downloaded here (if many people find it helpful, I will consider creating a PPA):
Link 2: MEGA
1. Remove any existing fglrx packages and install the modified package:
sudo dpkg -i fglrx-core_15.302-0ubuntu1_amd64.deb
sudo apt-get install -f # Fix any broken dependencies
2. If you want to use radeon for one of your GPUs for display, you need to modify /etc/modprobe.d/fglrx-core.conf.
Otherwise, it should be compatible with other display drivers. In my case I have a HD 6450 card for display only, and a R9 280X for compute. According to "lspci -nn" the device ID for HD 6450 is 6779. So I add the following line to /etc/modprobe.d/fglrx-core.conf:
options fglrx blocked_devs=6779
In this way I can run X through HD 6450 and run OpenCL applications on R9 280X. After changing this option you also need to update initramfs:
sudo update-initramfs -u
3. Reboot. Check dmesg and verify that fglrx is loaded before radeon, and radeon is not using the card for OpenCL. Then try clinfo.
If your X.org won't start and complains, you need to give it some hints on finding the correct display GPU by adding a "Device" section to /etc/X11/xorg.conf
# Change the Driver name to the driver of your display GPU (radeon, intel, nouveau, etc)
# Change the BusID to the PCI BusID given by lspci of your display GPU
# Please note that the numbers given by lspci is hexadecimal and you need decimal here
I have tested my package on Ubuntu 16.04 LTS with R9 280X and R9 270X. OpenCL works flawlessly in headless mode and in X mode (X runs on the other display-only GPU with the radeon driver). It should work with other GCN-based cards as well. If you find this package useful, please share your experience and feedback here. If it does not work for you, please provide your dmesg and I can take a look. Thanks!
Welcome to the AMD DevGurus. You've been added to the whitelist. Now, you can post anywhere in DevGurus.
I'm moving this thread to OpenCL forum.
You may try GPU_DEVICE_ORDINAL environment parameter for that purpose.
As AMD Programming User guide (section "Masking Visible Devices" ) says:
"By default, OpenCL applications are exposed to all GPUs installed in the system; this allows applications to use multiple GPUs to run the compute task.
In some cases, the user might want to mask the visibility of the GPUs seen by the OpenCL application. One example is to dedicate one GPU for regular graphics operations and the other three (in a four-GPU system) for Compute. To do that, set the GPU_DEVICE_ORDINAL environment parameter, which is a comma--separated list variable:
Under Windows: set GPU_DEVICE_ORDINAL=1,2,3
Under Linux: export GPU_DEVICE_ORDINAL=1,2,3