Skip to content

Commit

Permalink
test (#1600)
Browse files Browse the repository at this point in the history
* test

* test
  • Loading branch information
atalman authored Nov 16, 2023
1 parent c8dc85d commit 9400ddb
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 15 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/validate-aarch64-linux-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string
workflow_dispatch:
inputs:
channel:
Expand All @@ -38,6 +43,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string

jobs:
generate-aarch64-linux-matrix:
Expand All @@ -46,8 +56,10 @@ jobs:
package-type: wheel
os: linux-aarch64
channel: ${{ inputs.channel }}
with-cuda: disable

generate-release-matrix:
uses: pytorch/test-infra/.github/workflows/generate_release_matrix.yml@main
with:
version: ${{ inputs.version }}
linux-aarch64:
needs: generate-aarch64-linux-matrix
strategy:
Expand All @@ -72,6 +84,8 @@ jobs:
export ENV_NAME="conda-env-${{ github.run_id }}"
export TARGET_OS="linux-aarch64"
export TORCH_ONLY=${{ inputs.torchonly }}
export RELEASE_VERSION=${{ inputs.version }}
printf '%s\n' ${{ toJson(needs.generate-release-matrix.outputs.matrix) }} > release_matrix.json
eval "$(conda shell.bash hook)"
# Standart case: Validate binaries
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/validate-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string


jobs:
win:
Expand All @@ -69,6 +75,7 @@ jobs:
channel: ${{ inputs.channel }}
ref: ${{ inputs.ref || github.ref }}
torchonly: ${{ inputs.torchonly }}
version: ${{ inputs.version }}

linux:
if: inputs.os == 'linux' || inputs.os == 'all'
Expand All @@ -77,6 +84,7 @@ jobs:
channel: ${{ inputs.channel }}
ref: ${{ inputs.ref || github.ref }}
torchonly: ${{ inputs.torchonly }}
version: ${{ inputs.version }}

linux-aarch64:
if: inputs.os == 'linux-aarch64'
Expand All @@ -85,6 +93,7 @@ jobs:
channel: ${{ inputs.channel }}
ref: ${{ inputs.ref || github.ref }}
torchonly: ${{ inputs.torchonly }}
version: ${{ inputs.version }}

mac:
if: inputs.os == 'macos' || inputs.os == 'all'
Expand All @@ -93,6 +102,7 @@ jobs:
channel: ${{ inputs.channel }}
ref: ${{ inputs.ref || github.ref }}
torchonly: ${{ inputs.torchonly }}
version: ${{ inputs.version }}

mac-arm64:
if: inputs.os == 'macos' || inputs.os == 'all'
Expand All @@ -101,3 +111,4 @@ jobs:
channel: ${{ inputs.channel }}
ref: ${{ inputs.ref || github.ref }}
torchonly: ${{ inputs.torchonly }}
version: ${{ inputs.version }}
15 changes: 13 additions & 2 deletions .github/workflows/validate-linux-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string
workflow_dispatch:
inputs:
channel:
Expand All @@ -38,6 +43,12 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string


jobs:
generate-linux-matrix:
Expand All @@ -47,10 +58,9 @@ jobs:
os: linux
channel: ${{ inputs.channel }}
generate-release-matrix:
needs: generate-linux-matrix
uses: pytorch/test-infra/.github/workflows/generate_release_matrix.yml@main
with:
version: "2.1.1"
version: ${{ inputs.version }}

linux:
needs: [generate-linux-matrix, generate-release-matrix]
Expand All @@ -69,6 +79,7 @@ jobs:
set -ex
export ENV_NAME="conda-env-${{ github.run_id }}"
export TORCH_ONLY=${{ inputs.torchonly }}
export RELEASE_VERSION=${{ inputs.version }}
export TARGET_OS="linux"
eval "$(conda shell.bash hook)"
printf '%s\n' ${{ toJson(needs.generate-release-matrix.outputs.matrix) }} > release_matrix.json
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/validate-macos-arm64-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string
workflow_dispatch:
inputs:
channel:
Expand All @@ -38,6 +43,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string

jobs:
generate-macos-arm64-matrix:
Expand All @@ -46,8 +56,12 @@ jobs:
package-type: all
os: macos-arm64
channel: ${{ inputs.channel }}
generate-release-matrix:
uses: pytorch/test-infra/.github/workflows/generate_release_matrix.yml@main
with:
version: ${{ inputs.version }}
macos-arm64:
needs: generate-macos-arm64-matrix
needs: [generate-macos-arm64-matrix, generate-release-matrix]
strategy:
matrix: ${{ fromJson(needs.generate-macos-arm64-matrix.outputs.matrix) }}
fail-fast: false
Expand All @@ -64,4 +78,6 @@ jobs:
export ENV_NAME="conda-env-${{ github.run_id }}"
export TARGET_OS="macos-arm64"
export TORCH_ONLY=${{ inputs.torchonly }}
export RELEASE_VERSION=${{ inputs.version }}
printf '%s\n' ${{ toJson(needs.generate-release-matrix.outputs.matrix) }} > release_matrix.json
source ./.github/scripts/validate_binaries.sh
18 changes: 17 additions & 1 deletion .github/workflows/validate-macos-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string
workflow_dispatch:
inputs:
channel:
Expand All @@ -38,6 +43,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string

jobs:
generate-macos-matrix:
Expand All @@ -46,8 +56,12 @@ jobs:
package-type: all
os: macos
channel: ${{ inputs.channel }}
generate-release-matrix:
uses: pytorch/test-infra/.github/workflows/generate_release_matrix.yml@main
with:
version: ${{ inputs.version }}
macos:
needs: generate-macos-matrix
needs: [generate-macos-matrix, generate-release-matrix]
strategy:
matrix: ${{ fromJson(needs.generate-macos-matrix.outputs.matrix) }}
fail-fast: false
Expand All @@ -64,4 +78,6 @@ jobs:
export ENV_NAME="conda-env-${{ github.run_id }}"
export TARGET_OS="macos"
export TORCH_ONLY=${{ inputs.torchonly }}
export RELEASE_VERSION=${{ inputs.version }}
printf '%s\n' ${{ toJson(needs.generate-release-matrix.outputs.matrix) }} > release_matrix.json
source ./.github/scripts/validate_binaries.sh
20 changes: 17 additions & 3 deletions .github/workflows/validate-windows-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string
workflow_dispatch:
inputs:
channel:
Expand All @@ -38,6 +43,11 @@ on:
default: false
required: false
type: boolean
version:
description: 'Version to validate - optional'
default: ""
required: false
type: string

jobs:
generate-windows-matrix:
Expand All @@ -46,9 +56,12 @@ jobs:
package-type: all
os: windows
channel: ${{ inputs.channel }}

generate-release-matrix:
uses: pytorch/test-infra/.github/workflows/generate_release_matrix.yml@main
with:
version: ${{ inputs.version }}
win:
needs: generate-windows-matrix
needs: [generate-windows-matrix, generate-release-matrix]
strategy:
matrix: ${{ fromJson(needs.generate-windows-matrix.outputs.matrix) }}
fail-fast: false
Expand All @@ -66,9 +79,10 @@ jobs:
export ENV_NAME="conda-env-${{ github.run_id }}"
export TARGET_OS="windows"
export TORCH_ONLY=${{ inputs.torchonly }}
export RELEASE_VERSION=${{ inputs.version }}
printf '%s\n' ${{ toJson(needs.generate-release-matrix.outputs.matrix) }} > release_matrix.json
source /c/Jenkins/Miniconda3/etc/profile.d/conda.sh
if [[ ${MATRIX_GPU_ARCH_VERSION} == "12.1" ]]; then
./windows/internal/driver_update.bat
fi
source ./.github/scripts/validate_binaries.sh
19 changes: 13 additions & 6 deletions test/smoke_test/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
gpu_arch_type = os.getenv("MATRIX_GPU_ARCH_TYPE")
channel = os.getenv("MATRIX_CHANNEL")
stable_version = os.getenv("MATRIX_STABLE_VERSION")
release_version = os.getenv("RELEASE_VERSION")
package_type = os.getenv("MATRIX_PACKAGE_TYPE")
target_os = os.getenv("TARGET_OS")
BASE_DIR = Path(__file__).parent.parent.parent
release_matrix = None

is_cuda_system = gpu_arch_type == "cuda"
NIGHTLY_ALLOWED_DELTA = 3
Expand All @@ -39,7 +41,6 @@
},
]


