ddemidov / vexcl

VexCL is a C++ vector expression template library for OpenCL/CUDA/OpenMP
http://vexcl.readthedocs.org
MIT License
702 stars 82 forks source link

/usr/local/include/vexcl/backend/opencl.hpp:39:10: fatal error: CL/cl.hpp: 没有那个文件或目录 #286

Closed dfy888 closed 3 years ago

dfy888 commented 3 years ago

/usr/local/include/vexcl/backend/opencl.hpp:39:10: fatal error: CL/cl.hpp: 没有那个文件或目录

本机应该是:#include <CL/cl.h>

ddemidov commented 3 years ago

Google translate says this means "no such file". The CL/cl.hpp should come from your opencl SDK, or you can download it from khronos website, or there is a copy in vexcl source provided for convenience.

-- Cheers, Denis

On Fri, Jul 30, 2021, 06:24 dfy888 @.***> wrote:

/usr/local/include/vexcl/backend/opencl.hpp:39:10: fatal error: CL/cl.hpp: 没有那个文件或目录

本机应该是:#include <CL/cl.h>

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ddemidov/vexcl/issues/286, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACCBJ2EPN6RFGOIGJOFXWTT2ILO7ANCNFSM5BHV2SEQ .

blattms commented 3 years ago

@ddemidov for newer Linux distributions (without packages downloaded from NVIDIA or AMD/Rocm) that is no longer the case. E.g. on the current Debian versions with cuda/opencl packages from Debian there will be no CL/cl.hpp available.

Khronos has removed the CL/cl.hpp header a long time ago and CL/cl2.hpp should be used. Well, in current version CL/cl2.hpp is deprecated and will emit lots of warning and opencl.hpp should be used. But that is not yet available on all current Linux platforms.

The problem is that NVIDIA ships rather old opencl cpp headers with their software and cl2.hpp will be missing. But if users install the package opencl-header in addition everything works (see OPM/opm-simulators#3644, OPM/opm-simulators#3652)

Would be cool if vexcl/amgcl would support the newer opencl headers:

ddemidov commented 3 years ago

On my machine there is no CL/cl.hpp as well, that is why vexcl includes its own version (downloaded from Khronos): https://github.com/ddemidov/vexcl/tree/master/CL. I'll see if it is easy enough to check for and use if available cl2.hpp or opencl.hpp.

blattms commented 3 years ago

Indeed there is, but that is not installed and probably should not be. Hence if you are using an installed vexcl (e.g via setting -DVexCL_DIR="..." when configuring amgcl), that error occurs.

ddemidov commented 3 years ago

I've pushed the version that is compatible with CL/opencl.hpp to the opencl-hpp branch. Would that work for you?

I am willing to make this a permanent switch, since Khronos does recommend it, and it is backward compatible with platform includes (C-only).

By the way, opencl-headers on my installation (Arch linux) does not include any of the hpp headers, so either CL/cl2.hpp or CL/opencl.hpp would need to come from elsewhere (installed manually?).

Use KernelFunctor instead of make_kernel

I don't think I use cl::make_kernel anywhere in vexcl code.

blattms commented 3 years ago

Thanks a lot for the prompt effort. Highly appreciated.

On Debian bullseye the branch works like a charm (with installed vexcl and amgcl). My only fear is that it might break on Linux distributions with slightly older opencl-headers version see e.g. https://github.com/OPM/opm-simulators/issues/3643#issuecomment-954796110_

I guess users or cmake need to somehow be able to select between cl2.hpp and opencl.hpp. Or we need accept the loads of warnings about deprecated cl2.hpp and always use that one for now.

Seem like on ArchLinux the C++ headers are part of package opencl-clhpp.