Rhpc_apply: Parallel apply using MPI

View source: R/RhpcExt.R

Rhpc_applyR Documentation

Parallel apply using MPI

Description

MPI-based version of apply for arrays and matrices.

Usage

Rhpc_apply(cl = NULL, X, MARGIN, FUN, ...,
           usequote = ifelse(is.logical(getOption("Rhpc.usequote")),
                             getOption("Rhpc.usequote"), TRUE))

Arguments

cl

external pointer to MPI communicator

X

array or matrix

MARGIN

vector giving the subscripts which the function will be applied over. 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns

FUN

function to apply

...

additional arguments passed to FUN

usequote

logical; if FALSE, quote handling is skipped for performance improvement

Details

This function applies FUN to array margins specified by MARGIN, distributing the work across MPI workers.

If X has dimension subscripts not in MARGIN, those are used as the margin dimensions for applying the function.

Value

Array or matrix of results from applying FUN to the specified margins.

See Also

Rhpc_lapply, Rhpc_sapply


Rhpc documentation built on Aug. 4, 2026, 1:07 a.m.