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

Add poetry and pypi tests #1428

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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