HenrikBengtsson / future.apply

:rocket: R package: future.apply - Apply Function to Elements in Parallel using Futures
https://future.apply.futureverse.org
208 stars 16 forks source link

Struggling to get cluster plan working #78

Closed tylerlittlefield closed 3 years ago

tylerlittlefield commented 3 years ago

I have 3 raspberry pi's that I can SSH into without providing a password. I run:

library(future.apply)

workers <- c("rpi-main", "rpi-worker-01", "rpi-worker-02")
plan(cluster, workers = workers)

And I get:

bash: /Library/Frameworks/R.framework/Resources/bin/Rscript: No such file or directory

Any ideas what I'm doing wrong? If I provide the IP instead of the hostname, it asks for password and uses <username>@<ip> where the username isn't what I actually want.

HenrikBengtsson commented 3 years ago

Try with:

plan(cluster, workers=workers, homogeneous=FALSE)
tylerlittlefield commented 3 years ago

So I just realized I don't have R installed on one of the Pi's, but I tried with a node that does with:

library(future.apply)

workers <- c("rpi-worker-01")
plan(cluster, workers = workers, homogeneous=FALSE)

And I get:

Error: Initialization of plan() failed, because the test future used for validation failed. The reason was: Package 'future' is not installed on worker (r_version: 4.0.3 (2020-10-10); platform: aarch64-unknown-linux-gnu (64-bit); os: Linux 5.8.0-1010-raspi #13-Ubuntu SMP PREEMPT Wed Dec 9 17:14:07 UTC 2020; hostname: worker-01)
tylerlittlefield commented 3 years ago

Oh and now that I've actually read the error message... maybe I should install future and R on each node :D

Update: With future installed on the node, the following works just fine:

library(future.apply)

workers <- c("rpi-worker-01")
plan(cluster, workers = workers, homogeneous=FALSE)

Closing this, thanks for the quick response!

HenrikBengtsson commented 3 years ago

That's great to hear. Could you please check that it also works with homogeneous = NULL for you, i.e.

plan(cluster, workers = workers, homogeneous=NULL)

It should work.

I'm planning to make homogeneous=NULL the default in future, so that you don't have to specify it at all;

plan(cluster, workers = workers)
tylerlittlefield commented 3 years ago

With homogeneous = NULL, I get the same error about missing Rscript.

library(future)

workers <- c("rpi-main", "rpi-worker-01", "rpi-worker-02")
plan(cluster, workers = workers, homogeneous=NULL)
#> bash: /Library/Frameworks/R.framework/Resources/bin/Rscript: No such file or directory

It basically just hangs there and I end up stopping the command.