gpu_diagnostics: GPU and OpenCL diagnostics for 'glmbayes'

diagnose_glmbayesR Documentation

GPU and OpenCL diagnostics for glmbayes

Description

Compile-time OpenCL probing for glmbayes, plus diagnose_glmbayes() — a readable report that combines opencltools host/runtime checks with this package's OpenCL build status (has_opencl).

Workstation probes (GPU vendor detection, drivers, ICD/PATH, and related helpers) live in opencltools; call opencltools::… or see ?opencltools.

Usage

diagnose_glmbayes()

has_opencl()

Details

GPU acceleration speeds up envelope construction and grid evaluation when you pass use_opencl = TRUE in glmb and related functions. CPU-only builds remain fully usable for standard modelling.

Start with diagnose_glmbayes() for a single readable report; use has_opencl() for a quick boolean when scripting. Full install notes: vignette("Chapter-16", package = "glmbayes") (\insertCiteglmbayesChapter12glmbayes).

Diagnostics exported from glmbayes

  • diagnose_glmbayes() — full report including compile-time OpenCL status for this package.

  • has_opencl() — TRUE if this build was compiled with OpenCL support.

Host / runtime checks (opencltools)

  • detect_environment_and_gpus()

  • detect_compute_runtimes()

  • verify_opencl_runtime()

  • check_runtime_env()

  • load_kernel_source(), load_kernel_library() (pass package = "glmbayes" for entry kernels under inst/cl/src/; prelude and nmath/ come from nmathopencl in the production GPU path)

  • add_to_path_windows() and related PATH helpers

References

\insertAllCited

See Also

diagnose_glmbayes, has_opencl, opencltools, glmb, rglmb.

Examples

############################### Start of load_kernel_source example ####################

if (identical(Sys.getenv("NOT_CRAN"), "true") && has_opencl()) {
  # Family entry kernels live in glmbayes; prelude/nmath in nmathopencl (production v2 path)
  ksrc <- opencltools::load_kernel_source(
    "src/f2_f3_binomial_logit.cl",
    package = "glmbayes"
  )
  nmath_stem <- opencltools::load_kernel_source(
    "nmath/bd0.cl",
    package = "nmathopencl"
  )
  nmath_lib <- opencltools::load_kernel_library(
    "nmath",
    package = "nmathopencl"
  )
  cat("Entry kernel length:", nchar(ksrc), "\n")
  cat("nmath stem length:", nchar(nmath_stem), "\n")
  cat("nmath library length:", nchar(nmath_lib), "\n")
} else {
  message("Skipping OpenCL example (CRAN check or OpenCL not built).")
}

## End of load_kernel_source example

glmbayes documentation built on Aug. 5, 2026, 1:07 a.m.

Related to gpu_diagnostics in glmbayes...