R/omp.R

Defines functions setDelapThreads getDelapThreads

Documented in getDelapThreads setDelapThreads

# Copyright (c) 2023, Avraham Adler All rights reserved
# SPDX-License-Identifier: BSD-2-Clause

# Function to get current active number of threads
getDelapThreads <- function() {
  .Call(gOMPT_C)
}

setDelapThreads <- function(n) {
  n <- as.integer(floor(n))
  if (n <= 0L) {
    stop("Number of threads must be > 0.")
  }
  ncpus <- getOption("DLPCPU")
  if (n > ncpus && !is.na(ncpus)) {
    message("Capping at system maximum of ", ncpus, ".")
    n <- ncpus
  }
  invisible(.Call(sOMPT_C, n))
}

Try the Delaporte package in your browser

Any scripts or data that you put into this service are public.

Delaporte documentation built on June 22, 2024, 10:43 a.m.