How to forkserver for Pytorch multiprocess on Windows?

Viewed 40

I am in the process of converting code that was written for a Linux machine into code runnable on Windows. The code uses the Pytorch library and the following line called at the very beginning of the script is causing an error:

    tr.multiprocessing.set_start_method('forkserver', force=True)

When I change it to tr.multiprocessing.set_start_method('spawn', force=True) it works. I read this is because Windows does not have the ability to fork a process. My understanding is that spawn will create a new process without copying any of the data from the parent process. This leaves me with the following two questions:

  • What exactly does tr.multiprocessing.set_start_method() do? I understand it controls how new processes are started, but when are these new processes started?
  • How will spawning instead of forking affect my code? I get this is a broad question, but maybe understanding the first question will help me understand the consequences of spawning.
0 Answers
Related