Closed MathiasMagnus closed 2 years ago
@bashbaug I think I know where your woes are coming from (and both are totally legit).
The headers is a sticky subject. (Semi-extensive exploration of the phase space is here, which I intend on merging into either the OpenCL-Guide or the SDK.) The 'current working directory' (henceforth cwd)-relative solution is simple, but is fairly brittle. Copying the kernels into the build tree is problematic because
file(COPY ...)
or configure_file()
but then one needs to reconfigure to update the files on disk. (It's annoying to develop samples that way.)saxpy-kernel
and nbody-kernel-shader
start mildly polluting the list of available targets. Samples run fine from the install tree, because install commands can properly track the timestamps of both the executables and the kernel files.Symlinking the kernels would be awesome, as it follows updates to code in the source tree, but that has many problems too:
file(CREATE_LINK ...)
is CMake 3.14. (And cmake -E create_symlink
as non-UNIX-only is 3.13.) We can raise minimum version when building the samples to 3.13 / 3.14 or accept the bloat
if(CMAKE_SYSTEM_NAME MATHCES Windows)
execute_process(COMMAND "mklink ...")
else()
execute_process(COMMAND "ln -s ...")
endif()
but even then, symlinking on Windows without admin rights requires developer mode enabled on the system. π€― Wow...
Ultimately I accepted the fact that running the samples from the build tree requires making the cwd the path to the kernel in the source tree, but if it bugs anyone, pick an item from the above list or the samples should move away from the CWD-relative location of device code.
All samples now execute correctly from the build tree as well as the install tree in both single and multi-config generators.
This PR ships a larger batch of samples and the initial set of C/C++ utility libraries and SDK libraries. This PR includes:
Some notes on the shape of the SDK samples and some of the design choices: