Best practice with AMD GPU on Ubuntu?


(Benedikt Steinle) #21

Okay guys, I’m back on my machine and just had a look: I installed Ubuntu 18.04.1 LTS, which is in the meantime upgraded to 18.04.2. I installed the Arc theme and Numix circular icons.
The graphics driver was installed with this option: ./amdgpu-pro-install -y --opencl=pal,legacy
… I guess this installed both options which might not be perfect.

But I think I’ll give Linux Mint Cinnamon a try. It looks really slick and maybe, the problem is gone as soon as I am on a clean system … I’d install the amd gpu pro only with this option this time: ./amdgpu-pro-install -y --opencl=pal

What do you think?


#22

Hi Bene,
Would you be able to provide information on your system hardware? Also, do you have any crash reports you could post?

Upon searching StartPage, I see others have had this issue. One thread said his system would freeze with any graphics intensive games. Per his word; He was able to resolve by installing non generic kernals that are used with most distros. Here is a link to said thread (https://bugs.freedesktop.org/show_bug.cgi?id=105733). First post descripes his issue, last two show how he was able to resolve the problem. Between he did some hardware replacements.

Keep in mind, I’m helping by doing what I do when I have problems :grin: Reading the link above about his hardware opened my eyes to potential conflicts with some pieces of my build.


(Benedikt Steinle) #23

Hi Nathan,
I just wanted to write here that I did a second try:
I installed Linux Mint 19.1, wiping Ubuntu (the GUI feels waaaay more mature than ubuntu’s) and started setting up everything. There seems a thing with the amd gpu pro still: It doesn’t recognize Mint as a Ubuntu base, so I had to change the os-release file temporarily as described here and changed it back later.
The installation seemed to work fine and when I check, the driver seems to be there (see attached screenshot). But still, Blender doesn’t recognize any OpenCL device.
Do you have any ideas? How can I check if the OpenCL drivers work properly?

As for my machine, it’s an old Lenovo ThinkStation S20 (see detailed specs here) with 12GB of RAM and a Radeon RX 580 8GB, running on an Angelbird wrk SSD 256GB. The OpenCL stuff works fine on Manjaro, only struggling in Ubuntuland ATM :frowning:


#24

I’m not 100% sure how to check and TBH this might be above my head. However, I was able to find this topic which has some information from an older Ubuntu https://askubuntu.com/questions/850281/opencl-on-ubuntu-16-04-intel-sandy-bridge-cpu if you scroll down there is a “test if this worked” which has the ‘clinfo’ command I’ve seen referenced elsewhere.


(Benedikt Steinle) #25

Thanks for pointing me that way, Nathan!

I got the clinfo to work and it prints the below information. But still, no OpenCL in Blender.

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (2766.4)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     Ellesmere
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.2 AMD-APP (2766.4)
  Driver Version                                  2766.4
  Device OpenCL C Version                         OpenCL C 1.2 
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon RX 580 Series
  Device Topology (AMD)                           PCI-E, 02:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               36
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                16
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1366MHz
  Graphics IP (AMD)                               8.0
  Device Partition                                (core)
    Max number of sub-devices                     36
    Supported partition types                     None
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
  Preferred work group size multiple              64
  Wavefront width (AMD)                           64
  Preferred / native vector sizes                 
    char                                                 4 / 4       
    short                                                2 / 2       
    int                                                  1 / 1       
    long                                                 1 / 1       
    half                                                 1 / 1        (cl_khr_fp16)
    float                                                1 / 1       
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     No
    Infinity and NANs                             No
    Round to nearest                              No
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              6793506816 (6.327GiB)
  Global free memory (AMD)                        6614508 (6.308GiB)
  Global memory channels (AMD)                    8
  Global memory banks per channel (AMD)           16
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           4244635648 (3.953GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       2048 bits (256 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        16384 (16KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   256 bytes
    Pitch alignment for 2D image buffers          256 pixels
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                8
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Local memory syze per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        4244635648 (3.953GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        No
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        1552237805476987835ns (Sun Mar 10 18:10:05 2019)
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  Yes
    Number of async queues (AMD)                  2
    Max real-time compute queues (AMD)            0
    Max real-time compute units (AMD)             80
    SPIR versions                                 1.2
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                
  Device Extensions                               cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_gl_event 

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              Success [AMD]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere


(mathieu) #26

Normally this should help for AMD OpenCL on Ubuntu/Mint:

  • newest kernel for AMD-GPU-PRO openCL driver to be able to work:
sudo apt-add-repository -y ppa:teejee2008/ppa
sudo apt update
sudo apt install ukuu

then launch ukuu and install a kernel >= 4.19

  • latest mesa for open source OGL/vulkan driver:
sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update
  • get driver from AMD and (version number may differ):
cd path/to/amdgpu-pro-18.50-708488-ubuntu-18.04/
'./amdgpu-pro-18.50-708488-ubuntu-18.04/amdgpu-pro-install' --opencl=pal --headless

On Mint, you have to edit the version number (it looks for 18.04).
sudo geany /etc/os-release
You should modify this 19.1 or so to 18.04 (restore after installing the driver). Then relaunch the install script.


(Benedikt Steinle) #27

Yes! That did the trick! TBH I didn’t even know that the latest Ubuntu/Mint on a relatively old kernel …
So I got the Open CL support to work with the right kernel, but I still got system freezes as soon as I switch to Cycles. :frowning:

From what I understand, this could be because I started those files in Manjaro and that doesn’t go together with the Mint setup somehow (I also have problems with linked content in other files), or it is a combination of the CPU and GPU in Open CL mode. Still, in Manjaro everything works. I am on Kernel version 4.19.24-1 there.

UPDATE:
It seems that the freeze isn’t necessarily (only) connected to Open CL. I just made up a new test scene which previewed and rendered just fine in Cycles. But then I copied a file which I built in Manjaro to the desktop and it takes ages to even preview. It always gets stuck at the lowest preview solution and the entire Mint GUI freezes. Can this be because of some absolute links in the file or sth?


#28

Have you tried a lower version of Blender to see if this works? I ask because 2.8 is still in beta and this could be a known issue with OpenCL - only my guess as you are on a beta release and this could be a known issue, which might be mentioned in the official release notes (once a stable 2.8x is officially released later this year). On a separate note and if memory serves, Cycles hasn’t worked well with AMD in the past and has favored CUDA.

Unfortunately, I’m not able to test anything on my system with Blender 2.8 as my aged system (2007) is on a lower version of OpenGL (2.1) and has only onboard video.


(mathieu) #29

Well, with the solution I mentioned (which is the only one for Ubuntu LTS users), you are using an OS with an unsupported kernel version, using an unsupported alpha driver (latest mesa GIT), to run an experimental version of Blender with over 1000 bugs opened, so… expect rough edges :smiley:


(Benedikt Steinle) #30

Yeah, seems so. I am still wondering if there isn’t a more robust setup for blender on Linux. On the one hand, I can’t use Ubuntu 18.04.10, on the other hand, with the lts version, e. G. Mint, I have to manually update the kernel. All in all, and to be brutally honest, all this hasn’t surpassed the windows experience yet :slight_smile:

How could I check if anything corrupts my files that I built in Manjaro and want to finish in Mint? Can I edit them in a text editor and maybe change the paths or so? Or is there any type of cycles cache in the files which I should purge?


(Markus Mayer) #31

By now I start wondering, if the 580 itself is the problem. I never had these problems with my VEGA.


(ajm) #32

The file you built in Manjaro should work just fine, GNU/Linux is GNU/Linux no matter the distro. File systems and structure are the same, where the tools, package managers and pre-installed software may differ. Check your software center and make sure you have the Ocl-icd-libopencl1 and Opencl-c-headers installed. Start blender from the terminal by navigating to the directory and typing ./blender, if there are any errors, they will show up in the terminal and you might find the culprit. Blender on Linux systems don’t have the console like Windows and uses the terminal for this functionality.

I am on Mint 19.1 using the 4.19.xx kernel and things are working fine, but I have nVidia, and there are OpenCL issues there as well an you need to have the libraries. There is one other library that I am forgetting something like libOpenCL.so.1, but this was for nVidia, and this stuff may be included in AMD already.

And did you follow this process
https://linuxconfig.org/install-opencl-for-the-amdgpu-open-source-drivers-on-debian-and-ubuntu


(Benedikt Steinle) #33

Hmm … maybe tonite I can upload one of the files making troubles. I’m not totally sure if it’s the files itself or the Manjaro/Mint jump.

Concerning the process described in the link: As I get it right, then this should work with the standard kernel of Mint, right? Maybe I should give this a try. The last time(s), I used the standard process described by AMD (with the name and version changing hack in the os-release file). I would definitely give this one a try.


(ajm) #34

It should work, but I can’t guarantee it since I don’t have AMD graphics. I would also think that this would work with any long term service kernel, but if not you can always roll it back.


(Benedikt Steinle) #35

Okay … I’m starting to think that the latest blender 2.8 version is the problem (yes I know, it’s beta …). I just did a test:

As I can’t open my 2.8 sessions with 2.79, I did this:

  • Append all objects of the previously crashed scene to a fresh scene in 2.8 – CRASH.
  • Append all objects of the previously crashed scene to a fresh one in 2.79 – WORKS.

So I pulled the 2.8 build which I used on Manjaro from 2019-02-24, and the loading of the render kernels takes ages again, but it works … guess they’re working on the implementation of OpenCL atm.
And yes, I guess you were right, @Blend_in_Linux :slight_smile:


(Benedikt Steinle) #36

Bummer … I just realized that the crashes seem to be related to the graphics. I launched Blender from the terminal and after trying to switch to Eevee or Cycles preview in a bigger project, I got this:

GPUTexture: create : TEXTURE_2D_ARRAY, R16F, w : 4096, h : 4096, d : 1, comp : 1, size : 32.00 MiB
GPUTexture: texture alloc failed. Likely not enough Video Memory.
Current texture memory usage : 32.00 MiB.
Writing: /tmp/YAYville-Comp-Y1-v7-ubuntu.crash.txt
Speicherzugriffsfehler (Speicherabzug geschrieben)

So there might be anything wrong with the driver or OpenCL, isn’t it? The RX580 has 8GB of video ram and it crashes with 32 MB?

I also read through what @Blend_in_Linux wrote, but somehow I can’t believe it’s a RAM issue, as it is working fine in Manjaro. Should I try another Kernel? I’ve got 4.19.28 running (Installed with UKUU as @bliblubli described).
One question though: As I understood, the headless option isn’t right for me, because it is missing some parts of the driver. Am I right or should I give it a try?

EDIT: This is what clinfo provides:

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (2766.4)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     Ellesmere
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.2 AMD-APP (2766.4)
  Driver Version                                  2766.4
  Device OpenCL C Version                         OpenCL C 1.2 
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon RX 580 Series
  Device Topology (AMD)                           PCI-E, 02:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               36
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                16
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1366MHz
  Graphics IP (AMD)                               8.0
  Device Partition                                (core)
    Max number of sub-devices                     36
    Supported partition types                     None
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
  Preferred work group size multiple              64
  Wavefront width (AMD)                           64
  Preferred / native vector sizes                 
    char                                                 4 / 4       
    short                                                2 / 2       
    int                                                  1 / 1       
    long                                                 1 / 1       
    half                                                 1 / 1        (cl_khr_fp16)
    float                                                1 / 1       
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     No
    Infinity and NANs                             No
    Round to nearest                              No
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              7717908480 (7.188GiB)
  Global free memory (AMD)                        7517436 (7.169GiB)
  Global memory channels (AMD)                    8
  Global memory banks per channel (AMD)           16
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           4244635648 (3.953GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       2048 bits (256 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        16384 (16KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   256 bytes
    Pitch alignment for 2D image buffers          256 pixels
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                8
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Local memory syze per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        4244635648 (3.953GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        No
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        1552341092424511000ns (Mon Mar 11 22:51:32 2019)
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  Yes
    Number of async queues (AMD)                  2
    Max real-time compute queues (AMD)            0
    Max real-time compute units (AMD)             80
    SPIR versions                                 1.2
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                
  Device Extensions                               cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_amd_bus_addressable_memory cl_khr_spir cl_khr_gl_event 

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              Success [AMD]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere


(Benedikt Steinle) #37

Hey guys!
Believe it or not, I am still at it …

So I am still getting this error when trying to render scenes I built in blender on Manjaro (one of them has linked objects in it).
But today, I downloaded two blender 2.8 demo files and played around with them. Interestingly, where those manjaro files crash immediately, those ones (one is 299MB) work just fine, no matter if in cycles or eevee. Can it be that those manjaro files struggle with some linked elements? I am not sure about that, because strangely, when I look up the console, the linked file paths seem to be updated automatically.
I don’t really have an idea …


(Markus Mayer) #38

Well, in general .blend files are system agnostic. They are binary files. Otherwise we couldn’t share between Win Mac and Linux.
Of course there is a chance, that your files became corrupted or weren’t saved correctly in the first place.
Maybe you used textures and didn’t pack them? But then those should only be missing and the file itself should load.


(Benedikt Steinle) #39

It’s really weird … as far as I could test right now, only files with linked objects seem to be affected. But I’ll check into that further during the weekend. Next thing I would check is if the problem persists when the linked objects are appended instead of linked. If this works then, at least I know what the problem is. Will check the textures as well. Let’s see …


(Benedikt Steinle) #40

While still crashing Blender with every attempt to activate LookDev or Rendered view on the files I built in Manjaro, I managed to rebuild the files appending all elements in new files, and guess what … they work without any flaw.
I still have no idea why it crashes – keeping in mind that .blend files are binary, it makes no sense other than an issue with some linked asset, but at least I know how to work around the issue.
Still, it always crahses with ‘GPUTexture: texture alloc failed. Likely not enough Video Memory.’ – but to me it seems that it’s not really a memory failure, rather something wrong inside a link or so.