HenrikBengtsson / doFuture

:rocket: R package: doFuture - Use Foreach to Parallelize via Future Framework
https://doFuture.futureverse.org
84 stars 6 forks source link

How to stop plan(multisession) #67

Closed zhengchencai closed 2 years ago

zhengchencai commented 2 years ago

Hi there,

Is there a way to stop the registered multisession? I tried plan(eager) but it says no such function.

Thanks

HenrikBengtsson commented 2 years ago

Is there a way to stop the registered multisession?

plan(sequential)

should do it.

I tried plan(eager) but it says no such function.

I'm curious, where did you find instruction to use plan(eager)? Because eager was removed from future in version 1.7.0 (2018-02-11), and if there are instructions out there, I'll see if they can be updated.

zhengchencai commented 2 years ago

Thanks, I see it from here https://www.rdocumentation.org/packages/future/versions/0.11.0/topics/eager.

In the end, I used future:::ClusterRegistry("stop"). Will try plan(sequential).

May I ask a question here? How can I make two foreach blocks go parallel? For instance, I have two foreach blocks using different input data but doing the same calculation, each takes 32 cores, I have 64 cores in total, so to fully use the resources, I would like to make these two blocks go parallel instead of using 32 cores each time. Should I do a foreach in side foreach? Would you mind to write a toy example here? Thank you very much.

HenrikBengtsson commented 2 years ago

Thanks, I see it from here https://www.rdocumentation.org/packages/future/versions/0.11.0/topics/eager.

Okay, that's a very very old help page - future 0.11.0 is from 2016-01-20. Oh well.

In the end, I used future:::ClusterRegistry("stop"). Will try plan(sequential).

Internal functions are not guaranteed to be supported going forward, so avoid those.

May I ask a question here? How can I make two foreach blocks go parallel? For instance, I have two foreach blocks using different input data but doing the same calculation, each takes 32 cores, I have 64 cores in total, so to fully use the resources, I would like to make these two blocks go parallel instead of using 32 cores each time. Should I do a foreach in side foreach? Would you mind to write a toy example here? Thank you very much.

Please start a new thread on https://github.com/HenrikBengtsson/future/discussions.