search for: robj2slave

Displaying 10 results from an estimated 10 matches for "robj2slave".

2010 Jul 12
1
How to use mpi.allreduce() in Rmpi?
...verybody! I have the next code which makes a reduction of the *a *variable in two slaves, using the Rmpi package. library(Rmpi) mpi.spawn.Rslaves(nslaves=2) reduc<-function(){ a<-mpi.comm.rank()+2 mpi.reduce(a,type=2, op="prod") return(paste("a=",a)) } mpi.bcast.Robj2slave(reduc) mpi.remote.exec(reduc()) cat("Product: ") mpi.reduce(1,op="prod") mpi.close.Rslaves() I want to use the function mpi.allreduce() instead of mpi.reduce(), so slaves should receive the value of the reduction. I don't know how to do it and the avaliable documentatio...
2010 Jul 12
1
How to use mpi.allreduce() in Rmpi?
...verybody! I have the next code which makes a reduction of the *a *variable in two slaves, using the Rmpi package. library(Rmpi) mpi.spawn.Rslaves(nslaves=2) reduc<-function(){ a<-mpi.comm.rank()+2 mpi.reduce(a,type=2, op="prod") return(paste("a=",a)) } mpi.bcast.Robj2slave(reduc) mpi.remote.exec(reduc()) cat("Product: ") mpi.reduce(1,op="prod") mpi.close.Rslaves() I want to use the function mpi.allreduce() instead of mpi.reduce(), so slaves should receive the value of the reduction. I don't know how to do it and the avaliable documentatio...
2008 Jul 16
1
Problem with mpi.close.Rslaves()
...y = beta*x + random x <- matrix(rnorm(n*p),n,p) beta <- c(rnorm(p/2,0,5),rnorm(p/2,0,.25)) y <- x %*% beta + rnorm(n,0,20) thedata <- data.frame(y=y,x=x) fold <- rep(1:10,length=n) fold <- sample(fold) summary(lm(y~x)) # Now, send the data to the slaves mpi.bcast.Robj2slave(thedata) mpi.bcast.Robj2slave(fold) mpi.bcast.Robj2slave(p) # Send the function to the slaves mpi.bcast.Robj2slave(foldslave) # Call the function in all the slaves to get them ready to # undertake tasks mpi.bcast.cmd(foldslave()) # Create task list tasks <- vector('list&...
2008 Nov 07
1
Rmpi task-pull
...ate y's as y = beta*x + random x <- matrix(rnorm(n*p),n,p) beta <- c(rnorm(p/2,0,5),rnorm(p/2,0,.25)) y <- x %*% beta + rnorm(n,0,20) thedata <- data.frame(y=y,x=x) fold <- rep(1:10,length=n) fold <- sample(fold) summary(lm(y~x)) # Now, send the data to the slaves mpi.bcast.Robj2slave(thedata) mpi.bcast.Robj2slave(fold) mpi.bcast.Robj2slave(p) # Send the function to the slaves mpi.bcast.Robj2slave(foldslave) # Call the function in all the slaves to get them ready to # undertake tasks mpi.bcast.cmd(foldslave()) # Create task list tasks <- vector('list') for (i in 1...
2010 Oct 04
0
Syntax for Rmpi cf multicore
..._4" and that works more or less fine to produce a list of length 6 which I've named with the elements of the subsets vector. names(out) <- subsets Now, when I use mpi.apply, I make the trees, folds and minob available to all slaves thus: mpi.spawn.Rslaves(nslaves=6) mpi.bcast.Robj2slave(trees) mpi.bcast.Robj2slave(folds) mpi.bcast.Robj2slave(minob) but, I can't work out what sort of 'array' is required for the first argument to mpi.apply. out.mpi <- mpi.apply(subsets.l, lr.gbm) What should subsets.l look like? I tried a list of length 6 with elements the s...
2009 Mar 25
0
Rmpi - send/receive multiple objects to slaves
...task to be performed by a slave is on a subset of the original matrix, and due to its large size (nrow/ncol = 10-15k), it makes sense to only send the required subset of the matrix to each slave. How do I do this? For example, rather than broadcasting the whole of matrix m to all slaves: mpi.bcast.Robj2slave(m) Can I send a subset of the matrix (depending on what the tasks is) at the same time I send the task to the slaves e.g.: mpi.send.Robj(tasks[[1]], slave_id, 1) idx <- c(tasks[[1]]$start:tasks[[1]]$end) mpi.send.Robj(m[idx,idx], slave_id, 1) If so, how do I receive the two objects in the slav...
2007 Jul 05
0
Question on Rmpi looping
...dir, paste("processor",my_rank, sep=""), sep="") write(my_rank, wrout, append=TRUE) } ################## END OF SLAVES ################## # We're in the parent. #Have each slave get its rank mpi.bcast.cmd(my_rank <- mpi.comm.rank()) mpi.bcast.Robj2slave(basedir) # Send the function to the slaves mpi.bcast.Robj2slave(fcnfishtest) # Call the function x<- mpi.remote.exec(fcnfishtest()) x # close slaves and exit mpi.close.Rslaves() mpi.quit(save = "no") ##### end code The output is as follows: file 1: 1 1 1 1 file 2:...
2010 Jul 19
1
RMySQL and RMPI together
...s, I got problem when using both RMPI and RMySQL together and I thought some body in this forum can help me. I have a huge data set (more than 300,000 rows) and I would like to modify only few observations. I wrote the modifications in a function form and able to send the function to slaves using Robj2slaves from RMPI package. However the function needs MySQL data base name to extract the required observations. I used the following ways to transfer the data base name to salves: con <- dbConnect(MySQL(), dbname="XXXXX", user="XXXX", password="XXXX", host="localho...
2010 Aug 12
0
send and receiving objects with Rmpi
...where I would like to send parts of my big tablechip list. Everytime I run this, the last line always jams. I even tried to reduce the number of rows in data to 10 and still doesn't work. I even tried to do a remote.exec(ls()) and doesn't work. Any tips? #sending my function mpi.bcast.Robj2slave(forSlaves) #sending a message to all children so they wait for data mpi.bcast.cmd(cmd={data = mpi.recv.Robj(mpi.any.source(),mpi.any.tag())}) # Now, send the data to the children for( i in 1:nrow(adds)){ print(paste("sending part:",i)) data = data.frame(tablechip[[1]][adds[i,1]:adds...
2006 Feb 13
1
Turning control back over to the terminal
I'm invoking R from withing a shell script like this R --no-save --no-restore --gui=none > `hostname` 2>&1 <<BYE # various commands here BYE I would like to regain control from the invoking terminal at some point. I tried source(stdin()) but got a syntax error, presumably stdin is the little shell here snippet (the part between <<BYE and BYE). Is there some way to