Skip to content

Easier CUDA and OpenCL switch #14

@eddelbuettel

Description

@eddelbuettel

It is currently impossible to get CUDA if OpenCL is present:

rcppbandicoot/configure.ac

Lines 362 to 368 in 7e1d378

if test "x${HAVE_OPENCL}" = x1; then
DEFAULT_BACKEND="CL_BACKEND"
BANDICOOT_CXXFLAGS="${BANDICOOT_CXXFLAGS} -DCOOT_DEFAULT_BACKEND=CL_BACKEND"
elif test "x${HAVE_CUDA}" = x1; then
DEFAULT_BACKEND="CUDA_BACKEND"
BANDICOOT_CXXFLAGS="${BANDICOOT_CXXFLAGS} -DCOOT_DEFAULT_BACKEND=CUDA_BACKEND"
else

I am currently in the 3.0.1 branch from the pending PR, recovered the coot_rt_meat.hpp, and standardized tentatively on using COOT_KERNEL_SOURCE_DIR to allow for OpenCL and CUDA. Still, no chance for me to select CUDA (apart from reordering that same code segment). Which is not great.

It's a tricky problem but can we maybe configure both, and then allow a run-time (i.e. package load) switch? Via options() or an environment variable?

Alternatively, the package could also be greatly simplified by just throwing CUDA out. Right now there is a lot of complexity without delivering functionality. CUDA is hard and annoying to setup so I maybe ... having two packages is easier? Or two backend packages? I also do not quite understand how upstream worked and when I asked it was suggested 'it should switch at run-time' yet the documentation plainly disagrees:

Image

(I had started locally adding a call to coot_init() thinking I might switch. Apparently one cannot.)

I currently have a working OpenCL and CUDA setup and am happy and able to test and help make this better. Let know what you are planning, I may be able to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions