Package: opencltools 0.8.2

opencltools: 'OpenCL' Tools for R Package Developers

Runtime 'OpenCL' support for R package developers: probe hardware and drivers, load and concatenate kernel sources, and manage dependency-annotated '.cl' libraries, so packages like 'nmathopencl' and other ported libraries can offer GPU acceleration without each re-implementing the same plumbing. Vignettes illustrate integration with suggested packages 'nmathopencl' and 'glmbayes'; production kernels for those applications ship in those packages rather than here.

Authors:Kjell Nygren [aut, cre], The R Core Team [ctb, cph], The R Foundation [cph], Ross Ihaka [ctb, cph], Robert Gentleman [ctb, cph], Simon Davies [ctb], Morten Welinder [ctb, cph], Martin Maechler [ctb]

opencltools_0.8.2.tar.gz
opencltools_0.8.2.zip(r-4.7)opencltools_0.8.2.zip(r-4.6)opencltools_0.8.2.zip(r-4.5)
opencltools_0.8.2.tgz(r-4.6-x86_64)opencltools_0.8.2.tgz(r-4.6-arm64)opencltools_0.8.2.tgz(r-4.5-x86_64)opencltools_0.8.2.tgz(r-4.5-arm64)
opencltools_0.8.2.tar.gz(r-4.7-arm64)opencltools_0.8.2.tar.gz(r-4.7-x86_64)opencltools_0.8.2.tar.gz(r-4.6-arm64)opencltools_0.8.2.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
opencltools/json (API)

# Install 'opencltools' in R:
install.packages('opencltools', repos = c('https://knygren.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/knygren/opencltools/issues

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

7.85 score 4 stars 4 packages 1 scripts 469 downloads 31 exports 6 dependencies

Last updated from:e3a5254db1. Checks:12 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK189
linux-devel-x86_64OK189
source / vignettesOK271
linux-release-arm64OK168
linux-release-x86_64OK172
macos-release-arm64OK116
macos-release-x86_64OK304
macos-oldrel-arm64OK92
macos-oldrel-x86_64OK239
windows-develOK308
windows-releaseOK310
windows-oldrelOK283
wasm-releaseFAIL153

Exports:add_to_libpath_linuxadd_to_path_linuxadd_to_path_windowsattach_cross_library_tagsattach_kernel_call_tagsattach_kernel_dependency_tagscheck_runtime_envdetect_compute_runtimesdetect_environment_and_gpusdetect_or_install_gpu_driversdiagnose_glmbayesextract_library_subsetget_opencl_core_countgpu_nameshas_openclload_kernel_libraryload_kernel_sourceload_library_for_kernelload_library_for_kernel_cross_packageload_program_preloadopencl_device_infoopencl_fp64_availableopencl_reset_device_selectionopencltoolsLdFlagsport_to_opencl_configureread_program_preload_manifeststage_kernel_dependency_sortuse_opencl_configureverify_opencl_runtimewrite_kernel_dependency_indexwrite_program_preload_manifest

Dependencies:jsonliterbibutilsRcppRcppArmadilloRcppParallelRdpack

Chapter 01: Getting started — Setting up OpenCL
Introduction | 1. Download and install build tools | 1.1 Windows: Install Rtools | 1.2 Linux: Install compiler toolchain and R development headers | Installing the latest R on Ubuntu/Debian (optional but recommended) | 1.3 macOS: Install Xcode Command Line Tools and GCC | 2. Install OpenCL components | 2.1 Windows | 2.2 Linux | 2.2.1 OpenCL implementation (vendor runtime) | 2.2.2 OpenCL header files | 2.2.3 OpenCL runtime (ICD loader) | 2.2.4 OpenCL development library (linker symlink) | 2.2.5 Verify OpenCL platforms with clinfo (Linux, recommended) | 2.3 macOS | 3. Install opencltools from source (for OpenCL) | 4. Load the package | 5. Check for OpenCL availability | 5.1 Full diagnostic | 6. Verify the kernel-loading path | Appendix A: AMD GPUs on Linux (ROCm OpenCL recommended) | Install ROCm OpenCL (Ubuntu LTS) | Supported AMD GPUs | Other AMD OpenCL stacks | References

Last update: 2026-05-29
Started: 2020-07-05

Chapter 02: Using a ported library — assembling kernel programs
Introduction | 1. Anatomy of a ported library | 1.1 Shard annotations | 2. The nmath module | 3. Loading kernel source files | 3.1 Single file | 3.2 A whole library directory | 4. Program assembly | 5. Minimal subsetting — loading only the nmath shards a kernel needs | 6. Annotating your kernel files | 6.1 Declare the library (one line, written by you) | 6.2 Step 1 — scan source, write direct-call tags | 6.3 Step 2 — compute transitive closure | 7. Verifying portability | 8. Maintaining a library index | Cross-references

Last update: 2026-05-29
Started: 2020-07-05

Chapter 03: Kernel runners and wrappers — the glmbayes pattern
Introduction | 1. Architecture overview | Call path | 2. Kernel structure | Step 1 — Work-item mapping | Step 2 — Prior term | Step 3 — Prior gradient | Step 4 — Data loop | Step 5 — Write outputs | 2.1 Supported family/link kernels in glmbayes | 3. The kernel wrapper | Linking against opencltools | 4. The kernel runner | 5. Fail gracefully — the dispatch pattern | 6. The pilot pattern | 7. Setting up OpenCL before first use | Cross-references | References

Last update: 2026-05-29
Started: 2020-07-05

Readme and manuals

Help Manual

Help pageTopics
opencltools: OpenCL Tools for R Package Developersopencltools-package opencltools
Add Directories to PATH or LD_LIBRARY_PATHadd_to_libpath_linux add_to_path add_to_path_linux add_to_path_windows
Attach Cross-Library Dependency Tags to Kernel Filesattach_cross_library_tags
Attach Library Call Tags to Kernel Filesattach_kernel_call_tags
Attach Dependency Tags to a Dependency-Ordered Kernel Libraryattach_kernel_dependency_tags
GPU and OpenCL Diagnostics for 'glmbayes'check_runtime_env detect_compute_runtimes detect_environment_and_gpus detect_or_install_gpu_drivers diagnose_glmbayes gpu_diagnostics gpu_names has_opencl opencl_device_info opencl_fp64_available opencl_reset_device_selection verify_opencl_runtime
Extract a Minimal Library Subset for a Set of Kernelsextract_library_subset
Get the number of available OpenCL compute unitsget_opencl_core_count
Printing results from minimal kernel-library subset loaderskernel_lib_subset_printing print.nmathopencl_concatenated_lib print.nmathopencl_lib_extract_df
Load OpenCL Kernel Source Filesload_kernel_library load_kernel_source
Load a Minimal OpenCL Library Subset for a Single Kernelload_library_for_kernel
Load a minimal OpenCL library subset across packagesload_library_for_kernel_cross_package
Concatenate a program preload from a manifestload_program_preload
Linker flags for downstream 'LinkingTo: opencltools' packagesopencltoolsLdFlags
Port an existing static src/Makevars to use OpenCL configure scriptsport_to_opencl_configure
Print Dependency Tag Attachment Resultsprint.opencl_dependency_tags
Read a program preload manifestread_program_preload_manifest
Stage Kernel Library Dependency Sort Resultsstage_kernel_dependency_sort
Set up OpenCL configure scripts in a downstream R packageuse_opencl_configure
Build and save a kernel dependency indexwrite_kernel_dependency_index
Build and save a program preload manifestwrite_program_preload_manifest