Skip to content

Commit

Permalink
Support MacOS in A2C homework multiprocessing (#520)
Browse files Browse the repository at this point in the history
Multiprocessing in Python works differently on Windows and on Linux.
On Windows it copies the objects and in Linux it doesn't.
As a result, some code that works fine on Linux may not work on Windows.
E.g. in our A2C homework we use lambda functions.
Lambda functions are not serializable, so object copying during multiprocessing would fail on Windows.
As for MacOS, it can behave like Linux or like Windows depending on settings.

In this commit I added an instruction that will make the multiprocessing behave like Linux
  • Loading branch information
q0o0p authored Feb 22, 2023
1 parent 3f56b7b commit 9e0017f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions week06_policy_based/atari_wrappers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
""" Environment wrappers. """
from collections import defaultdict, deque

import multiprocessing
multiprocessing.set_start_method("fork")

import cv2
import gym
import gym.spaces as spaces
Expand Down

0 comments on commit 9e0017f

Please sign in to comment.