Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent hangs in CI during parallel run compilation #2844

Merged
merged 10 commits into from
Jun 26, 2023
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