class Net(nn.Module):
def __init__(self):
super().__init__()
Expand Down Expand Up @@ -76,17 +77,17 @@ def check_version(package: str) -> None:
raise RuntimeError(
f"Torch version mismatch, expected {stable_version} for channel {channel}. But its {torch.__version__}"
)
release_version = read_release_matrix()
if package == "all":

if release_version and package == "all":
for module in MODULES:
imported_module = importlib.import_module(module["name"])
module_version = imported_module.__version__
if not module_version.startswith(release_version[module["name"]]):
if not module_version.startswith(release_matrix[module["name"]]):
raise RuntimeError(
f"{module['name']} version mismatch, expected {release_version[module['name']]} for channel {channel}. But its {module_version}"
f"{module['name']} version mismatch, expected {release_matrix[module['name']]} for channel {channel}. But its {module_version}"
)
else:
print(f"{module['name']} version actual: {module_version} expected: {release_version[module['name']]} for channel {channel}.")
print(f"{module['name']} version actual: {module_version} expected: {release_matrix[module['name']]} for channel {channel}.")

else:
print(f"Skip version check for channel {channel} as stable version is None")
Expand Down Expand Up @@ -281,6 +282,12 @@ def main() -> None:
)
options = parser.parse_args()
print(f"torch: {torch.__version__}")

# if release_version is specified, override stable_version coming binary matrix
if(release_version):
release_matrix = read_release_matrix()
stable_version = release_matrix["torch"]

check_version(options.package)
smoke_test_conv2d()
smoke_test_linalg()
Expand Down

0 comments on commit 9400ddb

Please sign in to comment.