R: Difference between revisions

Jump to navigation Jump to search
20 bytes removed ,  6 years ago
no edit summary
No edit summary
No edit summary
Line 221: Line 221:
For more on submitting jobs, see the [[Running jobs]] page.
For more on submitting jobs, see the [[Running jobs]] page.


</translate>
=== doParallel and foreach ===
 
<!--T:40-->
=== doParallel and foreach === <!--T:40-->
====Usage====  
====Usage==== <!--T:42-->
Foreach can be considered as a unified interface for all backends (i.e. doMC, doMPI, doParallel, doRedis, etc.). It works on all platforms, assuming that the backend works. doParallel acts as an interface between foreach and the parallel package and can be loaded alone. There are some known efficiency issues when using foreach to run a very large number of very small tasks. Therefore, keep in mind that the following code is not the best example of an optimized use of the foreach() call but rather that the function chosen was kept at a minimum for demonstration purposes.
Foreach can be considered as a unified interface for all backends (i.e. doMC, doMPI, doParallel, doRedis, etc.). It works on all platforms, assuming that the backend works. doParallel acts as an interface between foreach and the parallel package and can be loaded alone. There are some known efficiency issues when using foreach to run a very large number of very small tasks. Therefore, keep in mind that the following code is not the best example of an optimized use of the foreach() call but rather that the function chosen was kept at a minimum for demonstration purposes.


Line 233: Line 232:
# to register the backend;
# to register the backend;
# to call foreach() by keeping it on the same line as the %do% (serial) or %dopar% operator.
# to call foreach() by keeping it on the same line as the %do% (serial) or %dopar% operator.
<!--T:41-->
====Running====


====Running==== <!--T:44-->
<!--T:45-->
1. Place your R code in a script file, in this case the file is called ''test_foreach.R''.
1. Place your R code in a script file, in this case the file is called ''test_foreach.R''.


Line 299: Line 298:
<!--T:51-->
<!--T:51-->
For more on submitting jobs, see the [[Running jobs]] page.
For more on submitting jobs, see the [[Running jobs]] page.
</translate>
rsnt_translations
56,426

edits

Navigation menu