Skip to content

investigate reduction within parallel_for #189

@paciorek

Description

@paciorek

for parallelized declFuns, we have need for code like this:

  nc <- nClass(
        Cpublic = list(
            go = nFunction(
                fun = function(x = 'numericVector') {
                    logProb_y <- x
                    sum <- 0
                    parallel_for(i, 1:length(x), {
                        logProb_y[i] <- 2*x[i]
                        sum <- sum + logProb_y[i]
                    })
                    return(sum)
                },
                returnType = 'numericScalar'
            )
        )
    )
    Cnc <- nCompile(nc)

Currently that gives this error in our compilation processing.

Error in TensorReduction(<environment>, NULL) : 
  could not find function "TensorReduction"

So we'll want to investigate if this is possible with TBB. Perhaps only with TBB reduction functionality given the need to write to shared sum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions