|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +from pathlib import Path |
| 4 | + |
| 5 | +import jinja2 |
| 6 | + |
| 7 | +DOCKER_REGISTRY = "308535385114.dkr.ecr.us-east-1.amazonaws.com" |
| 8 | + |
| 9 | +GITHUB_DIR = Path(__file__).parent.parent |
| 10 | + |
| 11 | +CPU_TEST_RUNNER = "linux.2xlarge" |
| 12 | +CUDA_TEST_RUNNER = "linux.8xlarge.nvidia.gpu" |
| 13 | + |
| 14 | + |
| 15 | +class PyTorchLinuxWorkflow: |
| 16 | + def __init__(self, build_environment: str, docker_image_base: str): |
| 17 | + self.build_environment = build_environment |
| 18 | + self.docker_image_base = docker_image_base |
| 19 | + self.test_runner_type = CPU_TEST_RUNNER |
| 20 | + if "cuda" in build_environment: |
| 21 | + self.test_runner_type = CUDA_TEST_RUNNER |
| 22 | + |
| 23 | + def generate_workflow_file( |
| 24 | + self, workflow_template: jinja2.Template, jinja_env: jinja2.Environment |
| 25 | + ) -> Path: |
| 26 | + output_file_path = GITHUB_DIR.joinpath( |
| 27 | + f"workflows/{self.build_environment}.yml" |
| 28 | + ) |
| 29 | + with open(output_file_path, "w") as output_file: |
| 30 | + output_file.write( |
| 31 | + workflow_template.render( |
| 32 | + build_environment=self.build_environment, |
| 33 | + docker_image_base=self.docker_image_base, |
| 34 | + test_runner_type=self.test_runner_type |
| 35 | + ) |
| 36 | + ) |
| 37 | + output_file.write('\n') |
| 38 | + return output_file_path |
| 39 | + |
| 40 | + |
| 41 | +WORKFLOWS = [ |
| 42 | + PyTorchLinuxWorkflow( |
| 43 | + build_environment="pytorch-linux-xenial-py3.6-gcc5.4", |
| 44 | + docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3.6-gcc5.4", |
| 45 | + ), |
| 46 | + # PyTorchLinuxWorkflow( |
| 47 | + # build_environment="pytorch-paralleltbb-linux-xenial-py3.6-gcc5.4", |
| 48 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3.6-gcc5.4", |
| 49 | + # ), |
| 50 | + # PyTorchLinuxWorkflow( |
| 51 | + # build_environment="pytorch-parallelnative-linux-xenial-py3.6-gcc5.4", |
| 52 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3.6-gcc5.4", |
| 53 | + # ), |
| 54 | + # PyTorchLinuxWorkflow( |
| 55 | + # build_environment="pytorch-pure_torch-linux-xenial-py3.6-gcc5.4", |
| 56 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3.6-gcc5.4", |
| 57 | + # ), |
| 58 | + # PyTorchLinuxWorkflow( |
| 59 | + # build_environment="pytorch-linux-xenial-py3.6-gcc7", |
| 60 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3.6-gcc7", |
| 61 | + # ), |
| 62 | + # PyTorchLinuxWorkflow( |
| 63 | + # build_environment="pytorch-linux-xenial-py3-clang5-asan", |
| 64 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-asan", |
| 65 | + # ), |
| 66 | + # PyTorchLinuxWorkflow( |
| 67 | + # build_environment="pytorch-linux-xenial-py3-clang7-onnx", |
| 68 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang7-onnx", |
| 69 | + # ), |
| 70 | + # PyTorchLinuxWorkflow( |
| 71 | + # build_environment="pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7", |
| 72 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7", |
| 73 | + # ), |
| 74 | + # PyTorchLinuxWorkflow( |
| 75 | + # build_environment="pytorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7", |
| 76 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7", |
| 77 | + # ), |
| 78 | + # PyTorchLinuxWorkflow( |
| 79 | + # build_environment="pytorch-libtorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7", |
| 80 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-cuda11.1-cudnn8-py3-gcc7", |
| 81 | + # ), |
| 82 | + # PyTorchLinuxWorkflow( |
| 83 | + # build_environment="pytorch-linux-bionic-py3.6-clang9-noarch", |
| 84 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-py3.6-clang9", |
| 85 | + # ), |
| 86 | + # PyTorchLinuxWorkflow( |
| 87 | + # build_environment="pytorch-xla-linux-bionic-py3.6-clang9", |
| 88 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-py3.6-clang9", |
| 89 | + # ), |
| 90 | + # PyTorchLinuxWorkflow( |
| 91 | + # build_environment="pytorch-vulkan-linux-bionic-py3.6-clang9", |
| 92 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-py3.6-clang9", |
| 93 | + # ), |
| 94 | + # PyTorchLinuxWorkflow( |
| 95 | + # build_environment="pytorch-linux-bionic-py3.8-gcc9-coverage", |
| 96 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-py3.8-gcc9", |
| 97 | + # ), |
| 98 | + # PyTorchLinuxWorkflow( |
| 99 | + # build_environment="pytorch-linux-bionic-rocm3.9-py3.6", |
| 100 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-rocm3.9-py3.6", |
| 101 | + # ), |
| 102 | + # PyTorchLinuxWorkflow( |
| 103 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-x86_32", |
| 104 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 105 | + # ), |
| 106 | + # PyTorchLinuxWorkflow( |
| 107 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-x86_64", |
| 108 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 109 | + # ), |
| 110 | + # PyTorchLinuxWorkflow( |
| 111 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-arm-v7a", |
| 112 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 113 | + # ), |
| 114 | + # PyTorchLinuxWorkflow( |
| 115 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-arm-v8a", |
| 116 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 117 | + # ), |
| 118 | + # PyTorchLinuxWorkflow( |
| 119 | + # build_environment="pytorch-linux-xenial-py3-clang5-mobile", |
| 120 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-asan", |
| 121 | + # ), |
| 122 | + # PyTorchLinuxWorkflow( |
| 123 | + # build_environment="pytorch-linux-xenial-py3-clang5-mobile-custom-dynamic", |
| 124 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 125 | + # ), |
| 126 | + # PyTorchLinuxWorkflow( |
| 127 | + # build_environment="pytorch-linux-xenial-py3-clang5-mobile-custom-static", |
| 128 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 129 | + # ), |
| 130 | + # PyTorchLinuxWorkflow( |
| 131 | + # build_environment="pytorch-linux-xenial-py3-clang5-mobile-code-analysis", |
| 132 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 133 | + # ), |
| 134 | + # PyTorchLinuxWorkflow( |
| 135 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-x86_32", |
| 136 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 137 | + # ), |
| 138 | + # PyTorchLinuxWorkflow( |
| 139 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-x86_64", |
| 140 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 141 | + # ), |
| 142 | + # PyTorchLinuxWorkflow( |
| 143 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-arm-v7a", |
| 144 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 145 | + # ), |
| 146 | + # PyTorchLinuxWorkflow( |
| 147 | + # build_environment="pytorch-linux-xenial-py3-clang5-android-ndk-r19c-arm-v8a", |
| 148 | + # docker_image_base=f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c", |
| 149 | + # ), |
| 150 | +] |
| 151 | + |
| 152 | +if __name__ == "__main__": |
| 153 | + jinja_env = jinja2.Environment( |
| 154 | + variable_start_string="!{{", |
| 155 | + loader=jinja2.FileSystemLoader(str(GITHUB_DIR.joinpath("templates"))), |
| 156 | + ) |
| 157 | + workflow_template = jinja_env.get_template("linux_ci_workflow.yml.in") |
| 158 | + for workflow in WORKFLOWS: |
| 159 | + print( |
| 160 | + workflow.generate_workflow_file( |
| 161 | + workflow_template=workflow_template, |
| 162 | + jinja_env=jinja_env |
| 163 | + ) |
| 164 | + ) |
0 commit comments