flexiblas-threads {flexiblas}R Documentation

Get/Set Number of Threads

Description

Get or set the number of threads for the BLAS backend.

Usage

flexiblas_get_num_threads()

flexiblas_set_num_threads(n)

Arguments

n

number of threads.

Value

flexiblas_get_num_threads returns the number of threads.

flexiblas_set_num_threads returns nothing.

See Also

flexiblas_avail, flexiblas_version, flexiblas-backends

Examples


max_threads <- 4
n <- 2000
runs <- 10

A <- matrix(runif(n*n), nrow=n)
B <- matrix(runif(n*n), nrow=n)

for (i in seq_len(max_threads)) {
  message("Set number of threads to: ", i)
  flexiblas_set_num_threads(i)

  print(system.time({
    for (j in seq_len(runs))
      C <- A %*% B
  }))
}



[Package flexiblas version 3.4.0 Index]