OpenCL clCreateCommandQueue() fails with error -6(out of host memory) on Ubuntu 16.04.3 64 bit, AMDGPUPRO driver 17.30 465504

Hello,

I'm trying to use OpenCL 1.2 on the following environment:

- DELL Workstation T7910

- AMD FirePro W4100

- Ubuntu 16.04.3 (upgraded from 16.04.2)

- amdgpu-pro driver 17.30-465504 for Ubuntu 16.04.3 (the latest one which fixed incompatibility issue between Ubuntu 16.04.3 and amdgpu-driver 17.30)

- AMD-APP-SDK-v3.0.130.136-GA-linux64

 

On this system, 'clinfo' shows 2 platforms 'Clover/Mesa' and 'AMD Accelerated Parallel Processing/Advanced Micro Devices, Inc.'.

 

A simple OpenCL program which just does clCreateCommandQueue() with the AMD GPU Pro platform fails with error code '-6' (out of host memory), while it succeeds with Clover.

The system has plenty of RAM (64GB), and it looks unlikely to be lacking host memory.

 

Is the latest AMD GPU PRO driver for Ubuntu successfully supporting the FirePro W4100 graphics board? (I have already confirmed the board is in the supported list of the driver, though)

Or, does something look wrong with any part of configuration or installation?

At least, I can use the Ubuntu's desktop without problem so far.

 

 

- The simple test program to reproduce the issue:

#include <stdio.h>

#include <stdlib.h>

#include <CL/cl.h>

 

 

static void print_device_info(cl_device_id device_id, cl_device_info info_name, const char* label);

static void print_platform_info(cl_platform_id platform_id, cl_platform_info info_name, const char* label);

 

 

int main(int argc, char** argv) {

 

 

    cl_platform_id *platform_ids = NULL;

    cl_device_id *device_ids = NULL;

    cl_context context = NULL;

    cl_command_queue command_queue = NULL;

    cl_uint ndevices;

    cl_uint nplatforms;

    cl_int ret;

    int i, j;

 

 

    if (clGetPlatformIDs(0, NULL, &nplatforms) != CL_SUCCESS) {

        fprintf(stderr, "failed to get platforms count\n");

        exit(1);

    }

    fprintf(stdout, "nplatforms=%d\n\n", nplatforms);

 

 

    platform_ids = (cl_platform_id *)malloc(nplatforms * sizeof(cl_platform_id));

    if (clGetPlatformIDs(nplatforms, platform_ids, NULL) != CL_SUCCESS) {

        fprintf(stderr, "failed to get platform ids\n");

        exit(1);

    }

 

 

    for (i = 0; i < nplatforms; i++) {

        fprintf(stdout, "Platform[%d]:\n", i);

 

 

        print_platform_info(platform_ids[i], CL_PLATFORM_NAME, "Platform Name");

        print_platform_info(platform_ids[i], CL_PLATFORM_PROFILE, "Platform Profile");

        print_platform_info(platform_ids[i], CL_PLATFORM_VERSION, "Platform Version");

        print_platform_info(platform_ids[i], CL_PLATFORM_VENDOR, "Platform Vendor");

        print_platform_info(platform_ids[i], CL_PLATFORM_EXTENSIONS, "Platform Extensions");

 

 

        if (clGetDeviceIDs(platform_ids[i], CL_DEVICE_TYPE_GPU, 0, NULL, &ndevices) != CL_SUCCESS) {

            fprintf(stderr, "failed to get devices count\n");

            continue;

        }

        fprintf(stdout, "ndevices=%d\n", ndevices);

 

 

        device_ids = (cl_device_id *)malloc(ndevices * sizeof(cl_device_id));

        if (clGetDeviceIDs(platform_ids[i], CL_DEVICE_TYPE_GPU, ndevices, device_ids, NULL) != CL_SUCCESS) {

            fprintf(stderr, "failed to get device ids\n");

            continue;

        }

 

 

        for (j = 0; j < ndevices; j++) {

            fprintf(stdout, "Device[%d]:\n", j);

 

 

            print_device_info(device_ids[j], CL_DEVICE_NAME, "Device Name");

            print_device_info(device_ids[j], CL_DEVICE_PROFILE, "Device Profile");

            print_device_info(device_ids[j], CL_DEVICE_VERSION, "Device Version");

            print_device_info(device_ids[j], CL_DRIVER_VERSION, "Driver Version");

            print_device_info(device_ids[j], CL_DEVICE_VENDOR, "Device Vendor");

            print_device_info(device_ids[j], CL_DEVICE_OPENCL_C_VERSION, "OpenCL C Version");

            print_device_info(device_ids[j], CL_DEVICE_EXTENSIONS, "Device Extensions");

 

 

            context = clCreateContext(NULL, 1, &device_ids[j], NULL, NULL, &ret);

            fprintf(stdout, "CreateContext: ret=%d\n", ret);

 

 

            command_queue = clCreateCommandQueue(context, device_ids[j], 0, &ret);

            fprintf(stdout, "CreateCommandQueue: ret=%d\n", ret);

 

 

            if (command_queue != NULL) {

                clReleaseCommandQueue(command_queue);

            }

            if (context != NULL) {

                clReleaseContext(context);

            }

        }

 

 

        if (device_ids != NULL) {

            free(device_ids);

        }

 

 

        fprintf(stdout, "\n");

    }

 

 

    if (platform_ids != NULL) {

        free(platform_ids);

    }

 

 

    return 0;

}

 

 

