Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/georob_exported_functions.R
This page documents the function pmm
for parallelized matrix
multiplication and the function
control.pcmp
, which controls
the behaviour of pmm
and other functions that execute tasks in
parallel.
1 2 3 4 5 | pmm(A, B, control = control.pcmp())
control.pcmp(pmm.ncores = 1, gcr.ncores = 1, max.ncores = detectCores(),
f = 1, sfstop = FALSE, allow.recursive = TRUE,
fork = !identical(.Platform[["OS.type"]], "windows"), ...)
|
A, B |
matrices to be multiplied. |
control |
a list of with the arguments |
pmm.ncores |
number (integer, default 1) of cores used for parallelized matrix multiplication. |
gcr.ncores |
number (integer, default 1) of cores used for parallelized computation of semi-variance matrix. |
max.ncores |
maximum number of cores (integer, default all cores of a machine) used for parallelized computations. |
f |
number (integer, default 2) of tasks assigned to each core in parallelized operations. |
sfstop |
logical controlling whether the SNOW socket cluster is
stopped after each parallelized matrix multiplication on windows OS
(default |
allow.recursive |
logical controlling whether nested parallelized
computation should be allowed (default |
fork |
logical controlling whether forking should be used for
parallel computations (default |
... |
further arguments, currently not used. |
Parallelized matrix multiplication shortens computing time for large data
sets (n>1000). However, spawning child processes requires itself
resources and increasing the number of cores for parallel matrix
multiplication does not always result in reduced computing time. A
sensible default for the number of cores is likely
pmm.ncores=2
.
Note, however, that very substantial reductions in computing time
results when one uses the OpenBLAS library instead of the
reference BLAS library that ships with R, see
https://www.openblas.net/ and R FAQ for your OS. With OpenBLAS no
gains are obtained by using more than one core for matrix
multiplication, and one should therefore use the default argument
pmm.ncores = 1
for control.pcmp()
.
max.ncores
controls how many child processes are spawned in total.
This can be used to prevent that child processes spawn
themselves children which may result in a considerable number of child
processes.
pmm
:the matrix product A %*% B
,
control.pcmp
:a list with components
pmm.ncores
, gcr.ncores
, max.ncores
, f
,
sfstop
,
allow.recursive
.
Andreas Papritz andreas.papritz@env.ethz.ch.
georobIntro
for a description of the model and a brief summary of the algorithms;
georob
for (robust) fitting of spatial linear models.
1 2 3 4 5 6 7 8 | ## Not run:
A <- as.matrix(dist(rnorm(2000)))
B <- as.matrix(dist(rnorm(2000)))
system.time(C <- pmm(A, B, control = control.pcmp(pmm.ncores = 1)))
## using 4 cores
## system.time(C <- pmm(A, B, control = control.pcmp(pmm.ncores = 4)))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.