CUDA + Fork = ?

Suppose you have a Linux process with a CUDA context it is presently using. Then you fork() that process. What happens?

Thanks,
Andreas

The context is not going to transparently move or be copied, if that’s what you’re after.

I’m after any kind of defined behavior, really. :)

Possible answers:

    [*] The context sticks with the parent, all access to the context in the child is invalid.

    [*] Both processes get to poke around in the same context.

    [*] Your program will crash and burn, because libcuda maintains too much state for its own good.

I’d rather not find out by trial-and-error, that’s all.

This is how it worked back in the CUDA 0.8 days, at least according to some people who played around with trial and error. I have no idea if the behavior has changed.

Uh-oh, now I need to play with it. I was assuming the parent was fine but the child would not have a context.

I didn’t mean to make more work for you, Tim :)

Here is the forum thread I was thinking of. I guess I slightly overexaggerated its age, it was posted only 11 months ago.

http://forums.nvidia.com/index.php?showtop…318&hl=fork