Skip to content

Commit

Permalink
[Test][Transformer] Pre-parse container version (NVIDIA#1673)
Browse files Browse the repository at this point in the history
* pre-parse container version

* check torch version first
  • Loading branch information
Aidyn-A authored Jun 2, 2023
1 parent ecb5614 commit 05091d4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/L0/run_transformer/test_pipeline_parallel_fwd_bwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import itertools
import os
from datetime import datetime
from packaging.version import parse, Version
import re
from typing import Optional, Tuple, List
Expand Down Expand Up @@ -40,11 +41,19 @@
weight_coeff = 1024

# Guard for https://github.com/pytorch/pytorch/pull/82450
def get_nvidia_pytorch_version():
ver = os.getenv("NVIDIA_PYTORCH_VERSION", "22.08")
if "master" in ver:
ver = datetime.today().strftime("%y.%m")
elif "update_for_" in ver:
ver = ver.replace("update_for_", "")
return ver

CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = False
ngc_container_2209, pytorch_113 = Version("22.09"), Version("1.13")
if parse(os.getenv("NVIDIA_PYTORCH_VERSION", "22.08")) >= ngc_container_2209:
if parse(torch.__version__) >= pytorch_113:
CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = True
elif parse(torch.__version__) >= pytorch_113:
elif parse(get_nvidia_pytorch_version()) >= ngc_container_2209:
CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = True
else:
CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = False
Expand Down

0 comments on commit 05091d4

Please sign in to comment.