The R Project SVN R

Rev

Rev 85532 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 85532 Rev 85990
Line 156... Line 156...
156
p <- mcparallel(1:10)
156
p <- mcparallel(1:10)
157
q <- mcparallel(1:20)
157
q <- mcparallel(1:20)
158
# wait for both jobs to finish and collect all results
158
# wait for both jobs to finish and collect all results
159
res <- mccollect(list(p, q))
159
res <- mccollect(list(p, q))
160
 
160
 
161
## IGNORE_RDIFF_BEGIN
-
 
162
## reports process ids, so not reproducible
161
\dontdiff{% reports process ids, so not reproducible
163
p <- mcparallel(1:10)
162
p <- mcparallel(1:10)
164
mccollect(p, wait = FALSE, 10) # will retrieve the result (since it's fast)
163
mccollect(p, wait = FALSE, 10) # will retrieve the result (since it's fast)
165
mccollect(p, wait = FALSE)     # will signal the job as terminating
164
mccollect(p, wait = FALSE)     # will signal the job as terminating
166
mccollect(p, wait = FALSE)     # there is no longer such a job
165
mccollect(p, wait = FALSE)     # there is no longer such a job
167
## IGNORE_RDIFF_END
-
 
168
 
166
}
169
\dontshow{set.seed(123, "L'Ecuyer"); mc.reset.stream()}
167
\dontshow{set.seed(123, "L'Ecuyer"); mc.reset.stream()}
170
# a naive parallel lapply can be created using mcparallel alone:
168
# a naive parallel lapply can be created using mcparallel alone:
171
jobs <- lapply(1:10, function(x) mcparallel(rnorm(x), name = x))
169
jobs <- lapply(1:10, function(x) mcparallel(rnorm(x), name = x))
172
mccollect(jobs)
170
mccollect(jobs)
173
}
171
}