Interface allowing R to use OpenCL
Overview
This package provides an interface to OpenCL, allowing R to leverage computing power of GPUs and other HPC accelerator devices.
- Do not issue kernel compiler warning if the build log
string consists solely of whitespaces. (#21)
- Replace DATAPTR with INTEGER/REAL to be API compliant.
From NEWS in the release
Install
Health
ERRORexamplesr-oldrel-macos-arm64, r-release-macos-arm64
Running examples in ‘OpenCL-Ex.R’ failed
The error most likely occurred in:
> ### Name: clBuffer
> ### Title: Create and handle OpenCL buffers
> ### Aliases: clBuffer as.clBuffer as.double.clBuffer as.integer.clBuffer
> ### is.clBuffer print.clBuffer length.clBuffer [.clBuffer [<-.clBuffer
> ### Keywords: interface
>
> ### ** Examples
>
> library(OpenCL)
>
> ## Only proceed if this machine has at least one OpenCL platform
> if (length(oclPlatforms())) {
+
+ ctx<-oclContext()
+
+ buf<-clBuffer(ctx, 16, "numeric")
+ # Do not write buf<-..., as this replaces buf with a vector.
+ buf[]<-sqrt(1:16)
+ buf
+
+ intbuf<-as.clBuffer(1:16, ctx)
+ print(intbuf)
+
+ length(buf)
+ as.numeric(buf)
+ buf[]
+
+ buf[3:5]
+ buf[1:2] = 0
+ buf
+
+ ## clBuffer is the required argument and return type of oclRun.
+ ## See oclRun() examples.
+ }
Error in oclDevices(type = device) :
clGetDeviceIDs failed, oclError -30: invalid value (CL_INVALID_VALUE)
Calls: oclContext -> oclDevices
Execution haltedERRORtestsr-oldrel-macos-arm64, r-release-macos-arm64
Running ‘buffer.R’ [0s/0s]
Running the tests in ‘tests/buffer.R’ failed.
Complete output:
> # 0. Create context
> library(OpenCL)
>
> if (!length(oclPlatforms())) {
+ cat("== Cannot run tests as there is no platform")
+ q("no")
+ }
>
> ctx<-oclContext()
Error in oclDevices(type = device) :
clGetDeviceIDs failed, oclError -30: invalid value (CL_INVALID_VALUE)
Calls: oclContext -> oclDevices
Execution haltedNOTEDESCRIPTION meta-informationr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64
r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64
License stub is invalid DCF.
r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc
Licence stub is invalid DCF.
NOTEtestsr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-oldrel-macos-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-x86_64
r-patched-linux-x86_64, r-release-linux-x86_64
Running ‘buffer.R’ [0s/1s]
Comparing ‘buffer.Rout’ to ‘buffer.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
Running ‘kernel.R’ [4s/6s]
Comparing ‘kernel.Rout’ to ‘kernel.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >r-devel-linux-x86_64-debian-clang
Running ‘buffer.R’ [0s/1s]
Comparing ‘buffer.Rout’ to ‘buffer.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
Running ‘kernel.R’ [4s/7s]
Comparing ‘kernel.Rout’ to ‘kernel.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >r-devel-linux-x86_64-debian-gcc
Running ‘buffer.R’ [0s/1s]
Comparing ‘buffer.Rout’ to ‘buffer.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
Running ‘kernel.R’ [3s/3s]
Comparing ‘kernel.Rout’ to ‘kernel.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >r-devel-linux-x86_64-fedora-clang
Running ‘buffer.R’
Comparing ‘buffer.Rout’ to ‘buffer.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
Running ‘kernel.R’
Comparing ‘kernel.Rout’ to ‘kernel.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
18,19d11
< OMP: Warning #96: Cannot form a team with 28 threads, using 2 instead.
< OMP: Hint Consider unsetting KMP_DEVICE_THREAD_LIMIT (KMP_ALL_THREADS), KMP_TEAMS_THREAD_LIMIT, and OMP_THREAD_LIMIT (if any are set).r-devel-linux-x86_64-fedora-gcc
Running ‘buffer.R’
Comparing ‘buffer.Rout’ to ‘buffer.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
Running ‘kernel.R’
Comparing ‘kernel.Rout’ to ‘kernel.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >r-oldrel-macos-x86_64
Running ‘buffer.R’ [0s/0s]
Comparing ‘buffer.Rout’ to ‘buffer.Rout.save’ ...5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
77c71
< OpenCL buffer, 16 elements of type single
---
> OpenCL buffer, 16 elements of type double
79c73
< [9] 3.316625 3.464102 3.605551 3.741657 3.872983 4.000000 4.123106 4.242640
---
> [9] 3.316625 3.464102 3.605551 3.741657 3.872983 4.000000 4.123106 4.242641
Running ‘kernel.R’ [0s/1s]
Comparing ‘kernel.Rout’ to ‘kernel.Rout.save’ ...5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
29c23
< OpenCL buffer, 16 elements of type single
---
> OpenCL buffer, 16 elements of type double
32,35c26,27
< OpenCL buffer, 16 elements of type single
< [1] 1.00000 4.00000 9.00000 16.00000 25.00000 36.00001 48.99999
< [8] 63.99999 81.00000 100.00000 121.00002 144.00000 169.00000 196.00003
< [15] 225.00003 256.00000
---
> OpenCL buffer, 16 elements of type double
> [1] 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256
42c34
< OpenCL buffer, 16 elements of type single
---
> OpenCL buffer, 16 elements of type doubler-release-macos-x86_64
Running ‘buffer.R’ [0s/0s]
Comparing ‘buffer.Rout’ to ‘buffer.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
77c71
< OpenCL buffer, 16 elements of type single
---
> OpenCL buffer, 16 elements of type double
79c73
< [9] 3.316625 3.464102 3.605551 3.741657 3.872983 4.000000 4.123106 4.242640
---
> [9] 3.316625 3.464102 3.605551 3.741657 3.872983 4.000000 4.123106 4.242641
Running ‘kernel.R’ [0s/1s]
Comparing ‘kernel.Rout’ to ‘kernel.Rout.save’ ...
5,10d4
< >
< > if (!length(oclPlatforms())) {
< + cat("== Cannot run tests as there is no platform")
< + q("no")
< + }
< >
29c23
< OpenCL buffer, 16 elements of type single
---
> OpenCL buffer, 16 elements of type double
32,35c26,27
< OpenCL buffer, 16 elements of type single
< [1] 1.00000 4.00000 9.00000 16.00000 25.00000 36.00001 48.99999
< [8] 63.99999 81.00000 100.00000 121.00002 144.00000 169.00000 196.00003
< [15] 225.00003 256.00000
---
> OpenCL buffer, 16 elements of type double
> [1] 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256
42c34
< OpenCL buffer, 16 elements of type single
---
> OpenCL buffer, 16 elements of type double- ERROR8 NOTE, 2 ERRORNow
- ERROR9 NOTE, 3 ERROR2026-03-10
Documentation
- Help pages
- 9
- Examples that run
- 100%7 run in a plain check
- Exported functions with examples
- 78%
- Documented parameters
- not tracked
- Return-value docs
- not tracked
- Help pages citing references
- 11%
Downloads
Repository
- PRs merged (all time)
- 50%
- Median days to close, 50 most recently updated closed issues
- 17
- Median days to close, 50 most recently updated closed PRs
- 164
Stars over time
Forks over time
Issues over time
PRs over time
Checks run against github.com/s-u/opencl on 2026-10-11.
No development-tooling practices detected in the upstream repository.
Dependencies
Installing OpenCL adds no packages beyond those that come with R.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 0.2-11Latest
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- 0.2-102023-12-22 · diff ↗
- 0.2-9
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- 0.2-2
- RR 4.1.0 released · 2021-05-18
- RR 4.0.0 released · 2020-04-24
- 0.2-1
- RR 3.6.0 released · 2019-04-26
- 0.1-3.12019-01-31 · diff ↗
- RR 3.5.0 released · 2018-04-23
- RR 3.4.0 released · 2017-04-21
Show 11 earlier eventsHide 11 earlier events
Package metadata
- First published
- 2011-08-08
- Total releases
- 10 / 15 yrs
- License
- BSD_3_clause + file LICENSE OSI
- Minimum R
- ≥ 2.0.0
- Download size
- 31 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("OpenCL")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.