Multihreaded library inside ray actor

When I use numpy inside a ray actor, I notice that the numpy becomes single-core.

Is this expected behavior? When I use my numpy distribution in just Python I observe multi-core.

Is there a minimum script that can reproduce the behavior?

I discovered I can solve this problem by explicitly setting mkl.set_num_threads right before calling the numpy routine. I think there are some problems with default OS environ values inside ray actors

Hi @marsupialtail,

I think that is intentional.

https://github.com/ray-project/ray/blob/b3b1498eba171fe0e224dd3096c4c98156e2cbcf/python/ray/__init__.py#L52

1 Like