I have absolutely no idea what I’m doing so please feel free to call out any egregious misunderstandings on my part or if using OpenCL is a bad idea.
I want to write a program that uses OpenCL in C++, built with Meson. What packages do I need to include to get OpenCL to work? I’m using the following shell.nix
:
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
clangStdenv.mkDerivation {
name = "env";
buildInputs = [
opencl-headers
];
nativeBuildInputs = [
clang-tools
lldb
];
}
Other sources seem to indicate that you need to download your platform vendor’s SDK. This doesn’t mesh with my understanding that OpenCL is supposed to be for portable software that works on multiple machine configurations. At any rate, what do I need to include if I want to use them? I’ve tried the one that I have in my configuration.nix
, intel-compute-runtime
. That doesn’t seem to work.
To be specific, I’ve tried compiling a dummy program that uses OpenCL in two ways:
- via
clang
directly. I added-lOpenCL
to the invokation but I get a linker error. - via Meson. I added a dependency
'OpenCL'
to themeson.build
but it can’t discover it.