has_metal: Check Apple Metal Backend Availability for fastPLS

View source: R/native_api.R

has_metalR Documentation

Check Apple Metal Backend Availability for fastPLS

Description

Report whether the fixed CPU/Metal operation-split fastPLS backend can be used in the current session.

Usage

has_metal()

Details

has_metal() returns TRUE only when both conditions hold:

  • the package was built with Apple Metal support;

  • the Metal backend is available in the current session.

If either condition is not met, the function returns FALSE. This includes non-macOS builds and portable builds that use the Metal stub backend. The result describes backend availability for the current R session; it does not select a device, allocate GPU memory, or run a test computation. When the Xcode Metal compiler is available during installation, fastPLS compiles and embeds its custom shader library. Device and pipeline initialization is then incurred by the first Metal operation, while subsequent operations in the same R session reuse the initialized state. A true result identifies availability of the operation-split backend; it does not imply that an entire PLS fit is GPU resident.

Value

A length-1 logical.

See Also

has_cuda, fastsvd, pls

Examples

has_metal()

fastPLS documentation built on Sept. 29, 2026, 1:06 a.m.