2

I am trying to implement multiprocessing in Datalore however I can't understand why I get error while I am trying the standard example from the official documentation . Here is the example snippet:

from multiprocessing import Pool

def f(x):
    return x*x

if __name__ == '__main__':
    p = Pool(5)
    print(p.map(f, [1, 2, 3]))

And the error what I am getting is as follows:

PicklingError: Can't pickle <function f at 0x7fe4f81ef048>: attribute lookup f on __main__ failed

I don't know what is wrong because I do not use Pickle. Thanks in advance.

shabunc
  • 20,530
  • 16
  • 73
  • 96

0 Answers0