An: Martin Spindler martin.spind...@gmx.de
Cc: r-help@r-project.org r-help@r-project.org
Betreff: Re: [R] R parallel / foreach - aggregation of results
Try this chance to actually return values:
library(doParallel)
Simpar3 - function(n1) {
L2distance - matrix(NA, ncol=n1, nrow=n1
. Juli 2015 um 18:22 Uhr
Von: jim holtman jholt...@gmail.com
An: Martin Spindler martin.spind...@gmx.de
Cc: r-help@r-project.org r-help@r-project.org
Betreff: Re: [R] R parallel / foreach - aggregation of results
Try this chance to actually return values:
library(doParallel)
Simpar3 - function(n1
: [R] R parallel / foreach - aggregation of results
Try this chance to actually return values:
library(doParallel)
Simpar3 - function(n1) {
L2distance - matrix(NA, ncol=n1, nrow=n1)
data - rnorm(n1)
diag(L2distance)=0
cl - makeCluster(4)
registerDoParallel(cl)
x
Dear all,
when I am running the code attached below, it seems that no results are
returned, only the predefined NAs. What mistake do I make?
Any comments and help is highly appreciated.
Thanks and best,
Martin
Simpar3 - function(n1) {
L2distance - matrix(NA, ncol=n1, nrow=n1)
data -
Martin,
I think the main problem is that you are trying to assign your results
to the result matrix inside the foreach loop. Parallel functions in R
are generally not good at updating parts of matrices from the different
workers in this way. Instead, using e.g. foreach, each loop of the
Try this chance to actually return values:
library(doParallel)
Simpar3 - function(n1) {
L2distance - matrix(NA, ncol=n1, nrow=n1)
data - rnorm(n1)
diag(L2distance)=0
cl - makeCluster(4)
registerDoParallel(cl)
x - foreach(j=1:n1) %dopar% {
library(np)
datj - data[j]
6 matches
Mail list logo