beehive-lab / docker-tornadovm

Docker build scripts for TornadoVM on GPUs: https://github.com/beehive-lab/TornadoVM
Apache License 2.0
28 stars 6 forks source link

tornado.drivers.opencl.OCLDriver.checkAndInitBackend() #2

Closed ChrisCummins closed 5 years ago

ChrisCummins commented 5 years ago

Hi guys,

Thanks for the clear "getting started" docs :) Unfortunately I'm hitting an error when trying to run the Intel OpenCL docker image. It looks like no platforms are being found, causing this array to be initialised empty:

$ docker pull beehivelab/tornado-intel-gpu:latest
$ git clone https://github.com/beehive-lab/docker-tornado
$ cd docker-tornado
$ ./run_intel.sh javac.py example/MatrixMultiplication.java
javac -classpath ".:/tornado/tornado/bin/sdk//share/java/tornado/all-0.28.jar:/tornado/tornado/bin/sdk//share/java/tornado/commons-lang3-3.3.2.jar:/tornado/tornado/bin/sdk//share/java/tornado/core-0.28.jar:/tornado/tornado/bin/sdk//share/java/tornado/dense64-0.28.jar:/tornado/tornado/bin/sdk//share/java/tornado/denseC64-0.28.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-all-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-cdense-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-core-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-ddense-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-dsparse-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-fdense-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-simple-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/ejml-zdense-0.31.jar:/tornado/tornado/bin/sdk//share/java/tornado/equation-0.28.jar:/tornado/tornado/bin/sdk//share/java/tornado/graal-0.22.jar:/tornado/tornado/bin/sdk//share/java/tornado/hamcrest-core-1.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/junit-4.12.jar:/tornado/tornado/bin/sdk//share/java/tornado/log4j-api-2.5.jar:/tornado/tornado/bin/sdk//share/java/tornado/log4j-core-2.5.jar:/tornado/tornado/bin/sdk//share/java/tornado/lucene-core-4.10.4.jar:/tornado/tornado/bin/sdk//share/java/tornado/simple-0.28.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-api-0.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-benchmarks-0.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-drivers-opencl-0.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-drivers-opencl-jni-0.3-libs.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-examples-0.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-matrices-0.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-runtime-0.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/tornado-unittests-0.3.jar:/tornado/tornado/bin/sdk//share/java/tornado/truffle-api-0.22.jar:/tornado/tornado/bin/sdk//share/java/tornado/" example/MatrixMultiplication.java
$ ./run_intel.sh tornado example/MatrixMultiplication
Computing MxM of 512x512
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at uk.ac.manchester.tornado.drivers.opencl.OCLDriver.checkAndInitBackend(OCLDriver.java:92)
    at uk.ac.manchester.tornado.drivers.opencl.OCLDriver.getDefaultBackend(OCLDriver.java:152)
    at uk.ac.manchester.tornado.drivers.opencl.OCLDriver.getProviders(OCLDriver.java:180)
    at uk.ac.manchester.tornado.runtime.tasks.TornadoTaskSchedule.addInner(TornadoTaskSchedule.java:196)
    at uk.ac.manchester.tornado.runtime.tasks.TornadoTaskSchedule.addTask(TornadoTaskSchedule.java:1322)
    at uk.ac.manchester.tornado.api.TaskSchedule.task(TaskSchedule.java:118)
    at example.MatrixMultiplication.main(MatrixMultiplication.java:51)

System information:

$ docker --version
Docker version 18.09.7, build 2d0083d
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Cheers, Chris

jjfumero commented 5 years ago

Hi @ChrisCummins, the docker image requires the OpenCL runtime already installed on your machine. Can you check if you have the Intel compute runtime installed?

With clinfo you should be able to see the devices.

ChrisCummins commented 5 years ago

Ah okay thanks, maybe there's probably something funny in my Intel OpenCL runtime:

$ clinfo
Number of platforms                               1
  Platform Name                                   Intel(R) OpenCL
  Platform Vendor                                 Intel(R) Corporation
  Platform Version                                OpenCL 2.0 LINUX
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd 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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer
  Platform Extensions function suffix             INTEL

  Platform Name                                   Intel(R) OpenCL
Number of devices                                 1
  Device Name                                     Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
  Device Vendor                                   Intel(R) Corporation
  Device Vendor ID                                0x8086
  Device Version                                  OpenCL 2.0 (Build 25)
  Driver Version                                  1.2.0.25
  Device OpenCL C Version                         OpenCL C 2.0
  Device Type                                     CPU
  Device Profile                                  FULL_PROFILE
  Max compute units                               16
  Max clock frequency                             2100MHz
  Device Partition                                (core)
    Max number of sub-devices                     16
    Supported partition types                     by counts, equally, by names (Intel)
  Max work item dimensions                        3
  Max work item sizes                             8192x8192x8192
  Max work group size                             8192
  Preferred work group size multiple              128
  Preferred / native vector sizes
    char                                                 1 / 32
    short                                                1 / 16
    int                                                  1 / 8
    long                                                 1 / 4
    half                                                 0 / 0        (n/a)
    float                                                1 / 8
    double                                               1 / 4        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  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
    Correctly-rounded divide and sqrt operations  No
  Address bits                                    64, Little-Endian
  Global memory size                              33613262848 (31.3GiB)
  Error Correction support                        No
  Max memory allocation                           8403315712 (7.826GiB)
  Unified memory for Host and Device              Yes
  Shared Virtual Memory (SVM) capabilities        (core)
    Coarse-grained buffer sharing                 Yes
    Fine-grained buffer sharing                   Yes
    Fine-grained system sharing                   Yes
    Atomics                                       Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Preferred alignment for atomics
    SVM                                           64 bytes
    Global                                        64 bytes
    Local                                         0 bytes
  Max size for global variable                    65536 (64KiB)
  Preferred total size of global vars             65536 (64KiB)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        262144
  Global Memory cache line                        64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             480
    Max size for 1D images from buffer            525207232 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   64 bytes
    Pitch alignment for 2D image buffers          64 bytes
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 480
    Max number of write image args                480
    Max number of read/write image args           480
  Max number of pipe args                         16
  Max active pipe reservations                    16383
  Max pipe packet size                            1024
  Local memory type                               Global
  Local memory size                               32768 (32KiB)
  Max constant buffer size                        131072 (128KiB)
  Max number of constant args                     480
  Max size of kernel argument                     3840 (3.75KiB)
  Queue properties (on host)
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Local thread execution (Intel)                Yes
  Queue properties (on device)
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Preferred size                                4294967295 (4GiB)
    Max size                                      4294967295 (4GiB)
  Max queues on device                            4294967295
  Max events on device                            4294967295
  Prefer user sync for interop                    No
  Profiling timer resolution                      1ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            Yes
    SPIR versions                                 1.2
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Device Extensions                               cl_khr_icd 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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer

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 [INTEL]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  Success (1)
    Platform Name                                 Intel(R) OpenCL
    Device Name                                   Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  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                                 Intel(R) OpenCL
    Device Name                                   Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz

Cheers, Chris

jjfumero commented 5 years ago

M.. by looking at the spec https://ark.intel.com/content/www/us/en/ark/products/64594/intel-xeon-processor-e5-2620-15m-cache-2-00-ghz-7-20-gt-s-intel-qpi.html , this model does not have an Integrated GPU. The tornado-docker image runs on the Intel HD Graphics (if any).

To test on a CPU, you would need to install TornadoVM from scratch. We don't have the image for this configuration yet.

ChrisCummins commented 5 years ago

Ah woops, I totally glossed over the "integrated GPU" bit of the requirements. :) Thanks @jjfumero!