Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doku:rstat [2015/04/28 12:06] irdoku:rstat [2021/09/29 12:25] (current) – [Example] goldenberg
Line 3: Line 3:
 [[http://www.r-project.org/]] [[http://www.r-project.org/]]
  
-We installed the libraries Rmpi, doMPI and foreach and their dependencies on VSC2 and VSC3.+We installed the libraries Rmpi, doMPI and foreach and their dependencies on VSC2 and VSC4.
 These libraries give you the possibility to parallelize loops over more nodes with MPI using the foreach function which is very similar to a for loop. These libraries give you the possibility to parallelize loops over more nodes with MPI using the foreach function which is very similar to a for loop.
  
Line 25: Line 25:
 === Parallel execution === === Parallel execution ===
  
-The R-code may be parallelized in the following form: +In R, the code **berk-rmpi.R** may be parallelized in the following form:
-   * berk-rmpi.R+
 <code> <code>
 # basic example with foreach # basic example with foreach
 # start R as usual:'R'or via a batch job # start R as usual:'R'or via a batch job
-library (Rmpi)+library (Rmpi)             
 library (doMPI) library (doMPI)
 cl <- startMPIcluster () cl <- startMPIcluster ()
Line 43: Line 42:
 </code> </code>
  
- +On VSC3 the script reads:
-using this script on VSC2: +
-<code> +
-#$ -N rstat +
-#$ -V +
-#$ -pe mpich 16 +
-#$ -l h_rt=01:00:00 +
-echo $NSLOTS +
-mpirun -machinefile $TMPDIR/machines -np 16 ~/sw/rstat/bin/R CMD BATCH berk-rmpi.R +
-</code> +
- +
-using this script on VSC3:+
 <code> <code>
 #!/bin/sh #!/bin/sh
Line 69: Line 57:
 mpirun R CMD BATCH berk-rmpi.R mpirun R CMD BATCH berk-rmpi.R
 </code> </code>
- +yielding to an execution time [s] of 
- +
-takes on VSC2:+
 <code> <code>
 > proc.time() > proc.time()
    user  system elapsed     user  system elapsed 
-  8.495   0.264   9.616 +  4.566   0.156   5.750 
 </code> </code>
  • doku/rstat.1430222787.txt.gz
  • Last modified: 2015/04/28 12:06
  • by ir