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

相关文章

ESP32 esp-idf esp-adf环境安装及.a库创建与编译

简介 ESP32 功能丰富的 Wi-Fi & 蓝牙 MCU, 适用于多样的物联网应用。使用freertos操作系统。 ESP-IDF 官方物联网开发框架。 ESP-ADF 官方音频开发框架。 文档参照 https://espressif-docs.readthedocs-hosted.com/projects/esp-adf/zh-cn/latest/get-started/index

C++工程编译链接错误汇总VisualStudio

目录 一些小的知识点 make工具 可以使用windows下的事件查看器崩溃的地方 dumpbin工具查看dll是32位还是64位的 _MSC_VER .cc 和.cpp 【VC++目录中的包含目录】 vs 【C/C++常规中的附加包含目录】——头文件所在目录如何怎么添加,添加了以后搜索头文件就会到这些个路径下搜索了 include<> 和 include"" WinMain 和

C/C++的编译和链接过程

目录 从源文件生成可执行文件(书中第2章) 1.Preprocessing预处理——预处理器cpp 2.Compilation编译——编译器cll ps:vs中优化选项设置 3.Assembly汇编——汇编器as ps:vs中汇编输出文件设置 4.Linking链接——链接器ld 符号 模块,库 链接过程——链接器 链接过程 1.简单链接的例子 2.链接过程 3.地址和

Windwos +vs 2022 编译openssl 1.0.2 库

一 前言 先说 结论,编译64位报错,查了一圈没找到解决方案,最后换了32位的。 使用qt访问web接口,因为是https,没有openssl库会报错 QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());if (reply){if (reply->error() == QNetworkReply::NoError

【服务器运维】CentOS6 minimal 离线安装MySQL5.7

1.准备安装包(版本因人而异,所以下面的命令中版本省略,实际操作中用Tab自动补全就好了) cloog-ppl-0.15.7-1.2.el6.x86_64.rpmcpp-4.4.7-23.el6.x86_64.rpmgcc-4.4.7-23.el6.x86_64.rpmgcc-c++-4.4.7-23.el6.x86_64.rpmglibc-2.12-1.212.el6.x86_64.r

【服务器运维】CentOS7 minimal 离线安装 gcc perl vmware-tools

0. 本机在有网的情况下,下载CentOS镜像 https://www.centos.org/download/ 1. 取出rpm 有的情况可能不需要net-tools,但是如果出现跟ifconfig相关的错误,就把它安装上。另外如果不想升级内核版本的话,就找对应内核版本的rpm版本安装 perl-Time-Local-1.2300-2.el7.noarch.rpmperl-Tim

Ubuntu20.04离线安装Docker

1.下载3个docker离线安装包,下载网址: https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/ 2.把3个离线安装包拷贝到ubuntu本地执行以下命令 sudo dpkg -i containerd.io_1.4.6-1_amd64.deb sudo dpkg -i docker-ce-c

青龙面板2.9之Cdle傻妞机器人编译教程

看到有的朋友对傻妞机器人感兴趣,这里写一下傻妞机器人的编译教程。 第一步,这里以linux amd64为例,去官网下载安装go语言安装包: 第二步,输入下方指令 cd /usr/local && wget https://golang.google.cn/dl/go1.16.7.linux-amd64.tar.gz -O go1.16.7.linux-amd64.tar.gz

iOS:编译时出现no such file or directory:xxx以及use twice...filenames are used to distinguish private dec

简    注册  登录   添加关注 作者  婉卿容若 2016.04.29 11:22 写了21870字,被16人关注,获得了14个喜欢 iOS:编译时出现"no such file or directory:xxx"以及"use twice...filenames are used to distinguish private

Java的简易编译命令

生成jar包 编译生成.class 文件 编译.class文件的命令,其中的参数是输出,原文件路径 javac -sourcepath class.class MyClass.java 如果有包名的需要创建对应包的文件夹,建文件移动对应的包名下在开始包下创建meta-inf文件夹在meta-inf文件下创建manifest.mf文件 生成可运行的jar包 解压 生成了jar包后,进