stan-dev / math

The Stan Math Library is a C++ template library for automatic differentiation of any order using forward, reverse, and mixed modes. It includes a range of built-in functions for probabilistic modeling, linear algebra, and equation solving.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
754 stars 188 forks source link

CL_INVALID_PLATFORM on the gelman group linux #2442

Closed rok-cesnovar closed 3 years ago

rok-cesnovar commented 3 years ago

@serban-nicusor-toptal was there a configuration change on the Gelman group linux? OpenCL CPU tests seem to work fine (IDs 0 and 0), but the OpenCL GPU tests that run on all PRs seem to not find the device with the platform id 1 and device id 0. Can you check?

Probably the fastest check would be to run clinfo and see what we get.

Examples of failures:

serban-nicusor-toptal commented 3 years ago

Hey @rok-cesnovar there has been no change from my side. I'm checking.

serban-nicusor-toptal commented 3 years ago

@rok-cesnovar clinfo returns:

  Platform Name                                   Intel(R) CPU Runtime for OpenCL(TM) Applications
  Platform Vendor                                 Intel(R) Corporation
  Platform Version                                OpenCL 2.1 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 cl_intel_vec_len_hint
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             INTEL

  Platform Name                                   Intel(R) CPU Runtime for OpenCL(TM) Applications
Number of devices                                 1
  Device Name                                     Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  Device Vendor                                   Intel(R) Corporation
  Device Vendor ID                                0x8086
  Device Version                                  OpenCL 2.1 (Build 0)
  Driver Version                                  18.1.0.0920
  Device OpenCL C Version                         OpenCL C 2.0        
  Device Type                                     CPU
  Device Profile                                  FULL_PROFILE        
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               16
  Max clock frequency                             2400MHz
  Device Partition                                (core)
    Max number of sub-devices                     16
    Supported partition types                     by counts, equally, by names (Intel)
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             8192x8192x8192
  Max work group size                             8192
  Preferred work group size multiple              128
  Max sub-groups per work group                   1
  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
  Address bits                                    64, Little-Endian
  Global memory size                              33578098688 (31.27GiB)
  Error Correction support                        No
  Max memory allocation                           8394524672 (7.818GiB)
  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 (256KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             480
    Max size for 1D images from buffer            524657792 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 pixels
    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 number of constant args                     480
  Max constant buffer size                        131072 (128KiB)
  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
    Sub-group independent forward progress        No
    IL version                                    SPIR-V_1.0
    SPIR versions                                 1.2
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels                                (n/a)
  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 cl_intel_vec_len_hint

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_DEFAULT)  No platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No platform
rok-cesnovar commented 3 years ago

Thanks, then the error makes sense. The GPU is not listed. Can you check if its present and reinstall the nvidia driver and CUDA toolkit if it is?

serban-nicusor-toptal commented 3 years ago

I've installed nvidia-driver-460 (was already installed) and cuda toolkit and I'm getting the same.

serban-nicusor-toptal commented 3 years ago
lshw -numeric -C display
WARNING: you should run this program as super-user.
  *-display        
       description: VGA compatible controller
       product: GM107GL [Quadro K620] [10DE:13BB]
       vendor: NVIDIA Corporation [10DE]
       physical id: 0
       bus info: pci@0000:02:00.0
       version: a2
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:35 memory:f2000000-f2ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:1000(size=128) memory:c0000-dffff
rok-cesnovar commented 3 years ago

Ok, if you installed both, can you safely reboot the machine without losing access to it?

serban-nicusor-toptal commented 3 years ago

Afaik it's not encrypted on boot but it may spin up on a new IP. We can try

serban-nicusor-toptal commented 3 years ago

@bgoodri Hey, I see you're logged in to the machine. Can I safely reboot it without ruining any of your work?

serban-nicusor-toptal commented 3 years ago

I've assumed he's AFK and rebooted the machine but looks like it's not coming back on the same IP, will wait a few more minutes.

rok-cesnovar commented 3 years ago

@serban-nicusor-toptal lets fire up the AWS GPU instance once again until this gets sorted out.

serban-nicusor-toptal commented 3 years ago

@rok-cesnovar Done, it's booting up now. I've tried all know IPs and couldn't reach the machine, that's weird because as far as I remember Ben removed the disk encryption so it should have booted straight into the OS ... Glad we did these GPU instances for backup!

bgoodri commented 3 years ago

