Bazel离线编译SPU

2024-04-26 19:52
文章标签 编译 离线 spu bazel

本文主要是介绍Bazel离线编译SPU,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

本文介绍如何离线编译隐语的spu库,前提是依赖都已经下载好。

主要使用

load("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")

以及http_archive中的url可以指定为本地地址。下面给出/spu/bazel/repositories.bzl示例。

# Copyright 2021 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")def spu_deps():_rules_cuda()_rules_proto_grpc()_bazel_platform()_com_github_xtensor_xtensor()_com_github_xtensor_xtl()_com_github_openxla_xla()_com_github_pybind11_bazel()_com_github_pybind11()_com_intel_hexl()_com_github_emptoolkit_emp_tool()_com_github_emptoolkit_emp_ot()_com_github_facebook_zstd()_com_github_microsoft_seal()_com_github_eigenteam_eigen()_com_github_nvidia_cutlass()_yacl()_libpsi()def _yacl():local_repository(name = "yacl",path = "/repository/yacl",)def _libpsi():maybe(http_archive,name = "psi",urls = ["file:///repository/psi-0.4.0.dev240401.tar.gz","https://github.com/secretflow/psi/archive/refs/tags/v0.4.0.dev240401.tar.gz",],strip_prefix = "psi-0.4.0.dev240401",sha256 = "bc91e5c635fc94f865004e61e3896eb334d76549c1125fbc98caf8c6b3a82463",)def _rules_proto_grpc():http_archive(name = "rules_proto_grpc",sha256 = "2a0860a336ae836b54671cbbe0710eec17c64ef70c4c5a88ccfd47ea6e3739bd",strip_prefix = "rules_proto_grpc-4.6.0",urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/releases/download/4.6.0/rules_proto_grpc-4.6.0.tar.gz",],)def _rules_cuda():http_archive(name = "rules_cuda",sha256 = "2f8c8c8c85f727bec4423efecec12d3b751cb0a98bda99f0f9d351608a23b858",strip_prefix = "rules_cuda-v0.2.1",urls = ["https://github.com/bazel-contrib/rules_cuda/releases/download/v0.2.1/rules_cuda-v0.2.1.tar.gz"],)def _bazel_platform():http_archive(name = "platforms",urls = ["file:///repository/platforms-0.0.9.tar.gz","https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz","https://github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz",],sha256 = "5eda539c841265031c2f82d8ae7a3a6490bd62176e0c038fc469eabf91f6149b",)def _com_github_facebook_zstd():maybe(http_archive,name = "com_github_facebook_zstd",build_file = "@spulib//bazel:zstd.BUILD",strip_prefix = "zstd-1.5.6",sha256 = "30f35f71c1203369dc979ecde0400ffea93c27391bfd2ac5a9715d2173d92ff7",type = ".tar.gz",urls = ["file:///repository/zstd-v1.5.6.tar.gz","https://github.com/facebook/zstd/archive/refs/tags/v1.5.6.tar.gz",],)def _com_github_xtensor_xtensor():maybe(http_archive,name = "com_github_xtensor_xtensor",sha256 = "32d5d9fd23998c57e746c375a544edf544b74f0a18ad6bc3c38cbba968d5e6c7",strip_prefix = "xtensor-0.25.0",build_file = "@spulib//bazel:xtensor.BUILD",type = "tar.gz",urls = ["https://github.com/xtensor-stack/xtensor/archive/refs/tags/0.25.0.tar.gz",],)def _com_github_xtensor_xtl():maybe(http_archive,name = "com_github_xtensor_xtl",sha256 = "44fb99fbf5e56af5c43619fc8c29aa58e5fad18f3ba6e7d9c55c111b62df1fbb",strip_prefix = "xtl-0.7.7",build_file = "@spulib//bazel:xtl.BUILD",type = "tar.gz",urls = ["https://github.com/xtensor-stack/xtl/archive/refs/tags/0.7.7.tar.gz",],)def _com_github_openxla_xla():OPENXLA_COMMIT = "c408b6320bbf8407b781487a2dbe329cb7488dac"OPENXLA_SHA256 = "77297f7f3a8796e865d2704ad595be05f87f9bb495121dd8904121320aec5601"# We need openxla to handle xla/mhlo/stablehlomaybe(http_archive,name = "xla",sha256 = OPENXLA_SHA256,strip_prefix = "xla-" + OPENXLA_COMMIT,type = ".tar.gz",urls = ["file:///repository/xla-c408b6320bbf8407b781487a2dbe329cb7488dac.tar.gz","https://github.com/openxla/xla/archive/{commit}.tar.gz".format(commit = OPENXLA_COMMIT),],)def _com_github_pybind11_bazel():maybe(http_archive,name = "pybind11_bazel",sha256 = "dc4882b23a617575d0fd822aba88aa4a14133c3d428b5a8fb83d81d03444a475",strip_prefix = "pybind11_bazel-8889d39b2b925b2a47519ae09402a96f00ccf2b4",urls = ["https://github.com/pybind/pybind11_bazel/archive/8889d39b2b925b2a47519ae09402a96f00ccf2b4.zip",],)def _com_github_pybind11():maybe(http_archive,name = "pybind11",build_file = "@pybind11_bazel//:pybind11.BUILD",sha256 = "bf8f242abd1abcd375d516a7067490fb71abd79519a282d22b6e4d19282185a7",strip_prefix = "pybind11-2.12.0",urls = ["file:///repository/pybind-v2.12.0.tar.gz","https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.tar.gz",],)def _com_intel_hexl():maybe(http_archive,name = "com_intel_hexl",type = "tar.gz",strip_prefix = "hexl-1.2.5",sha256 = "3692e6e6183dbc49253e51e86c3e52e7affcac925f57db0949dbb4d34b558a9a",build_file = "@spulib//bazel:hexl.BUILD",urls = ["https://github.com/intel/hexl/archive/refs/tags/v1.2.5.tar.gz",],patch_args = ["-p1"],patches = ["@spulib//bazel:patches/hexl.patch"],)def _com_github_emptoolkit_emp_tool():maybe(http_archive,name = "com_github_emptoolkit_emp_tool",sha256 = "b9ab2380312e78020346b5d2db3d0244c7bd8098cb50f8b3620532ef491808d0",strip_prefix = "emp-tool-0.2.5",type = "tar.gz",patch_args = ["-p1"],patches = ["@spulib//bazel:patches/emp-tool.patch","@spulib//bazel:patches/emp-tool-cmake.patch","@spulib//bazel:patches/emp-tool-sse2neon.patch",],urls = ["https://github.com/emp-toolkit/emp-tool/archive/refs/tags/0.2.5.tar.gz",],build_file = "@spulib//bazel:emp-tool.BUILD",)def _com_github_emptoolkit_emp_ot():maybe(http_archive,name = "com_github_emptoolkit_emp_ot",sha256 = "358036e5d18143720ee17103f8172447de23014bcfc1f8e7d5849c525ca928ac",strip_prefix = "emp-ot-0.2.4",type = "tar.gz",patch_args = ["-p1"],patches = ["@spulib//bazel:patches/emp-ot.patch"],urls = ["https://github.com/emp-toolkit/emp-ot/archive/refs/tags/0.2.4.tar.gz",],build_file = "@spulib//bazel:emp-ot.BUILD",)def _com_github_microsoft_seal():maybe(http_archive,name = "com_github_microsoft_seal",sha256 = "af9bf0f0daccda2a8b7f344f13a5692e0ee6a45fea88478b2b90c35648bf2672",strip_prefix = "SEAL-4.1.1",type = "tar.gz",patch_args = ["-p1"],patches = ["@spulib//bazel:patches/seal.patch"],urls = ["https://github.com/microsoft/SEAL/archive/refs/tags/v4.1.1.tar.gz",],build_file = "@spulib//bazel:seal.BUILD",)def _com_github_eigenteam_eigen():EIGEN_COMMIT = "66e8f38891841bf88ee976a316c0c78a52f0cee5"EIGEN_SHA256 = "01fcd68409c038bbcfd16394274c2bf71e2bb6dda89a2319e23fc59a2da17210"maybe(http_archive,name = "com_github_eigenteam_eigen",sha256 = EIGEN_SHA256,build_file = "@spulib//bazel:eigen.BUILD",strip_prefix = "eigen-{commit}".format(commit = EIGEN_COMMIT),urls = ["https://gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),],)def _com_github_nvidia_cutlass():maybe(http_archive,name = "com_github_nvidia_cutlass",strip_prefix = "cutlass-3.5.0",urls = ["file:///repository/cutlass-v3.5.0.tar.gz","https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.5.0.tar.gz",],sha256 = "ef6af8526e3ad04f9827f35ee57eec555d09447f70a0ad0cf684a2e426ccbcb6",build_file = "@spulib//bazel:nvidia_cutlass.BUILD",)

这篇关于Bazel离线编译SPU的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/938507

相关文章

解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题

《解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题》文章详细描述了在使用lombok的@Data注解标注实体类时遇到编译无误但运行时报错的问题,分析... 目录问题分析问题解决方案步骤一步骤二步骤三总结问题使用lombok注解@Data标注实体类,编译时

maven 编译构建可以执行的jar包

💝💝💝欢迎莅临我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:「stormsha的主页」👈,「stormsha的知识库」👈持续学习,不断总结,共同进步,为了踏实,做好当下事儿~ 专栏导航 Python系列: Python面试题合集,剑指大厂Git系列: Git操作技巧GO

Windows环境利用VS2022编译 libvpx 源码教程

libvpx libvpx 是一个开源的视频编码库,由 WebM 项目开发和维护,专门用于 VP8 和 VP9 视频编码格式的编解码处理。它支持高质量的视频压缩,广泛应用于视频会议、在线教育、视频直播服务等多种场景中。libvpx 的特点包括跨平台兼容性、硬件加速支持以及灵活的接口设计,使其可以轻松集成到各种应用程序中。 libvpx 的安装和配置过程相对简单,用户可以从官方网站下载源代码

Golang test编译使用

创建文件my_test.go package testsimport "testing"func TestMy(t *testing.T) {t.Log("TestMy")} 通常用法: $ go test -v -run TestMy my_test.go=== RUN TestMyTestMy: my_test.go:6: TestMy--- PASS: TestMy (0.

全英文地图/天地图和谷歌瓦片地图杂交/设备分布和轨迹回放/无需翻墙离线使用

一、前言说明 随着风云局势的剧烈变化,对我们搞软件开发的人员来说,影响也是越发明显,比如之前对美对欧的软件居多,现在慢慢的变成了对大鹅和中东以及非洲的居多,这两年明显问有没有俄语或者阿拉伯语的输入法的增多,这要是放在2019年以前,一年也遇不到一个人问这种需求场景的。 地图应用这块也是,之前的应用主要在国内,现在慢慢的多了一些外国的应用场景,这就遇到一个大问题,我们平时主要开发用的都是国内的地

C++/《C/C++程序编译流程》

程序的基本流程如图:   1.预处理        预处理相当于根据预处理指令组装新的C/C++程序。经过预处理,会产生一个没有宏定义,没有条件编译指令,没有特殊符号的输出文件,这个文件的含义同原本的文件无异,只是内容上有所不同。 读取C/C++源程序,对其中的伪指令(以#开头的指令)进行处理将所有的“#define”删除,并且展开所有的宏定义处理所有的条件编译指令,如:“#if”、“

编译linux内核出现 arm-eabi-gcc: error: : No such file or directory

external/e2fsprogs/lib/ext2fs/tdb.c:673:29: warning: comparison between : In function 'max2165_set_params': -。。。。。。。。。。。。。。。。。。 。。。。。。。。。。。。。 。。。。。。。。 host asm: libdvm <= dalvik/vm/mterp/out/Inte

OpenStack离线Train版安装系列—3控制节点-Keystone认证服务组件

本系列文章包含从OpenStack离线源制作到完成OpenStack安装的全部过程。 在本系列教程中使用的OpenStack的安装版本为第20个版本Train(简称T版本),2020年5月13日,OpenStack社区发布了第21个版本Ussuri(简称U版本)。 OpenStack部署系列文章 OpenStack Victoria版 安装部署系列教程 OpenStack Ussuri版

OpenStack离线Train版安装系列—2计算节点-环境准备

本系列文章包含从OpenStack离线源制作到完成OpenStack安装的全部过程。 在本系列教程中使用的OpenStack的安装版本为第20个版本Train(简称T版本),2020年5月13日,OpenStack社区发布了第21个版本Ussuri(简称U版本)。 OpenStack部署系列文章 OpenStack Victoria版 安装部署系列教程 OpenStack Ussuri版

OpenStack离线Train版安装系列—1控制节点-环境准备

本系列文章包含从OpenStack离线源制作到完成OpenStack安装的全部过程。 在本系列教程中使用的OpenStack的安装版本为第20个版本Train(简称T版本),2020年5月13日,OpenStack社区发布了第21个版本Ussuri(简称U版本)。 OpenStack部署系列文章 OpenStack Victoria版 安装部署系列教程 OpenStack Ussuri版