registerDoParallel on shinyio

400 views
Skip to first unread message

David Bescond

unread,
Aug 6, 2015, 8:17:46 AM8/6/15
to ShinyApps Users
Hello,

did someone find solution to used DoParallel on Shinyio

I tried

on Global.r :::
library(doParallel)


cl <- makeCluster(detectCores() - 1)
registerDoParallel(cl)
foreach(i=1:nrow(m), .combine=rbind) %dopar%
  (m[i,] / mean(m[i,]))
stopCluster(cl)


::::::: failed

then on server.r
cl <- makeCluster(detectCores() - 1)
registerDoParallel(cl)
foreach(i=1:nrow(m), .combine=rbind) %dopar% (m[i,] / mean(m[i,]))
stopCluster(cl)

failed
work only if

cl <- makeCluster(detectCores() - 1)
foreach(i=1:nrow(m), .combine=rbind) %dopar% (m[i,] / mean(m[i,]))
stopCluster(cl)

but it means
no parallel ?

is there a solution to registered parallel process on shinyio ?

Andy Kipp

unread,
Aug 7, 2015, 11:32:27 AM8/7/15
to David Bescond, ShinyApps Users
Did you check the logs for any errors when trying to run in parallel?

showLogs()

--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/b7ed88e8-0967-457b-87ad-6880cbefd5fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bescond, David

unread,
Aug 10, 2015, 5:55:12 AM8/10/15
to Andy Kipp, ShinyApps Users

I passed with

/////////////////////////////////////////

library(doParallel)

gc()

cl <- makeCluster(detectCores() - 1, type  ="FORK" )
registerDoParallel(cl)

foreach(i=1:nrow(m), .combine=rbind) %dopar%

  (m[i,] / mean(m[i,]))

stopCluster(cl); rm(cl) ; gc()

////////////////////////////////////////////////

 

but I am not sure that is the best type for shinyappsio

I often obtain

"error: error reading from connection"

and the same on my computer (under win) with type = "SOCK"

 

so on my computer I move to doSNOW with

/////////////////////////////////////////

library(doSNOW)

gc()

cl <- makeCluster(detectCores() - 1, type  ="SOCK" )
registerDoSNOW(cl)

foreach(i=1:nrow(m), .combine=rbind) %dopar%

  (m[i,] / mean(m[i,]))

stopCluster(cl); rm(cl) ; gc()

////////////////////////////////////////////////

and it is much better

but the makeCluster of doSNOW doesn't work on shinyappsio

 

what is the exact type that I need to implement on my apps (https://ilostat.shinyapps.io/Rilostat)

 

thanks

-----------------------------------------
This electronic message may contain confidential, proprietary or privileged information intended solely for the use of the named recipient. The ILO is not liable for any error or virus connected with this transmission.
-----------------------------------------
Ce message électronique peut contenir des informations confidentielles, ou spécialement protégées, à la seule intention du destinataire. L'OIT ne peut être tenue responsable des erreurs ou des virus qui s'y trouveraient.
-----------------------------------------
Este mensaje electrónico puede contener información confidencial o especialmente protegida para el uso exclusivo del destinatario indicado. La OIT no se responsabiliza en caso de error o virus.
-----------------------------------------

Andy Kipp

unread,
Aug 10, 2015, 9:46:01 AM8/10/15
to Bescond, David, ShinyApps Users
David

Honestly I don't think too many people use parallel processing with shinyapps.io, so I can't say for sure which method would work best. I suspect snow is not working because you're not installing the required packages. 

It's also worth noting that shinyapps.io limits memory on the free plan, which may cause problems with attempting to run multiple R processes. 

-Andy

Bescond, David

unread,
Aug 12, 2015, 2:25:36 AM8/12/15
to Andy Kipp, ShinyApps Users

Thanks Andy,

 

I used

 

library(doSNOW)

cl <- parallel::makeCluster(detectCores() - 1)
registerDoSNOW(cl)

foreach(i=1:nrow(m), .combine=rbind) %dopar%

  (m[i,] / mean(m[i,]))
stopCluster(cl); rm(cl) ; gc()

and it work fine,

 

thanks

 

David

Reply all
Reply to author
Forward
0 new messages