Sharing optimizer between processes
I am wondering if it is possible to share optimizer between different threads. To be specific, when optimizer.step() is applied, modified state of the optimizer should be available for all processes.
delgado
i cant think of a way to do this, because the optimizer also has python scalars. What are you trying to do?
smth
delgado
No, I think most of the optimizer state is kept in Tensors, so it should be possible to share it. I’m not 100% now, I’ll need to take a look at RMSprop and can confirm it tomorrow.
apaszke
Thanks. I will also look at the code and see if I can find some hack.
delgado
ypxie
It’s not. You need to guard it with a mutex yourself
apaszke
Just a quick follow-up for those wanting to implement A3C. A3C uses a Hogwild! update style, which means updates are made lock-free. Workers possibly overwrite each other updates at times, but that’s OK. But other than that, it is doable, and not too hard.
mimoralea