Translations:R/32/fr: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(Created page with "<source lang="r"> #Tell all slaves to return a message identifying themselves. library("Rmpi") sprintf("TEST mpi.universe.size() = %i", mpi.universe.size()) ns <- mpi....")
 
(J'ai enlevé des espaces et rajouté 2 lignes de code (voir justif. anglaise))
Line 1: Line 1:
<source lang="r">
<source lang="r">
#Tell all slaves to return a message identifying themselves.
#Tell all slaves to return a message identifying themselves.
  library("Rmpi")
library("Rmpi")
  sprintf("TEST mpi.universe.size() =  %i", mpi.universe.size())
sprintf("TEST mpi.universe.size() =  %i", mpi.universe.size())
  ns <- mpi.universe.size() - 1
ns <- mpi.universe.size() - 1
  sprintf("TEST attempt to spawn %i slaves", ns)
sprintf("TEST attempt to spawn %i slaves", ns)
  mpi.spawn.Rslaves(nslaves=ns)
mpi.spawn.Rslaves(nslaves=ns)
  mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size()))
mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size()))
  mpi.remote.exec(paste(mpi.comm.get.parent()))
mpi.remote.exec(paste(mpi.comm.get.parent()))
  #Send execution commands to the slaves
#Send execution commands to the slaves
  x<-5
x<-5
  #These would all be pretty correlated one would think
#These would all be pretty correlated one would think
  x<-mpi.remote.exec(rnorm,x)
x<-mpi.remote.exec(rnorm,x)
  length(x)
length(x)
  x
x
mpi.close.Rslaves()
mpi.quit()
</source>
</source>

Revision as of 15:26, 20 March 2018

Information about message (contribute)
This message has no documentation. If you know where or how this message is used, you can help other translators by adding documentation to this message.
Message definition (R)
1. Place your R code in a script file, in this case the file is called ''test.R''.
#Tell all slaves to return a message identifying themselves.
library("Rmpi")
sprintf("TEST mpi.universe.size() =  %i", mpi.universe.size())
ns <- mpi.universe.size() - 1
sprintf("TEST attempt to spawn %i slaves", ns)
mpi.spawn.Rslaves(nslaves=ns)
mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size()))
mpi.remote.exec(paste(mpi.comm.get.parent()))
#Send execution commands to the slaves
x<-5
#These would all be pretty correlated one would think
x<-mpi.remote.exec(rnorm,x)
length(x)
x
mpi.close.Rslaves()
mpi.quit()