static void print_device_info(cl_device_id device_id, cl_device_info info_name, const char* label) {

    char* data;

    size_t datasize;

    clGetDeviceInfo(device_id, info_name, 0, NULL, &datasize);

    data = (char*)malloc(datasize);

    clGetDeviceInfo(device_id, info_name, datasize, data, NULL);

    fprintf(stdout, "%s: %s\n", label, data);

    free(data);

}

 

 

static void print_platform_info(cl_platform_id platform_id, cl_platform_info info_name, const char* label) {

    char* data;

    size_t datasize;

    clGetPlatformInfo(platform_id, info_name, 0, NULL, &datasize);

    data = (char*)malloc(datasize);

    clGetPlatformInfo(platform_id, info_name, datasize, data, NULL);

    fprintf(stdout, "%s: %s\n", label, data);

    free(data);

}

 

- How to build the simple test program:

gcc -I /opt/amdgpu-pro/include -L/opt/amdgpu-pro/lib/x86_64-linux-gnu -o cltest cltest.c -Wl,-rpath,/opt/amdgpu-pro/lib/x86_64-linux-gnu -lOpenCL

 

- Output of the simple test program:

 

nplatforms=2

 

 

Platform[0]:

Platform Name: Clover

Platform Profile: FULL_PROFILE

Platform Version: OpenCL 1.1 Mesa 17.0.7

Platform Vendor: Mesa

Platform Extensions: cl_khr_icd

ndevices=1

Device[0]:

Device Name: AMD CAPE VERDE (DRM 3.16.0 / 4.10.0-33-generic, LLVM 4.0.0)

Device Profile: FULL_PROFILE

Device Version: OpenCL 1.1 Mesa 17.0.7

Driver Version: 17.0.7

Device Vendor: AMD

OpenCL C Version: OpenCL C 1.1

Device Extensions: 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_byte_addressable_store cl_khr_fp64

CreateContext: ret=0

CreateCommandQueue: ret=0

 

 

Platform[1]:

Platform Name: AMD Accelerated Parallel Processing

Platform Profile: FULL_PROFILE

Platform Version: OpenCL 2.0 AMD-APP (2442.7)

Platform Vendor: Advanced Micro Devices, Inc.

Platform Extensions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices

ndevices=1

Device[0]:

Device Name: Capeverde

Device Profile: FULL_PROFILE

Device Version: OpenCL 1.2 AMD-APP (2442.7)

Driver Version: 2442.7