I did. We probably have to loop through adjacent IP addresses to find it.

On Tue, Mar 23, 2021 at 12:44 PM Nicusor Serban @.***> wrote:

@rok-cesnovar https://github.com/rok-cesnovar Done, it's booting up now. I've tried all know IPs and couldn't reach the machine, that's weird because as far as I remember Ben removed the disk encryption so it should have booted straight into the OS ... Glad we did these GPU instances for backup!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stan-dev/math/issues/2442#issuecomment-805057481, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ2XKQXY3FVZKUJKFNAFJTTFDAQDANCNFSM4ZUUWKAA .

serban-nicusor-toptal commented 3 years ago

Thanks for confirmation @bgoodri ! Argh I need to make a script with the entire range of IPs so we can identify this much easier. Is there a way I can get the range of IPs or a list of possible IPs it can spin up on ? Thanks!

bgoodri commented 3 years ago

I am pretty sure it will be the same except for the set of digits after the last dot.

On Tue, Mar 23, 2021 at 1:15 PM Nicusor Serban @.***> wrote:

Thanks for confirmation @bgoodri https://github.com/bgoodri ! Argh I need to make a script with the entire range of IPs so we can identify this much easier. Is there a way I can get the range of IPs or a list of possible IPs it can spin up on ? Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stan-dev/math/issues/2442#issuecomment-805079978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ2XKTK2MX4P3XHQDD4BJLTFDEC5ANCNFSM4ZUUWKAA .

serban-nicusor-toptal commented 3 years ago

Thanks! I'm on it.

rok-cesnovar commented 3 years ago

@serban-nicusor-toptal seems the IDs on the AWS instance are messed up: https://jenkins.mc-stan.org/blue/organizations/jenkins/Math%20Pipeline/detail/PR-2437/4/pipeline

serban-nicusor-toptal commented 3 years ago
export OPENCL_PLATFORM_ID=0 
export OPENCL_DEVICE_ID=0
export OPENCL_PLATFORM_ID_GPU=0 
export OPENCL_DEVICE_ID_GPU=0

Shouldn't it be like this?

rok-cesnovar commented 3 years ago

This looks good, but it says

echo OPENCL_PLATFORM_ID=null>> make/local
serban-nicusor-toptal commented 3 years ago

hmh that's weird, because I set them both in the shell Jenkins uses and in the env of the user

sudo -u ubuntu -i echo "OPENCL_PLATFORM_ID=\"0\"" >> /etc/environment
sudo -u ubuntu -i echo "OPENCL_DEVICE_ID=\"0\"" >> /etc/environment

sudo -u ubuntu -i echo "OPENCL_PLATFORM_ID_GPU=\"0\"" >> /etc/environment
sudo -u ubuntu -i echo "OPENCL_DEVICE_ID_GPU=\"0\"" >> /etc/environment

Give me a moment to login on an instance and see what's there.

serban-nicusor-toptal commented 3 years ago

Everything seems fine server side:

ubuntu@ip-172-31-13-100:~$ printenv | grep OPENCL
OPENCL_DEVICE_ID_GPU=0
OPENCL_DEVICE_ID=0
OPENCL_PLATFORM_ID=0
OPENCL_PLATFORM_ID_GPU=0

Pff maybe it wants to read it from somewhere else? PARALLEL for example is set in the same way and it works just fine.

rok-cesnovar commented 3 years ago

Oh, nevermind these are CPU tests. Ignore me...

serban-nicusor-toptal commented 3 years ago

Hmh can I make those runs on this instance too? I don't want it to fail all the pipelines ...

rok-cesnovar commented 3 years ago

No, we cant make that run as AWS instances arent guaranteed to have a CPU that supports OpenCL. PRs that require OpenCL CPU tests will have to wait.

serban-nicusor-toptal commented 3 years ago

I'm still in the process of scanning the possible IPs, as soon as I find it I'll put the Linux instance up.

rok-cesnovar commented 3 years ago

Actually @serban-nicusor-toptal just add

export OPENCL_PLATFORM_ID_CPU=0 export OPENCL_DEVICE_ID_CPU=0

to the AWS instance, it will help clear up the backlog.

serban-nicusor-toptal commented 3 years ago

I've kept looking for the instance from 0...255 on that IP but I couldn't find it.

Updated machines with the variables!

rok-cesnovar commented 3 years ago

Seems to work fine now, closing.