amuse icon indicating copy to clipboard operation
amuse copied to clipboard

Add option to the instantiation of a module.

Open stevemcmillan opened this issue 5 years ago • 3 comments

Is your feature request related to a problem? Please describe. Not really a problem, but something I'd like to have.

Describe the solution you'd like I have written code in ph4 to allow the user to specify the number of GPUs for each worker in the parallel code to use (requires sapporo_2). Currently I pass that number as a parameter:

ph4.parameters.n_gpu = xxx. 

I'd like to have the alternative of including it in the instantiation of ph4:

grav = ph4(number_of_workers = 3, mode = "gpu", number_of_gpus = 2)

Describe alternatives you've considered I can do it using parameters, but the init function for ph4 is opaque to me, so advice on how to modify it would be appreciated.

Additional context Add any other context or logfiles about the feature request here. N/A

stevemcmillan avatar Apr 17 '20 20:04 stevemcmillan

I think we can add something to the baseclass __init__ that tests keywords arguments against parameter names and sets them if it is a parameter..let me think about this though...

ipelupessy avatar Apr 21 '20 20:04 ipelupessy

Not a huge priority. I can manage it using parameters, and that may actually be the right way to do it, since the number of GPUs doesn’t have to be known in order to instantiate the worker.

Stephen L. W. McMillan Department Head and Professor of Physics, Drexel University +1 215-895-2709/2723, FAX +1 215-895-2940, [email protected]

On Apr 21, 2020, at 4:20 PM, Inti Pelupessy [email protected] wrote:

I think we can add something to the baseclass init that tests keywords arguments against parameter names and sets them if it a parameter..let me think about this though...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/amusecode/amuse/issues/618#issuecomment-617393044, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPFB3XHHFJB5ISQP432XCTRNX5YZANCNFSM4MLAWDVA.

stevemcmillan avatar Apr 21 '20 20:04 stevemcmillan

ok..I leave it for now...I may implement this later since there are more use cases where you would want something like this..

ipelupessy avatar Apr 22 '20 08:04 ipelupessy