-
Notifications
You must be signed in to change notification settings - Fork 871
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
No OpenCL platforms reported #6951
Comments
One day <3 |
Any update here? |
Check for any update |
Yes, OpenCL is a crucial feature. We're putting together a native Linux box for testing next week due to this. |
This would be wonderful for my team. We have considered rewriting everything in cuda, but that has major downsides. Until OpenCL support is released, we are stuck dual-booting. |
YEP |
hope for any update |
1 similar comment
hope for any update |
In theory OpenCL/WSL2 may now work for Intel Integrated Graphics GPUs: https://devblogs.microsoft.com/commandline/oneapi-l0-openvino-and-opencl-coming-to-the-windows-subsystem-for-linux-for-intel-gpus/ Trying a few days ago, I didn't see any CPU platforms get registered (I am on AMD for CPU) nor any GPU (I am on Nvidia for GPU) |
any info about whether NVIDIA GPU computing is planned to be supported for OpenCL? |
Any new info a year later? |
Better late than never, right? |
Still waiting |
same issue when trying to run a boost example program
|
I should have checked this before wasting a whole day trying to get it to work ... still waiting |
same |
I found the solution, as it is going to be usual from now on, by asking ChatGPT. To set up OpenCL on WSL, you can follow these general steps:
After completing these steps, you should be able to use OpenCL on WSL. Note that the specific steps and packages required may vary depending on the Linux distribution, GPU hardware, and OpenCL implementation you are using. |
@jorgevazquezperez is that proven working or a hallucination? |
Proven working. It is needed to note that I have only achieved it with the CPU, but I am in process to be able to do it with the GPU. I attach you a picture with the results and I will keep you updated with the GPU version (as I imagine that it is the one you all are looking forward to). If you need more info just tell me! PD: I am using python with the pyopencl library. |
Yes, afaict CPU and integrated Intel GPU should work, but unclear if/how Nvidia |
I manage to get Intel OpenCL working in WSL2, I think.
|
This issue is about Nvidia cards not being shown, not intel/amd |
The title of the issue is simply "No OpenCL platforms reported" - not "No NVidia OpenCL platforms reported" |
The issue is about Nvidia cards not being shown. |
edmondium@LAPTOP-1Q9H40K6:~$ clinfo |
Looks like an Intel cpu/GPU again ^^^^, so same status |
Has anyone gotten OpenCL working with Edit: If you use a recent enough version of Ubuntu (i used 24.04, which is bleeding edge), you can just (base) root@cfbb31c89f97:/# clinfo
Number of platforms 1
Platform Name Portable Computing Language
Platform Vendor The pocl project
Platform Version OpenCL 3.0 PoCL 4.0+debian Linux, None+Asserts, RELOC, SPIR, LLVM 15.0.7, SLEEF, DISTRO, POCL_DEBUG
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_pocl_content_size
Platform Extensions with Version cl_khr_icd 0x400000 (1.0.0)
cl_pocl_content_size 0x400000 (1.0.0)
Platform Numeric Version 0xc00000 (3.0.0)
Platform Extensions function suffix POCL
Platform Host timer resolution 0ns
Platform Name Portable Computing Language
Number of devices 1
Device Name cpu-haswell-AMD Ryzen 5 5600X 6-Core Processor Note that this is still not a solution for |
@alex-ong I have it working in WSL2 Ubuntu 22.04 without pocl on a laptop with a 5800HS, but for the intel platforms to be detected I have to source the setvars.sh script from the Oneapi installation. I installed it a long time ago so I don't recall the details of how I installed it. But I don't remember having much trouble with it. |
I was able to run OpenCL on NVIDIA on WSL2 via PoCL I took the following steps:
1.1. Now you can run
Then run On successful build you can try if it works without installing Also My
And some benchmark (i dont know what these numbers means, good or bad)
|
@Bossach Now this looks promising! PoCL too seems to have come a long way since I last checked. I might give it a try at some point. |
This worked for me. I installed it but the arguments aren't passed by default if I do clinfo it works with the |
@joaomamede Alternatively, yo can put |
Thanks for your share! I follow your step and it almost successful. However, the clinfo told me that "unknown target CPU 'sm_89'". Here is my full output and full benchmark. clinfo:
benchmark:
|
@Tongzhao9417
You need newer version of LLVM/clang. (Just checked llvm-16 from debian repo have "sm_89" one) |
Sorry for late reply. I follow your step and it's worked for me. Cheers! |
I compiled POCL as decribed above and now
Does POCL not support OpenCL 2.0 ? |
Absolute king. pocl-opencl-icd was the missing link for me. Ty, sir. |
I really appreciate for your brilliant solution! I want to ask one question to you and everyone who reacted to Bossach's comment and/or tried the solution (@husmen @joaomamede @Tongzhao9417 @olympichek @htao7 @kirse @kon332k): have you tried the PoCL verification tests for NIVIDIA GPU I basically followed Bossach's steps to install PoCL and now have cd ~/pocl-6.0/build # move to my `build` directory
../tools/scripts/run_cuda_tests
# For rerunning the failed tests:
../tools/scripts/run_cuda_tests --rerun-failed --output-on-failure Failed tests were: The following tests FAILED:
4 - kernel/test_as_type_loopvec (Failed)
166 - regression/clSetKernelArg_overwriting_the_previous_kernel's_args_loopvec (Failed)
208 - runtime/test_device_address (SEGFAULT)
209 - runtime/test_svm (SEGFAULT)
Errors while running CTest If anybody has conducted the verification test, could you please tell us whether you pass all tests or which tests you miss? It would be also very helpful if you could tell us about the runtime environment and settings, and configurations for PoCL installation. I opend an issue on PoCL's repo |
Hi, Result of clinfo: Result of nvidia-smi +-----------------------------------------------------------------------------------------+ |
Many thanks to the community. sudo apt update
sudo apt install -y python3-dev libpython3-dev build-essential ocl-icd-libopencl1 cmake git pkg-config make ninja-build ocl-icd-dev ocl-icd-opencl-dev libhwloc-dev zlib1g zlib1g-dev clinfo dialog apt-utils libxml2-dev opencl-headers
mkdir ~/Downloads
cd ~/Downloads
wget https://developer.download.nvidia.com/compute/cuda/12.8.1/local_installers/cuda_12.8.1_570.124.06_linux.run
sudo bash ./cuda_12.8.1_570.124.06_linux.run --silent --toolkit --no-opengl-libs
export LLVM_VERSION=14
sudo apt install -y libclang-${LLVM_VERSION}-dev clang-${LLVM_VERSION} llvm-${LLVM_VERSION} libclang-cpp${LLVM_VERSION}-dev libclang-cpp${LLVM_VERSION} llvm-${LLVM_VERSION}-dev
git clone https://github.com/pocl/pocl -b v6.0
mkdir pocl/build
cd pocl/build
cmake -DCMAKE_C_FLAGS=-L/usr/lib/wsl/lib \
-DCMAKE_CXX_FLAGS=-L/usr/lib/wsl/lib \
-DWITH_LLVM_CONFIG=/usr/bin/llvm-config-${LLVM_VERSION} \
-DENABLE_HOST_CPU_DEVICES=OFF \
-DENABLE_CUDA=ON ..
make -j`nproc`
sudo make install
sudo mkdir -p /etc/OpenCL/vendors # amended by @kirse 's suggestion
sudo cp /usr/local/etc/OpenCL/vendors/pocl.icd /etc/OpenCL/vendors/pocl.icd # We need this otherwise `clinfo` returns 0 platform detected Finally, we'll get: user@DESKTOP:~/pocl/build$ uname -r
5.15.167.4-microsoft-standard-WSL2
user@DESKTOP:~/pocl/build$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
user@DESKTOP:~/pocl/build$ clinfo
Number of platforms 1
Platform Name Portable Computing Language
Platform Vendor The pocl project
Platform Version OpenCL 3.0 PoCL 6.0 Linux, Debug+Asserts, RELOC, LLVM 14.0.0, SLEEF, CUDA, POCL_DEBUG
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_khr_priority_hints cl_khr_throttle_hints cl_pocl_content_size cl_ext_buffer_device_address
Platform Extensions with Version cl_khr_icd 0x400000 (1.0.0)
cl_khr_priority_hints 0x400000 (1.0.0)
cl_khr_throttle_hints 0x400000 (1.0.0)
cl_pocl_content_size 0x400000 (1.0.0)
cl_ext_buffer_device_address 0x1000 (0.1.0)
Platform Numeric Version 0xc00000 (3.0.0)
Platform Extensions function suffix POCL
Platform Host timer resolution 1ns
Platform Name Portable Computing Language
Number of devices 1
Device Name NVIDIA GeForce RTX 4070 SUPER
Device Vendor NVIDIA Corporation
Device Vendor ID 0x10de
Device Version OpenCL 3.0 PoCL HSTR: CUDA-sm_75
Device Numeric Version 0xc00000 (3.0.0)
Driver Version 6.0
Device OpenCL C Version OpenCL C 1.2 PoCL
Device OpenCL C all versions OpenCL C 0x400000 (1.0.0)
OpenCL C 0x401000 (1.1.0)
OpenCL C 0x402000 (1.2.0)
OpenCL C 0xc00000 (3.0.0)
Device OpenCL C features __opencl_c_images 0xc00000 (3.0.0)
__opencl_c_atomic_order_acq_rel 0xc00000 (3.0.0)
__opencl_c_atomic_order_seq_cst 0xc00000 (3.0.0)
__opencl_c_atomic_scope_device 0xc00000 (3.0.0)
__opencl_c_program_scope_global_variables 0xc00000 (3.0.0)
__opencl_c_generic_address_space 0xc00000 (3.0.0)
__opencl_c_fp16 0xc00000 (3.0.0)
__opencl_c_fp64 0xc00000 (3.0.0)
Latest comfornace test passed (n/a)
Device Type GPU
Device Topology (NV) PCI-E, 0000:01:00.0
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 56
Max clock frequency 2520MHz
Compute Capability (NV) 8.9
Device Partition (core)
Max number of sub-devices 1
Supported partition types None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 1024x1024x64
Max work group size 1024
Preferred work group size multiple (device) 32
Preferred work group size multiple (kernel) 32
Warp size (NV) 32
Max sub-groups per work group 32
Preferred / native vector sizes
char 1 / 1
short 1 / 1
int 1 / 1
long 1 / 1
half 0 / 0 (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 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
Single-precision Floating-point support (core)
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
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 12878086144 (11.99GiB)
Error Correction support No
Max memory allocation 11589910528 (10.79GiB)
Unified memory for Host and Device No
Integrated memory (NV) No
Shared Virtual Memory (SVM) capabilities (core)
Coarse-grained buffer sharing Yes
Fine-grained buffer sharing Yes
Fine-grained system sharing No
Atomics No
Minimum alignment for any data type 128 bytes
Alignment of base address 4096 bits (512 bytes)
Preferred alignment for atomics
SVM 64 bytes
Global 64 bytes
Local 64 bytes
Atomic memory capabilities relaxed, work-group scope
Atomic fence capabilities relaxed, acquire/release, work-group scope
Max size for global variable 0
Preferred total size of global vars 0
Global Memory cache type None
Image support No
Pipe support No
Max number of pipe args 0
Max active pipe reservations 0
Max pipe packet size 0
Local memory type Local
Local memory size 49152 (48KiB)
Registers per block (NV) 65536
Max number of constant args 8
Max constant buffer size 65536 (64KiB)
Generic address space support Yes
Max size of kernel argument 4352 (4.25KiB)
Queue properties (on host)
Out-of-order execution No
Profiling Yes
Device enqueue capabilities (n/a)
Queue properties (on device)
Out-of-order execution No
Profiling No
Preferred size 0
Max size 0
Max queues on device 0
Max events on device 0
Prefer user sync for interop Yes
Profiling timer resolution 1ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
Non-uniform work-groups No
Work-group collective functions No
Sub-group independent forward progress Yes
Kernel execution timeout (NV) Yes
Concurrent copy and kernel execution (NV) Yes
Number of async copy engines 1
IL version (n/a)
ILs with version (n/a)
printf() buffer size 16777216 (16MiB)
Built-in kernels pocl.mul.i32;pocl.add.i32;pocl.dnn.conv2d_int8_relu;pocl.sgemm.local.f32;pocl.sgemm.tensor.f16f16f32;pocl.sgemm_ab.tensor.f16f16f32;pocl.abs.f32;pocl.add.i8;org.khronos.openvx.scale_image.nn.u8;org.khronos.openvx.scale_image.bl.u8;org.khronos.openvx.tensor_convert_depth.wrap.u8.f32
Built-in kernels with version pocl.mul.i32 0x402000 (1.2.0)
pocl.add.i32 0x402000 (1.2.0)
pocl.dnn.conv2d_int8_relu 0x402000 (1.2.0)
pocl.sgemm.local.f32 0x402000 (1.2.0)
pocl.sgemm.tensor.f16f16f32 0x402000 (1.2.0)
pocl.sgemm_ab.tensor.f16f16f32 0x402000 (1.2.0)
pocl.abs.f32 0x402000 (1.2.0)
pocl.add.i8 0x402000 (1.2.0)
org.khronos.openvx.scale_image.nn.u8 0x402000 (1.2.0)
org.khronos.openvx.scale_image.bl.u8 0x402000 (1.2.0)
org.khronos.openvx.tensor_convert_depth.wrap.u8.f32 0x402000 (1.2.0)
Device Extensions cl_khr_byte_addressable_store 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_nv_device_attribute_query cl_khr_fp16 cl_khr_fp64 cl_ext_buffer_device_address cl_khr_subgroup_ballot cl_khr_subgroup_shuffle
Device Extensions with Version cl_khr_byte_addressable_store 0x400000 (1.0.0)
cl_khr_global_int32_base_atomics 0x400000 (1.0.0)
cl_khr_global_int32_extended_atomics 0x400000 (1.0.0)
cl_khr_local_int32_base_atomics 0x400000 (1.0.0)
cl_khr_local_int32_extended_atomics 0x400000 (1.0.0)
cl_khr_int64_base_atomics 0x400000 (1.0.0)
cl_khr_int64_extended_atomics 0x400000 (1.0.0)
cl_nv_device_attribute_query 0x400000 (1.0.0)
cl_khr_fp16 0x400000 (1.0.0)
cl_khr_fp64 0x400000 (1.0.0)
cl_ext_buffer_device_address 0x1000 (0.1.0)
cl_khr_subgroup_ballot 0x400000 (1.0.0)
cl_khr_subgroup_shuffle 0x400000 (1.0.0)
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 [POCL]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name Portable Computing Language
Device Name NVIDIA GeForce RTX 4070 SUPER
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Portable Computing Language
Device Name NVIDIA GeForce RTX 4070 SUPER
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 Portable Computing Language
Device Name NVIDIA GeForce RTX 4070 SUPER 100% CUDA tests passed
|
@haipnh Tried with a completely fresh Ubuntu 22.04.5 WSL, small tweaks below but otherwise 👍 # Ubuntu cleanup needed to fix 404s on the security repo
sudo apt clean
sudo dpkg --configure -a
sudo apt update
sudo apt --fix-broken install
mkdir ~/Downloads
cd ~/Downloads
wget https://developer.download.nvidia.com/compute/cuda/12.8.1/local_installers/cuda_12.8.1_570.124.06_linux.run
sudo apt install -y gcc # required by next cmd
sudo bash ./cuda_12.8.1_570.124.06_linux.run --silent --toolkit --no-opengl-libs
sudo apt install -y python3-dev libpython3-dev build-essential ocl-icd-libopencl1 cmake git pkg-config make ninja-build ocl-icd-dev ocl-icd-opencl-dev libhwloc-dev zlib1g zlib1g-dev clinfo dialog apt-utils libxml2-dev opencl-headers
export LLVM_VERSION=14
sudo apt install -y libclang-${LLVM_VERSION}-dev clang-${LLVM_VERSION} llvm-${LLVM_VERSION} libclang-cpp${LLVM_VERSION}-dev libclang-cpp${LLVM_VERSION} llvm-${LLVM_VERSION}-dev
git clone https://github.com/pocl/pocl -b v6.0
mkdir pocl/build
cd pocl/build
cmake -DCMAKE_C_FLAGS=-L/usr/lib/wsl/lib \
-DCMAKE_CXX_FLAGS=-L/usr/lib/wsl/lib \
-DWITH_LLVM_CONFIG=/usr/bin/llvm-config-14 \
-DENABLE_HOST_CPU_DEVICES=OFF \
-DENABLE_CUDA=ON ..
make -j`nproc`
sudo make install
sudo mkdir -p /etc/OpenCL/vendors # path missing on default install
sudo cp /usr/local/etc/OpenCL/vendors/pocl.icd /etc/OpenCL/vendors/pocl.icd # We need this otherwise `clinfo` returns 0 platform detected user@desktop:~$ uname -r
5.15.167.4-microsoft-standard-WSL2
user@desktop:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
user@desktop:~$ clinfo
Number of platforms 1
Platform Name Portable Computing Language
Platform Vendor The pocl project
Platform Version OpenCL 3.0 PoCL 6.0 Linux, Debug+Asserts, RELOC, LLVM 14.0.0, SLEEF, CUDA, POCL_DEBUG
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_khr_priority_hints cl_khr_throttle_hints cl_pocl_content_size cl_ext_buffer_device_address
Platform Extensions with Version cl_khr_icd 0x400000 (1.0.0)
cl_khr_priority_hints 0x400000 (1.0.0)
cl_khr_throttle_hints 0x400000 (1.0.0)
cl_pocl_content_size 0x400000 (1.0.0)
cl_ext_buffer_device_address 0x1000 (0.1.0)
Platform Numeric Version 0xc00000 (3.0.0)
Platform Extensions function suffix POCL
Platform Host timer resolution 1ns
Platform Name Portable Computing Language
Number of devices 1
Device Name NVIDIA GeForce RTX 4070 Laptop GPU
Device Vendor NVIDIA Corporation
# etc ................. |
I tried this but now I'm getting |
Thanks for the workflow it worked. |
Windows Build Number
21382.1
WSL Version
Kernel Version
5.10.16.3
Distro Version
Ubuntu 20.04
Other Software
Inside WSL:
clinfo (for checking OpenCL platforms)
CUDA 11.3 (docker container runs with NVIDIA_DISABLE_REQUIRE=1, as it otherwise thinks it's running 11.0)
Docker 20.10.6, build 370c289 (with custom container)
nvidia-docker2 2.5.0-1
On Windows:
NVIDIA Graphics Driver for CUDA on WSL 470.14
Repro Steps
I installed the Nvidia drivers and docker as according to Nvidia's user guide
I am however running an older version of nvidia-docker2 (and dependencies) as according to a forum post here
Additionally, I have also installed the CUDA on WSL driver here
Steps:
Run clinfo (both in and outside of the Docker container)
Expected Behavior
clinfo should return the graphics card (in my case, GTX 970) as an OpenCL platform
Actual Behavior
clinfo reports 0 platforms available, both inside the container and just on WSL
Diagnostic Logs
cuda
nvidia-container-cli
glxinfo (from inside of container)
glxinfo (from WSL, outside of container)
wsl.etl
The text was updated successfully, but these errors were encountered: