# Hidden numpy array

**URL:** <https://discuss.ray.io/t/hidden-numpy-array/6821>\
**Category:** Ray Core\
**Created:** [July 14, 2022, 12:26am UTC](https://discuss.ray.io/t/hidden-numpy-array/6821 "2022-07-14T00:26:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vsraptor](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/vsraptor/32/2841_2.png) [@vsraptor](https://discuss.ray.io/u/vsraptor)\
**Post date:** [July 14, 2022, 12:26am UTC](https://discuss.ray.io/t/hidden-numpy-array/6821/1 "2022-07-14T00:26:37Z")

</div>

i have Class that uses numpy array…

```auto

          class NPClass:

             def __init__ (....):
               self.ary = np.zeros(...)

             def search(self,i):
                for j in self.ary :
                   if i % j == 0 : return j

```

then I have a metod that use that class

```auto

          class Foo:

            def boo(self,...):
              a = NPClass(...)
              rv = []

              for i in range(100000):
                ...
                res = a.search(i)
                rv.append(res)

              return rv

```

i know for normal numpy array i can use np.put() to share between ray tasks… but

How can I parellize this loop ? Where the array is under control by the external class (NPClass) ?

In this specific case all the tasks are just reading

---

<div class="post-metadata">

**Author:** ![jjyao](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jjyao/32/1799_2.png) [@jjyao](https://discuss.ray.io/u/jjyao)\
**Post date:** [August 15, 2022, 5:56pm UTC](https://discuss.ray.io/t/hidden-numpy-array/6821/2 "2022-08-15T17:56:00Z")

</div>

If the NPClass object is pickle-able, then you can also share it between ray tasks.
