Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to compile on ubuntu? #6

Open
akosmaroy opened this issue Jul 18, 2017 · 8 comments
Open

how to compile on ubuntu? #6

akosmaroy opened this issue Jul 18, 2017 · 8 comments

Comments

@akosmaroy
Copy link

could you be more specific in what are the dependencies for this app to be compiled under ubuntu 17.04?

this is how for I get:

$ make
g++ -Wall -O3 -std=c++11 -I/home/mat/docs/src/ADL_SDK9/include -c -o amdcovc.o amdcovc.cpp
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/os_defines.h:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h:507,
                 from /usr/include/c++/6/iostream:38,
                 from amdcovc.cpp:21:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~~~~~
amdcovc.cpp:40:19: fatal error: CL/cl.h: No such file or directory
 #include <CL/cl.h>
                   ^
compilation terminated.
Makefile:26: recipe for target 'amdcovc.o' failed
make: *** [amdcovc.o] Error 1

@matszpk
Copy link
Owner

matszpk commented Jul 18, 2017

In your case, OpenCL includes are missing. Please, install OpenCL headers (from opencl icd or other package). If you have AMDGPU-PRO drivers, please add extra library directory ("-L/opt/amdgpu-pro/lib/x86_64-linux-gnu/") to LIBDIR for OpenCL library. If you are using opencl-icd or Mesa OpenCL, then an extra library directory is obsolete.

@akosmaroy
Copy link
Author

yes, AMDGPU-PRO, but I don't know where to get OpenCL headers from. the package mentioned is installed:

$ sudo apt-get install opencl-amdgpu-pro-icdReading package lists... Done
Building dependency tree       
Reading state information... Done
opencl-amdgpu-pro-icd is already the newest version (17.10-429170).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

but that does not include the header file missing:

$ find /opt/amdgpu-pro/ -name cl.h

this I get the same error as above.

I tried installing mesa-opencl-icd, but the results are the same

@matszpk
Copy link
Owner

matszpk commented Jul 18, 2017

mesa-opencl-icd is obsolete. you can get OpenCL headers from www.khronos.org site. maybe exist package named as 'opencl-headers' or with similar name in ubuntu repository.

@akosmaroy
Copy link
Author

akosmaroy commented Jul 18, 2017

thanks. I got it to compile, had to install the following:

apt-get install ocl-icd-opencl-dev libpci-dev

and of course ADL_SDK V10 from http://developer.amd.com/display-library-adl-sdk/

thanks for the pointers

the app starts up and shows diags, but doesn't work as expected. the issue might be with the performance levels. this is on an RX 580 card:

$ ./amdcovc -a 0
Adapter 0: Ellesmere [Radeon RX 470/480]
  Core: 300 MHz, Mem: 300 MHz, CoreOD: 0, MemOD: 0, Temp: 64 C, Fan: 40%
  Core clocks: 300 600 900 1162 1233 1275 1319 1360
  Memory Clocks: 300 1000 1750
$ ./amdcovc -v -a 0
Adapter 0: Ellesmere [Radeon RX 470/480]
  Device Topology: 1:0:0
  Vendor ID: 4098
  Device ID: 26591
  Current CoreClock: 300 MHz
  Current MemoryClock: 300 MHz
  Core Overdrive: 0
  Memory Overdrive: 0
  Current BusSpeed: 0
  Current BusLanes: 1
  Temperature: 67 C
  Critical temperature: 0 C
  FanSpeed Min (Value): 0
  FanSpeed Max (Value): 255
  Current FanSpeed: 32.9412%
  Controlled FanSpeed: no
  Core clocks:
    300MHz
    600MHz
    900MHz
    1162MHz
    1233MHz
    1275MHz
    1319MHz
    1360MHz
  Memory Clocks:
    300MHz
    1000MHz
    1750MHz

note that the performance level is not displayed. at the same time:

$ cat  /sys/class/drm/card1/device/pp_num_states 
states: 2
0 boot
1 performance
$ cat  /sys/class/drm/card1/device/pp_cur_state
1

trying to change the memory clock for example doesnt' work:

$ sudo ./amdcovc memclk:0=1750
WARNING: setting AMD Overdrive parameters!

IMPORTANT NOTICE: Before any setting of AMD Overdrive parameters,
please STOP ANY GPU computations and GPU renderings.
Please use this utility CAREFULLY, because it can DAMAGE your hardware!

Setting memory clock to 1750 MHz for adapter 0 at performance level 0
$ ./amdcovc -a 0
Adapter 0: Ellesmere [Radeon RX 470/480]
  Core: 300 MHz, Mem: 300 MHz, CoreOD: 0, MemOD: 0, Temp: 67 C, Fan: 22.7451%
  Core clocks: 300 600 900 1162 1233 1275 1319 1360
  Memory Clocks: 300 1000 1750

see it remain at 300Mhz

trying to set performance level 1 fails:

$ sudo ./amdcovc memclk:0:1=1750
WARNING: setting AMD Overdrive parameters!

IMPORTANT NOTICE: Before any setting of AMD Overdrive parameters,
please STOP ANY GPU computations and GPU renderings.
Please use this utility CAREFULLY, because it can DAMAGE your hardware!

Performance level out of range in 'memclk:0:1=1750'!
NO ANY settings applied. Error in parameters!
Wrong parameters!

the same happens if I use ADL_SDK 9 or 10.

what am I doing wrong?

@int03h
Copy link

int03h commented Jul 18, 2017

First and foremost AMDGPU-PRO isn't supported on 17.04 since it uses 4.10 kernel and AMDGPU-PRO's DKMS won't build on any kernel >= 4.10. So you won't have a driver to probe EVEN if you can get it built.

I can't tell if you have the AMDSDK is installed ( NOT THE ADL ). If you are doing anything with the driver usually you need the SDK.

Mesa OpenCL is either WIP/ or outdated ( depending on who you ask ). i.e. it doesn't work.

There is a tool very similar to amdcovc that AMD provides (and recently started updating). There is a compiled binary provided. https://github.com/RadeonOpenCompute/ROC-smi see if you can get it to talk to anything you have, if it can't you don't have a working driver stack. ( You don't need the ROCM extensions installed in order to probe the driver or build the tool. It will move between CLK's and power levels but I suppose it is intended for VEGA. However, since It is built ontop of the amgpu and ampgu-pro stack, so it has SOME functionality and is useful to some extent )

@akosmaroy
Copy link
Author

thanks for the pointer. the ROC-smi tool also seems to be 'read only', e.g. it can display info, but it cannot seem to change it

maybe a downgrade to 16.04 LTS would make a difference. I'll take a look...

@int03h
Copy link

int03h commented Jul 18, 2017

Most of the functionality that you will see comes from the sysfs drivers that are exposed by amgpu in the kernel. You can interact with some of them, like the fans .. the rest require "more cowbell!".. like AMDSDK, AMDGPU-PRO or ROCM .. don't bother with later kernels .. most of the more interesting amgpu merges are ongoing and they are all very much out of sync with each other.. i.e. the kernel keeps moving forward, AMD keeps trying ( badly ) to catch up, while Ubuntu remains stuck in the distant past. I suppose this is not the place to get philosophical but it really is in a rather pathetic state at the moment, and the most noticeable effect of all of this, is the inability to control (or even probe) some of the most basic things. If you don't mix all the right ingredients together, none of it works.

@minzak
Copy link

minzak commented Jul 21, 2020

Also fine work with ROCK 3.5.0 version under Debian10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants