예제 #1
0
    def gen_yaml_tree(self, build_or_test):

        build_job_name_pieces = self.get_build_job_name_pieces(build_or_test)

        build_env_name = "-".join(map(str, build_job_name_pieces))

        env_dict = OrderedDict([
            ("BUILD_ENVIRONMENT", build_env_name),
            ("DOCKER_IMAGE", self.gen_docker_image_path()),
        ])

        if self.pyver:
            env_dict["PYTHON_VERSION"] = miniutils.quote(self.pyver)

        if build_or_test == "test" and self.cuda_version:
            env_dict["USE_CUDA_DOCKER_RUNTIME"] = miniutils.quote("1")

        d = {
            "environment": env_dict,
            "<<":
            "*" + "_".join(["pytorch", "linux", build_or_test, "defaults"]),
        }

        if build_or_test == "test":
            resource_class = "large"
            if self.gpu_resource:
                resource_class = "gpu." + self.gpu_resource

                if self.gpu_resource == "large":
                    env_dict["MULTI_GPU"] = miniutils.quote("1")

            d["resource_class"] = resource_class

        return d
예제 #2
0
    def gen_docker_image_path(self):

        parms_source = self.parent_build or self
        base_build_env_name = "-".join(parms_source.get_parms(True))

        return miniutils.quote(DOCKER_IMAGE_PATH_BASE + base_build_env_name +
                               ":" + str(DOCKER_IMAGE_VERSION))
예제 #3
0
    def gen_yaml_tree(self, build_or_test):

        env_dict = OrderedDict({
            "BUILD_ENVIRONMENT":
            miniutils.quote(" ".join(self.gen_build_env_parms())),
        })

        if self.libtorch_variant:
            env_dict["LIBTORCH_VARIANT"] = miniutils.quote(
                self.libtorch_variant)

        os_word_substitution = {
            "macos": "mac",
        }

        os_name = miniutils.override(self.os, os_word_substitution)

        d = {
            "environment": env_dict,
            "<<":
            "*" + "_".join([self.get_name_prefix(), os_name, build_or_test]),
        }

        if build_or_test == "test":
            tuples = []

            if not (self.smoke and self.os == "macos"):
                tuples.append(("DOCKER_IMAGE", self.gen_docker_image()))

            if self.cuda_version:
                tuples.append(
                    ("USE_CUDA_DOCKER_RUNTIME", miniutils.quote("1")))

            for (k, v) in tuples:
                env_dict[k] = v

        else:
            if self.os == "linux" and build_or_test != "upload":
                d["docker"] = [{"image": self.gen_docker_image()}]

        if build_or_test == "test":
            if self.cuda_version:
                d["resource_class"] = "gpu.medium"

        return d
예제 #4
0
    def gen_docker_image(self):

        lang_substitutions = {
            "onnx_py2": "py2",
            "cmake": "py2",
        }

        lang = miniutils.override(self.language, lang_substitutions)
        parts = [lang] + self.get_build_name_middle_parts()
        return miniutils.quote(DOCKER_IMAGE_PATH_BASE + "-".join(parts) + ":" +
                               str(DOCKER_IMAGE_VERSION))
예제 #5
0
def gen_schedule_tree(cron_timing):
    return [{
        "schedule": {
            "cron": miniutils.quote(cron_timing),
            "filters": {
                "branches": {
                    "only": ["master"],
                },
            },
        },
    }]
예제 #6
0
    def gen_yaml_tree(self):

        tuples = []

        lang_substitutions = {
            "onnx_py2": "onnx-py2",
        }

        lang = miniutils.override(self.language, lang_substitutions)

        parts = [
            "caffe2",
            lang,
        ] + self.get_build_name_middle_parts() + [self.phase]

        build_env = "-".join(parts)
        if not self.distro.name == "macos":
            build_env = miniutils.quote(build_env)

        tuples.append(("BUILD_ENVIRONMENT", build_env))

        if self.compiler.name == "ios":
            tuples.append(("BUILD_IOS", miniutils.quote("1")))

        if self.phase == "test":
            use_cuda_docker = self.compiler.name == "cuda"
            if use_cuda_docker:
                tuples.append(
                    ("USE_CUDA_DOCKER_RUNTIME", miniutils.quote("1")))

        if not self.distro.name == "macos":
            tuples.append(("DOCKER_IMAGE", self.gen_docker_image()))

        if self.is_build_only():
            if not self.distro.name == "macos":
                tuples.append(("BUILD_ONLY", miniutils.quote("1")))

        # TODO: not sure we need the distinction between system and homebrew anymore. Our python handling in cmake
        #  and setuptools is more robust now than when we first had these.
        if self.distro.name == "macos":
            tuples.append(("PYTHON_INSTALLATION", miniutils.quote("system")))
            tuples.append(("PYTHON_VERSION", miniutils.quote("2")))

        env_dict = OrderedDict(tuples)

        d = OrderedDict([
            ("environment", env_dict),
        ])

        if self.phase == "test":
            is_large = self.compiler.name != "cuda"

            resource_class = "large" if is_large else "gpu.medium"
            d["resource_class"] = resource_class

        d["<<"] = "*" + "_".join(
            ["caffe2", self.get_platform(), self.phase, "defaults"])

        return d
예제 #7
0
    def gen_docker_image(self):

        docker_word_substitution = {
            "manywheel": "manylinux",
            "libtorch": "manylinux",
        }

        docker_distro_prefix = miniutils.override(self.pydistro,
                                                  docker_word_substitution)

        alt_docker_suffix = self.cuda_version or "80"
        docker_distro_suffix = "" if self.pydistro == "conda" else alt_docker_suffix
        return miniutils.quote("soumith/" + docker_distro_prefix + "-cuda" +
                               docker_distro_suffix)