Skip to content

Importing a module available on the workers only #8121

Answered by magv
magv asked this question in Q&A
Discussion options

You must be logged in to vote

I think I've figured out what's going on in the example. Dask first pickles the code of the function using cloudpickle, and by default it inserts modules by reference rather than by value -- so at this point no extra modules are imported on the main node, the code is successfully transferred and executed on the workers. Then because I missed pycuda.init(), an exception is raised on the workers; this exception is pickled and moved back to the main node. Because the exception is pycuda.Something, unpickling it requires importing the parent module pycuda -- and this is where it fails.

The solution is to make sure that neither values nor exceptions belonging to pycuda are ever transferred bac…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jsignell
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by magv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants