Package 'amatrix.metal'

Title: Metal Sparse Backend for 'amatrix' on macOS
Description: Experimental sparse-first GPU backend for the 'amatrix' package using Apple 'Metal'. Provides a direct Objective-C++ bridge for sparse matrix times dense matrix products on macOS; on other platforms (or without the 'Metal' frameworks) it builds a mock bridge and reports itself unavailable, so installation is safe anywhere.
Authors: Bradley Buchsbaum [aut, cre]
Maintainer: Bradley Buchsbaum <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-07-10 10:09:33 UTC
Source: https://github.com/bbuchsbaum/amatrix

Help Index


Profile Metal backend bridge timing

Description

Enable, reset, and read lightweight native timing counters for the Metal backend bridge. Counters cover sparse and dense uploads, sparse product command submission and synchronization, deferred pending waits, and host materialization. Profiling is disabled by default to avoid overhead in normal use.

Usage

amatrix_metal_profile(reset = FALSE)

amatrix_metal_profile_enable(enabled = TRUE, reset = FALSE)

amatrix_metal_profile_reset()

Arguments

reset

Logical scalar. For amatrix_metal_profile(), reset counters after reading them. For amatrix_metal_profile_enable(), reset counters before changing the enabled state.

enabled

Logical scalar. Whether native Metal bridge profiling should collect timing counters.

Value

amatrix_metal_profile() returns a named numeric vector of timing counters in milliseconds plus call counts. The enable and reset helpers return invisibly.

Examples

## Not run: 
amatrix_metal_enable_probe(register = TRUE)
amatrix_metal_profile_enable(TRUE, reset = TRUE)

# Run Metal-backed operations here.

amatrix_metal_profile()
amatrix_metal_profile_enable(FALSE)

## End(Not run)