Crandore Hub

RsimdDispatch

Runtime 'SIMD' Dispatch Templates for 'C' Code in 'R' Packages

Provides templates and a working example for runtime Single Instruction Multiple Data ('SIMD') dispatch in 'C' code used by 'R' packages. Packages can stage scalar and architecture-specific kernel objects during configuration, then select a compiled and CPU-supported implementation at runtime through guarded function pointers. The package also vendors the header-only 'SIMDe' library for downstream packages through the 'LinkingTo' field.

README

# RsimdDispatch C template

This directory is a copyable starting point for pure-C runtime SIMD dispatch in
an R package.

The important pattern is:

- compile R API, CPU detection, and dispatch files through ordinary `src/Makevars`;
- stage scalar and optional SIMD kernel objects during `configure`;
- select only a backend that is both compiled and supported by the current CPU;
- switch guarded function pointers when `simd_set_backend()` is called.

Copy with:

```r
RsimdDispatch::use_simd_dispatch("/path/to/pkg", pkg = "YourPackage", prefix = "ypkg")
```

The helper substitutes the package name and C symbol prefixes. Then replace the
example `count_nonzero()` kernel with your package-specific kernel signature.
See `CHECKLIST.md` if you copy files manually.

Versions across snapshots

VersionRepositoryFileSize
0.1.1 rolling linux/jammy R-4.5 RsimdDispatch_0.1.1.tar.gz 837.5 KiB
0.1.1 rolling linux/noble R-4.5 RsimdDispatch_0.1.1.tar.gz 837.6 KiB
0.1.1 rolling source/ R- RsimdDispatch_0.1.1.tar.gz 893.8 KiB
0.1.1 latest linux/jammy R-4.5 RsimdDispatch_0.1.1.tar.gz 837.5 KiB
0.1.1 latest linux/noble R-4.5 RsimdDispatch_0.1.1.tar.gz 837.6 KiB
0.1.1 latest source/ R- RsimdDispatch_0.1.1.tar.gz 893.8 KiB
0.1.1 2026-04-23 source/ R- RsimdDispatch_0.1.1.tar.gz 0 B

Dependencies (latest)

Suggests