Device Vendor: Advanced Micro Devices, Inc.

OpenCL C Version: OpenCL C 1.2

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_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

CreateContext: ret=0

CreateCommandQueue: ret=-6

 

- 'ldd' output:

        linux-vdso.so.1 =>  (0x00007fffd06f8000)

        libOpenCL.so.1 => /opt/amdgpu-pro/lib/x86_64-linux-gnu/libOpenCL.so.1 (0x00007fe7fee52000)

        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe7fea6a000)

        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe7fe861000)

        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe7fe558000)

        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe7fe354000)

        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe7fe136000)

        /lib64/ld-linux-x86-64.so.2 (0x000055d0668e1000)

 

- Output of 'clinfo':

Number of platforms:                             2

  Platform Profile:                              FULL_PROFILE

  Platform Version:                              OpenCL 1.1 Mesa 17.0.7

  Platform Name:                                 Clover

  Platform Vendor:                               Mesa

  Platform Extensions:                           cl_khr_icd

  Platform Profile:                              FULL_PROFILE

  Platform Version:                              OpenCL 2.0 AMD-APP (2442.7)

  Platform Name:                                 AMD Accelerated Parallel Processing

  Platform Vendor:                               Advanced Micro Devices, Inc.

  Platform Extensions:                           cl_khr_icd cl_amd_event_callback cl_amd_offline_devices

 

 

 

 

  Platform Name:                                 Clover

Number of devices:                               1

  Device Type:                                   CL_DEVICE_TYPE_GPU

  Vendor ID:                                     1002h

  Max compute units:                             8

  Max work items dimensions:                     3

    Max work items[0]:                           256

    Max work items[1]:                           256

    Max work items[2]:                           256

  Max work group size:                           256

  Preferred vector width char:                   16

  Preferred vector width short:                  8

  Preferred vector width int:                    4

  Preferred vector width long:                   2

  Preferred vector width float:                  4

  Preferred vector width double:                 2

  Native vector width char:                      16

  Native vector width short:                     8

  Native vector width int:                       4

  Native vector width long:                      2

  Native vector width float:                     4

  Native vector width double:                    2

  Max clock frequency:                           630Mhz

  Address bits:                                  64

  Max memory allocation:                         1918531584

  Image support:                                 No

  Max size of kernel argument:                   1024

  Alignment (bits) of base address:              1024

  Minimum alignment (bytes) for any datatype:    128

  Single precision floating point capability

    Denorms:                                     No

    Quiet NaNs:                                  Yes

    Round to nearest even:                       Yes

    Round to zero:                               No

    Round to +ve and infinity:                   No

    IEEE754-2008 fused multiply-add:             No

  Cache type:                                    None

  Cache line size:                               0

  Cache size:                                    0

  Global memory size:                            3220066304

  Constant buffer size:                          1918531584

  Max number of constant args:                   16

  Local memory type:                             Scratchpad

  Local memory size:                             32768

  Kernel Preferred work group size multiple:     64

  Error correction support:                      0

  Unified memory for Host and Device:            1

  Profiling timer resolution:                    0

  Device endianess:                              Little

  Available:                                     Yes

  Compiler available:                            Yes

  Execution capabilities:

    Execute OpenCL kernels:                      Yes

    Execute native function:                     No

  Queue on Host properties:

    Out-of-Order:                                No

    Profiling :                                  Yes

  Platform ID:                                   0x7f6f0863ae40

  Name:                                          AMD CAPE VERDE (DRM 3.16.0 / 4.10.0-33-generic, LLVM 4.0.0)

  Vendor:                                        AMD

  Device OpenCL C version:                       OpenCL C 1.1

  Driver version:                                17.0.7

  Profile:                                       FULL_PROFILE

  Version:                                       OpenCL 1.1 Mesa 17.0.7

  Extensions:                                    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_byte_addressable_store cl_khr_fp64

 

 

 

 

  Platform Name:                                 AMD Accelerated Parallel Processing

