Skip to content

Commit

Permalink
smoke test poetry (#1428)
Browse files Browse the repository at this point in the history
Add a little more tests

test

Test poetry

test

Test poetry on python 3.10

Add more poetry tests

Test en us

test

test

Try verboose

testing

testing

try quiet install

Code refactooring

test

move linux pipy validation to workflow

test

test

Fix path

try test pipy

More torch installations

test

testing

test

test

test new

fix install 2

try poetry nightly

test nightly

test

test

Test poetry validation

test

test_new

test

Put back executing this on pull

Print matrix variable

test

Fix conditional for pypi poetry tests

add quptes

Add nightly as supplemental requirement

Make sure we clone module only for first time

Fix python

test validate binaries

Add repo existance checks

test

Disable runtime error before final validation

fix typo

fix cwd
  • Loading branch information
atalman committed Jun 14, 2023
1 parent c26e36c commit 7ce69b2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/validate_poetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ if [[ ${MATRIX_CHANNEL} != "release" ]]; then
# Installing poetry from our custom repo. We need to configure it before use and disable authentication
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
poetry source add --priority=explicit domains "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}"
poetry source add --priority=explicit pytorch "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}_pypi_cudnn"
poetry source add --priority=supplemental pytorch-nightly "https://download.pytorch.org/whl/${MATRIX_CHANNEL}"
poetry source add --priority=supplemental pytorch "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}_pypi_cudnn"
poetry --quiet add --source pytorch torch
poetry --quiet add --source domains torchvision torchaudio
else
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/validate-linux-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ jobs:
# Special case PyPi installation package. And Install of PyPi package via poetry
if [[ ${MATRIX_PACKAGE_TYPE} == "manywheel" ]] && \
{[${MATRIX_GPU_ARCH_VERSION} == "12.1" && ${MATRIX_CHANNEL} != "release"] || \
[${MATRIX_GPU_ARCH_VERSION} == "11.7" && ${MATRIX_CHANNEL} == "release"]}; then
source ./.github/scripts/validate_pipy.sh
source ./.github/scripts/validate_poetry.sh
([[ ${MATRIX_GPU_ARCH_VERSION} == "12.1" && ${MATRIX_CHANNEL} != "release" ]] || \
[[ ${MATRIX_GPU_ARCH_VERSION} == "11.7" && ${MATRIX_CHANNEL} == "release" ]]); then
source ./.github/scripts/validate_pipy.sh --runtime-error-check disabled
source ./.github/scripts/validate_poetry.sh --runtime-error-check disabled
fi
# Standart case: Validate binaries
source ./.github/scripts/validate_binaries.sh
22 changes: 17 additions & 5 deletions test/smoke_test/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package_type = os.getenv("MATRIX_PACKAGE_TYPE")

is_cuda_system = gpu_arch_type == "cuda"
SCRIPT_DIR = Path(__file__).parent
NIGHTLY_ALLOWED_DELTA = 3

MODULES = [
Expand All @@ -27,12 +26,14 @@
"repo": "https://github.com/pytorch/vision.git",
"smoke_test": "python ./vision/test/smoke_test.py",
"extension": "extension",
"repo_name": "vision",
},
{
"name": "torchaudio",
"repo": "https://github.com/pytorch/audio.git",
"smoke_test": "python ./audio/test/smoke_test/smoke_test.py --no-ffmpeg",
"extension": "_extension",
"repo_name": "audio",
},
]

Expand Down Expand Up @@ -100,7 +101,7 @@ def test_cuda_runtime_errors_captured() -> None:
if(cuda_exception_missed):
raise RuntimeError( f"Expected CUDA RuntimeError but have not received!")

def smoke_test_cuda(package: str) -> None:
def smoke_test_cuda(package: str, runtime_error_check: str) -> None:
if not torch.cuda.is_available() and is_cuda_system:
raise RuntimeError(f"Expected CUDA {gpu_arch_ver}. However CUDA is not loaded.")

Expand Down Expand Up @@ -130,7 +131,8 @@ def smoke_test_cuda(package: str) -> None:
if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0):
smoke_test_compile()

test_cuda_runtime_errors_captured()
if(runtime_error_check == "enabled"):
test_cuda_runtime_errors_captured()


def smoke_test_conv2d() -> None:
Expand Down Expand Up @@ -203,9 +205,12 @@ def foo(x: torch.Tensor) -> torch.Tensor:
x_pt2 = torch.compile(model, mode="max-autotune")(x)

def smoke_test_modules():
cwd = os.getcwd()
for module in MODULES:
if module["repo"]:
subprocess.check_output(f"git clone --depth 1 {module['repo']}", stderr=subprocess.STDOUT, shell=True)
if not os.path.exists(f"{cwd}/{module['repo_name']}"):
print(f"Path does not exist: {cwd}/{module['repo_name']}")
subprocess.check_output(f"git clone --depth 1 {module['repo']}", stderr=subprocess.STDOUT, shell=True)
try:
output = subprocess.check_output(
module["smoke_test"], stderr=subprocess.STDOUT, shell=True,
Expand All @@ -227,6 +232,13 @@ def main() -> None:
choices=["all", "torchonly"],
default="all",
)
parser.add_argument(
"--runtime-error-check",
help="No Runtime Error check",
type=str,
choices=["enabled", "disabled"],
default="enabled",
)
options = parser.parse_args()
print(f"torch: {torch.__version__}")
check_version(options.package)
Expand All @@ -236,7 +248,7 @@ def main() -> None:
if options.package == "all":
smoke_test_modules()

smoke_test_cuda(options.package)
smoke_test_cuda(options.package, options.runtime_error_check)


if __name__ == "__main__":
Expand Down

1 comment on commit 7ce69b2

@malfet
Copy link
Contributor

@malfet malfet commented on 7ce69b2 Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atalman please edit PR comments before merging (10x lines of test are not super helpful)

Please sign in to comment.