Skip to content

Commit

Permalink
Prevent hangs in CI during parallel run compilation (#2844)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwyattii authored Jun 26, 2023
1 parent 1b88839 commit 2b2be85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/nv-torch-latest-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
unit-tests:
runs-on: ubuntu-20.04
runs-on: [self-hosted, cpu]

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def validate_version(expected, found):
return found == expected


# This fixture prevents hangs when 2+ pytest processes try to compile the same
# code at once and causes deadlocks / hangs
@pytest.fixture(scope="session", autouse=True)
def set_torch_ext_dir(worker_id):
torch_ext_dir = os.environ["TORCH_EXTENSIONS_DIR"]
os.environ["TORCH_EXTENSIONS_DIR"] = os.path.join(torch_ext_dir, worker_id)


@pytest.fixture(scope="session", autouse=True)
def check_environment(pytestconfig):
expected_torch_version = pytestconfig.getoption("torch_ver")
Expand Down

0 comments on commit 2b2be85

Please sign in to comment.