Number of devices:                               1

  Device Type:                                   CL_DEVICE_TYPE_GPU

  Vendor ID:                                     1002h

  Board name:                                    AMD FirePro W4100

  Device Topology:                               PCI[ B#3, D#0, F#0 ]

  Max compute units:                             4

  Max work items dimensions:                     3

    Max work items[0]:                           256

    Max work items[1]:                           256

    Max work items[2]:                           256

  Max work group size:                           256

  Preferred vector width char:                   4

  Preferred vector width short:                  2

  Preferred vector width int:                    1

  Preferred vector width long:                   1

  Preferred vector width float:                  1

  Preferred vector width double:                 1

  Native vector width char:                      4

  Native vector width short:                     2

  Native vector width int:                       1

  Native vector width long:                      1

  Native vector width float:                     1

  Native vector width double:                    1

  Max clock frequency:                           630Mhz

  Address bits:                                  32

  Max memory allocation:                         1408942080

  Image support:                                 Yes

  Max number of images read arguments:           128

  Max number of images write arguments:          8

  Max image 2D width:                            16384

  Max image 2D height:                           16384

  Max image 3D width:                            2048

  Max image 3D height:                           2048

  Max image 3D depth:                            2048

  Max samplers within kernel:                    16

  Max size of kernel argument:                   1024

  Alignment (bits) of base address:              2048

  Minimum alignment (bytes) for any datatype:    128

  Single precision floating point capability

    Denorms:                                     No

    Quiet NaNs:                                  Yes

    Round to nearest even:                       Yes

    Round to zero:                               Yes

    Round to +ve and infinity:                   Yes

    IEEE754-2008 fused multiply-add:             Yes

  Cache type:                                    Read/Write

  Cache line size:                               64

  Cache size:                                    16384

  Global memory size:                            2131243008

  Constant buffer size:                          65536

  Max number of constant args:                   8

  Local memory type:                             Scratchpad

  Local memory size:                             32768

  Max pipe arguments:                            0

  Max pipe active reservations:                  0

  Max pipe packet size:                          0

  Max global variable size:                      0

  Max global variable preferred total size:      0

  Max read/write image args:                     0

  Max on device events:                          0

  Queue on device max size:                      0

  Max on device queues:                          0

  Queue on device preferred size:                0

  SVM capabilities:

    Coarse grain buffer:                         No

    Fine grain buffer:                           No

    Fine grain system:                           No

    Atomics:                                     No

  Preferred platform atomic alignment:           0

  Preferred global atomic alignment:             0

  Preferred local atomic alignment:              0

  Kernel Preferred work group size multiple:     64

  Error correction support:                      0

  Unified memory for Host and Device:            0

  Profiling timer resolution:                    1

  Device endianess:                              Little

  Available:                                     Yes

  Compiler available:                            Yes

  Execution capabilities:

    Execute OpenCL kernels:                      Yes

    Execute native function:                     No

  Queue on Host properties:

    Out-of-Order:                                No

    Profiling :                                  Yes

  Queue on Device properties:

    Out-of-Order:                                No

    Profiling :                                  No

  Platform ID:                                   0x7f6ef66e7478

  Name:                                          Capeverde

  Vendor:                                        Advanced Micro Devices, Inc.

  Device OpenCL C version:                       OpenCL C 1.2

  Driver version:                                2442.7

  Profile:                                       FULL_PROFILE

  Version:                                       OpenCL 1.2 AMD-APP (2442.7)

  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_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

 

- lshw -class display

 

  *-display

       description: VGA compatible controller

       product: Cape Verde GL [FirePro W4100]

       vendor: Advanced Micro Devices, Inc. [AMD/ATI]

       physical id: 0

       bus info: pci@0000:03:00.0

       version: 00

       width: 64 bits

       clock: 33MHz

       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom

       configuration: driver=amdgpu latency=0

       resources: irq:42 memory:e0000000-efffffff memory:f7e00000-f7e3ffff ioport:d000(size=256) memory:f7e40000-f7e5ffff