Skip to content

Package configuration #15

@eddelbuettel

Description

@eddelbuettel

There is still a fundamental disconnect between what the R package does and what the C++ sources expect. The package builds, and loads. The build, however, tries to pick up a compile-time location. Both in the default (currently CUDA here, I may have re-ordered that in configure.ac) when I do not switch:

> library(RcppBandicoot)
> gpu_element_square(matrix(1.0*(1:9), 3))
Failed to open ../inst/include/bandicoot_bits/cuda/kernels/defs/cuda_prelims.cu (kernel source)!
Error: Cannot open required kernel source.
> 

but also in OpenCL when I try to switch via the coot_init() I exposed in a helper:

> library(RcppBandicoot)
> RcppBandicoot:::gpu_initialize("opencl", TRUE)
platform: 0 / device: 0
name1:                      NVIDIA Corporation
name2:                      NVIDIA GeForce RTX 5060 Ti
name3:                      OpenCL 3.0 CUDA
is_gpu:                     1
fp64:                       63
fp16:                       0
sizet_width:                8
ptr_width:                  8
n_units:                    36
opencl_ver:                 300
max_wg:                     1024
max_wg_ndims:               3
max_wg_dims:                (1024, 1024, 64)
subgroup_size:              32
must_synchronise_subgroups: 0

selected: platform: 0 / device: 0
name1:                      NVIDIA Corporation
name2:                      NVIDIA GeForce RTX 5060 Ti
name3:                      OpenCL 3.0 CUDA
is_gpu:                     1
fp64:                       63
fp16:                       0
sizet_width:                8
ptr_width:                  8
n_units:                    36
opencl_ver:                 300
max_wg:                     1024
max_wg_ndims:               3
max_wg_dims:                (1024, 1024, 64)
subgroup_size:              32
must_synchronise_subgroups: 0
Failed to open ../inst/include/bandicoot_bits/opencl/kernels/defs/opencl_prelims.cl (kernel source)!
Error: Cannot open required kernel source.
> 

I think it is not the job of @coatless and myself to convince @rcurtin to accept a kernel source 'root' location argument at run-time. R packages want to be relocatable, this is even enforced at build and we pass it only because ... we do not actual gpu work at that point:

installing to /usr/local/lib/R/site-library/00LOCK-rcppbandicoot/00new/RcppBandicoot/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (RcppBandicoot)
edd@paul:~/git/rcppbandicoot(local/bandicoot-3.1.0.rc)$ 

The two path /usr/local/lib/R/site-library/00LOCK-rcppbandicoot/00new/RcppBandicoot/libs and the final actual location (here: /usr/local/lib/R/site-library/RcppBandicoot/libs) differ and so the shared library location differs as it has to for R.

One way out of this would be to offer a 'more naked' bandicoot package containing the source, and depending on it in an integration package RcppBandicoot. When the latter builds, its (very small) shared library simply calls into the (on the given system: "fixed") location of the bandicoot headers and kernels.

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