Skip to content

Commit

Permalink
Modify codecov concurrency mode from threading to multiprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
SolenoidWGT committed Jan 17, 2023
1 parent a334a0c commit 860e901
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[run]
concurrency = multiprocessing,thread
omit =
ding/utils/slurm_helper.py
ding/utils/file_helper.py
Expand Down
5 changes: 2 additions & 3 deletions ding/framework/middleware/barrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ def __init__(self, attch_from_nums: int, timeout: int = 60):
list is empty, it cannot perceive how many processes will establish connections with it,
resulting in any form of synchronization cannot be performed.
3. Barrier() is thread-safe, but it is not recommended to use barrier in multithreading.
You need to carefully calculate the number of times each thread calls Barrier() to
avoid deadlock.
3. Barrier() is thread-safe, but it is not recommended to use barrier in multithreading. You need
to carefully calculate the number of times each thread calls Barrier() to avoid deadlock.
4. In normal training tasks, please do not use Barrier(), which will force the step synchronization
between each process, so it will greatly damage the training efficiency. In addition, if your
Expand Down
6 changes: 6 additions & 0 deletions ding/framework/middleware/tests/test_barrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,23 @@ def test_star_topology_barrier():
ctx = mp.get_context("spawn")
with ctx.Pool(processes=4) as pool:
pool.map(launch_barrier, [[i, 'star', star_barrier, 0] for i in range(4)])
pool.close()
pool.join()


@pytest.mark.unittest
def test_mesh_topology_barrier():
ctx = mp.get_context("spawn")
with ctx.Pool(processes=4) as pool:
pool.map(launch_barrier, [[i, 'mesh', mesh_barrier, 1] for i in range(4)])
pool.close()
pool.join()


@pytest.mark.unittest
def test_unmatch_barrier():
ctx = mp.get_context("spawn")
with ctx.Pool(processes=4) as pool:
pool.map(launch_barrier, [[i, 'mesh', unmatch_barrier, 2] for i in range(4)])
pool.close()
pool.join()

0 comments on commit 860e901

Please sign in to comment.