assert_cores {bigparallelr} R Documentation

## Check number of cores

### Description

Check that you are not trying to use too many cores.

### Usage

assert_cores(ncores)


### Arguments

 ncores Number of cores to check. Make sure is not larger than getOption("bigstatsr.ncores.max") (number of logical cores by default). We advise you to use nb_cores(). If you really know what you are doing, you can change this default value with options(bigstatsr.ncores.max = Inf).

### Details

It also checks if two levels of parallelism are used, i.e. having ncores larger than 1, and having a parallel BLAS enabled by default. You could remove this check by setting options(bigstatsr.check.parallel.blas = FALSE).

We instead recommend that you disable parallel BLAS by default by adding try(bigparallelr::set_blas_ncores(1), silent = TRUE) to your .Rprofile (with an empty line at the end of this file) so that this is set whenever you start a new R session. You can use usethis::edit_r_profile() to open your .Rprofile. For this to be effective, you should restart the R session or run options(default.nproc.blas = NULL) once in the current session.

Then, in a specific R session, you can set a different number of cores to use for matrix computations using bigparallelr::set_blas_ncores(), if you know there is no other level of parallelism involved in your code.

### Examples

## Not run:

assert_cores(2)

## End(Not run)



[Package bigparallelr version 0.3.2 Index]