当前位置: 首页 > news >正文

【OnnxRuntime】在linux下编译并安装C++版本的onnx-runtime

目录

  • 安装C++接口的onnx-runtime
    • 安装依赖项:
    • 下载源文件
    • 构建ONNX Runtime
    • 安装ONNX Runtime

安装C++接口的onnx-runtime

安装依赖项:

安装CMake:可以通过包管理器(如apt、yum等)安装CMake。

安装C++编译器:确保系统中已安装C++编译器,如GCC或Clang。

下载源文件

克隆ONNX Runtime的GitHub仓库,指定版本是为了适配python3.8:

git clone --branch v1.5.2 --recursive https://gitee.com/lee-zq/onnxruntime.git

构建ONNX Runtime

进入ONNX Runtime的源代码目录:
// 首先创建一个conda环境,因为./build.sh实际上调用的是./tools/cl_build/build.py

cd onnxruntime
conda create -n onnxruntime python=3.8
./build.sh --skip_tests --config Release --build_shared_lib --parallel

注意,若配合cuda使用,命令行末尾应添加

-cuda_home /usr/local/cuda-11.3 --cudnn_home /usr/local/cuda-11.3

注意,编译前,确保机器装有linux环境:

sudo apt-get install build-essential

这将使用所有可用的CPU核心进行编译。如果希望使用指定数量的核心,可以将$(nproc)替换为所需的核心数量。

安装ONNX Runtime

运行以下命令进行安装:

cd /build/Linux/Release
sudo make install

通过按照上述步骤,您应该能够在Linux上成功安装ONNX Runtime。请注意,安装过程中可能需要根据您的系统和需求进行适当的调整。

Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/include/onnxruntime/core/common
-- Installing: /usr/local/include/onnxruntime/core/common/code_location.h
-- Installing: /usr/local/include/onnxruntime/core/common/common.h
-- Installing: /usr/local/include/onnxruntime/core/common/const_pointer_container.h
-- Installing: /usr/local/include/onnxruntime/core/common/eigen_common_wrapper.h
-- Installing: /usr/local/include/onnxruntime/core/common/exceptions.h
-- Installing: /usr/local/include/onnxruntime/core/common/logging
-- Installing: /usr/local/include/onnxruntime/core/common/logging/capture.h
-- Installing: /usr/local/include/onnxruntime/core/common/logging/isink.h
-- Installing: /usr/local/include/onnxruntime/core/common/logging/logging.h
-- Installing: /usr/local/include/onnxruntime/core/common/logging/macros.h
-- Installing: /usr/local/include/onnxruntime/core/common/logging/severity.h
-- Installing: /usr/local/include/onnxruntime/core/common/make_unique.h
-- Installing: /usr/local/include/onnxruntime/core/common/optional.h
-- Installing: /usr/local/include/onnxruntime/core/common/status.h
-- Installing: /usr/local/include/onnxruntime/core/graph
-- Installing: /usr/local/include/onnxruntime/core/graph/basic_types.h
-- Installing: /usr/local/include/onnxruntime/core/graph/constants.h
-- Installing: /usr/local/include/onnxruntime/core/graph/function.h
-- Installing: /usr/local/include/onnxruntime/core/graph/graph.h
-- Installing: /usr/local/include/onnxruntime/core/graph/graph_nodes.h
-- Installing: /usr/local/include/onnxruntime/core/graph/graph_viewer.h
-- Installing: /usr/local/include/onnxruntime/core/graph/indexed_sub_graph.h
-- Installing: /usr/local/include/onnxruntime/core/graph/node_arg.h
-- Installing: /usr/local/include/onnxruntime/core/graph/onnx_protobuf.h
-- Installing: /usr/local/include/onnxruntime/core/graph/schema_registry.h
-- Installing: /usr/local/include/onnxruntime/core/framework
-- Installing: /usr/local/include/onnxruntime/core/framework/alloc_kind.h
-- Installing: /usr/local/include/onnxruntime/core/framework/allocator.h
-- Installing: /usr/local/include/onnxruntime/core/framework/customregistry.h
-- Installing: /usr/local/include/onnxruntime/core/framework/data_types.h
-- Installing: /usr/local/include/onnxruntime/core/framework/data_types_internal.h
-- Installing: /usr/local/include/onnxruntime/core/framework/endian.h
-- Installing: /usr/local/include/onnxruntime/core/framework/execution_provider.h
-- Installing: /usr/local/include/onnxruntime/core/framework/fence.h
-- Installing: /usr/local/include/onnxruntime/core/framework/framework_common.h
-- Installing: /usr/local/include/onnxruntime/core/framework/func_api.h
-- Installing: /usr/local/include/onnxruntime/core/framework/kernel_def_builder.h
-- Installing: /usr/local/include/onnxruntime/core/framework/kernel_registry.h
-- Installing: /usr/local/include/onnxruntime/core/framework/ml_value.h
-- Installing: /usr/local/include/onnxruntime/core/framework/op_kernel.h
-- Installing: /usr/local/include/onnxruntime/core/framework/op_kernel_info.h
-- Installing: /usr/local/include/onnxruntime/core/framework/op_node_proto_helper.h
-- Installing: /usr/local/include/onnxruntime/core/framework/ortdevice.h
-- Installing: /usr/local/include/onnxruntime/core/framework/ortmemoryinfo.h
-- Installing: /usr/local/include/onnxruntime/core/framework/run_options.h
-- Installing: /usr/local/include/onnxruntime/core/framework/sparse_tensor.h
-- Installing: /usr/local/include/onnxruntime/core/framework/tensor.h
-- Installing: /usr/local/include/onnxruntime/core/framework/tensor_shape.h
-- Installing: /usr/local/include/onnxruntime/core/providers/cpu
-- Installing: /usr/local/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h
-- Installing: /usr/local/include/onnxruntime/core/optimizer
-- Installing: /usr/local/include/onnxruntime/core/optimizer/graph_transformer.h
-- Installing: /usr/local/include/onnxruntime/core/optimizer/graph_transformer_level.h
-- Installing: /usr/local/include/onnxruntime/core/optimizer/graph_transformer_utils.h
-- Installing: /usr/local/include/onnxruntime/core/optimizer/rewrite_rule.h
-- Installing: /usr/local/include/onnxruntime/core/optimizer/rule_based_graph_transformer.h
-- Installing: /usr/local/include/onnxruntime/core/session
-- Installing: /usr/local/include/onnxruntime/core/session/automl_data_containers.h
-- Installing: /usr/local/include/onnxruntime/core/session/environment.h
-- Installing: /usr/local/include/onnxruntime/core/session/experimental_onnxruntime_cxx_api.h
-- Installing: /usr/local/include/onnxruntime/core/session/experimental_onnxruntime_cxx_inline.h
-- Installing: /usr/local/include/onnxruntime/core/session/onnxruntime_c_api.h
-- Installing: /usr/local/include/onnxruntime/core/session/onnxruntime_cxx_api.h
-- Installing: /usr/local/include/onnxruntime/core/session/onnxruntime_cxx_inline.h
-- Installing: /usr/local/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h
-- Installing: /usr/local/lib/libonnxruntime.so.1.5.2
-- Installing: /usr/local/lib/libonnxruntime.so
-- Installing: /usr/local/bin/onnx_test_runner

安装完成。

相关文章:

【OnnxRuntime】在linux下编译并安装C++版本的onnx-runtime

目录 安装C接口的onnx-runtime安装依赖项:下载源文件构建ONNX Runtime安装ONNX Runtime 安装C接口的onnx-runtime 安装依赖项: 安装CMake:可以通过包管理器(如apt、yum等)安装CMake。 安装C编译器:确保系…...

C#基于OpenCv(OpenCvSharp) 的 fftshift, ifftshift 函数的实现

本文实现基于OpenCv(OpenCvSharp) 的 fftshift, ifftshift 函数。 fftshift 函数将信号频谱的零频分量移动到数组中心, 本质是分别对调一三象限数据。 ifftshift完成相反的操作,本质是二四象限的数据块。 OpenCV中没有这两个函数如果使用需要自己实现。 实现代码如下: …...

【SpringBoot】笔记2

文章目录 45、web实验-抽取公共页面46、web实验-遍历数据与页面bug修改47、视图解析-【源码分析】-视图解析器与视图[暂时没看]48、拦截器-登录检查与静态资源放行49、拦截器-【源码分析】-拦截器的执行时机和原理50、文件上传-单文件与多文件上传的使用51、文件上传-【源码流程…...

Spring事务传播机制详细讲解

文章目录 一、事务传播机制1. REQUIRED:2. SUPPORTS:3. MANDATORY:4. REQUIRES_NEW:5. NOT_SUPPORTED:6. NEVER:7. NESTED: 二、事务传播机制分类1. 支持当前事务的传播机制:REQUIRE…...

kubernetes 集群搭建(kubeadm 方式)

目前生产部署 Kubernetes 集群主要有两种方式: (1) kubeadm Kubeadm 是一个 Kubernetes 官方提供的命令行工具,可以用来部署和管理 Kubernetes 集群。它主要用于在新的 Kubernetes 环境中初始化集群、添加或删除节点等操作。 K…...

基于ARM+FPGA的驱控一体机器人控制器设计

目前市场上工业机器人,数控机床等多轴运动控制系统普遍采用运动控制器加 伺服驱动器的分布式控制方式。在这种控制方式中,控制器一方面完成人机交互,另 一方面进行 NC 代码的解释执行,插补运算,继而将计算出来的位…...

docker 安装 字体文件

先说一下我当前的 场景 及 环境,这样同学们可以先评估本篇文章是否有帮助。 环境: dockerphp8.1-fpmwindows 场景: 来了个需求,有一个默认背景图,可以理解为背景图是一个 "相框",相框里面就会放…...

Vue.js与ASP.NET的结合,实现企业级应用的开发和部署

在当今快速发展的互联网技术领域,企业级应用的开发和部署变得越来越重要。Vue.js和ASP.NET是两个在前端和后端开发中广泛使用的技术,将它们结合起来可以为企业级应用的开发和部署带来诸多优势。本文将通过代码示例介绍如何使用Vue.js和ASP.NET进行企业级…...

Uncaught SyntaxError: ‘‘ string literal contains an unescaped line break

今天在修改前端页面的时候,页面报错了,提示了这个信息 Uncaught SyntaxError: string literal contains an unescaped line break 问题指向这行代码,这就是通过JS渲染一个easyui的搜索框,仔细确认之后,发现没有任何问…...

Vue3+Vite+TypeScript常用项目模块详解

目录 1.Vue3ViteTypeScript 概述 1.1 vue3 1.1.1 Vue3 概述 1.1.2 vue3的现状与发展趋势 1.2 Vite 1.2.1 现实问题 1.2 搭建vite项目 1.3 TypeScript 1.3.1 TypeScript 定义 1.3.2 TypeScript 基本数据类型 1.3.3 TypeScript语法简单介绍 2. 项目配置简单概述 2.…...

数字电路(一)

1、例题 1、进行DA数模转换器选型时,一般要选择主要参数有( A)、转换精度和转换速度。 A、分辨率 B、输出电流 C、输出电阻 D、模拟开关 2、下图所示电路的逻辑功能为( B) A、与门 B、或门 C、与非门 D、或非门 分析该…...

Oracle也有回收站

在数据库管理中,数据的删除是一个常见的操作。然而,有时候我们可能会意外地删除了一些重要的数据。幸运的是,Oracle数据库提供了一个类似于回收站的功能,可以帮助我们恢复被删除的数据。本文将介绍Oracle数据库中的回收站功能以及…...

投稿注意!APA格式超全示例详解,原本28天能录用,可能要拖延2个月

为什么同一本期刊有论文28天录用,有论文10个月才录用?结合近期征稿的这本经管类SSCI期刊,小编(Unionpub学术)整理了部分影响录用的几个因素,准备提交此期刊的作者可自查参考下: (参…...

【Python】Web学习笔记_flask(1)——模拟登录

安装flask pip3 install flask 第一部分内容&#xff1a; 1、主页面输出hello world 2、根据不同用户名参数输出用户信息 3、模拟登录 from flask import Flask,url_for,redirectappFlask(__name__)app.route(/) def index():return hello worldapp.route(/user/<uname…...

css单行文本省略号多行文本省略号

设置单行文本省略号的写法 &#xff1a; 先设置宽固定的宽度 &#xff1a;width: 300px; 设置不换行 &#xff1a;white-space:nowrap; 设置省略号&#xff1a;text-overflow: ellipsis; 裁剪多余的内容/溢出的内容&#xff1a;overflow: hidden; width: 200px; white-space:…...

信号槽中的函数重载

信号槽中的函数重载 QT4的方式QT5的方式函数指针重载函数QT5信号函数重载解决方案 总结 QT4的方式 Qt4中声明槽函数必须要使用 slots 关键字, 不能省略。 信号函数&#xff1a; 槽函数&#xff1a; mainwondow: cpp文件&#xff1a; #include "mainwindow.h"…...

计算机视觉(五)深度学习基础

文章目录 深度学习基础卷积神经网络与传统神经网络区别深度学习与神经网络的区别 目标函数选择合适的目标函数Softmax层 改进的梯度下降梯度消失的直观解释激活函数学习步长SGD的问题Momentum动量Nesterov MomentumAdagradRMSpropAdam 各种梯度下降算法比较关于算法选择的建议B…...

ES6学习-Generator

Generator 种异步编程解决方案 函数会返回一个遍历器对象语法上:Generator 函数是一个状态机&#xff0c;封装了多个内部状态。形式上:Generator 函数是一个普通函数;有两个特征。一是&#xff0c;function关键字与函数名之间有一个星号&#xff1b;二是&#xff0c;函数体内部…...

Flowable-服务-微服务任务

目录 定义图形标记XML内容界面操作 定义 Sc 任务不是 BPMN 2.0 规范定义的官方任务&#xff0c;在 Flowable 中&#xff0c;Sc 任务是作为一种特殊的服务 任务来实现的&#xff0c;主要调用springcloud的微服务使用。 图形标记 由于 Sc 任务不是 BPMN 2.0 规范的“官方”任务…...

opencv03-补充-vector的操作

opencv03-补充-vector的操作 参考&#xff1a;https://www.runoob.com/w3cnote/cpp-vector-container-analysis.html 构造方法(具体介绍看API文档) class Student {public:private:string name;};int main() {vector<int>();vector<int> v1;vector<Student&g…...

conda相比python好处

Conda 作为 Python 的环境和包管理工具&#xff0c;相比原生 Python 生态&#xff08;如 pip 虚拟环境&#xff09;有许多独特优势&#xff0c;尤其在多项目管理、依赖处理和跨平台兼容性等方面表现更优。以下是 Conda 的核心好处&#xff1a; 一、一站式环境管理&#xff1a…...

进程地址空间(比特课总结)

一、进程地址空间 1. 环境变量 1 &#xff09;⽤户级环境变量与系统级环境变量 全局属性&#xff1a;环境变量具有全局属性&#xff0c;会被⼦进程继承。例如当bash启动⼦进程时&#xff0c;环 境变量会⾃动传递给⼦进程。 本地变量限制&#xff1a;本地变量只在当前进程(ba…...

【人工智能】神经网络的优化器optimizer(二):Adagrad自适应学习率优化器

一.自适应梯度算法Adagrad概述 Adagrad&#xff08;Adaptive Gradient Algorithm&#xff09;是一种自适应学习率的优化算法&#xff0c;由Duchi等人在2011年提出。其核心思想是针对不同参数自动调整学习率&#xff0c;适合处理稀疏数据和不同参数梯度差异较大的场景。Adagrad通…...

Oracle查询表空间大小

1 查询数据库中所有的表空间以及表空间所占空间的大小 SELECTtablespace_name,sum( bytes ) / 1024 / 1024 FROMdba_data_files GROUP BYtablespace_name; 2 Oracle查询表空间大小及每个表所占空间的大小 SELECTtablespace_name,file_id,file_name,round( bytes / ( 1024 …...

CMake基础:构建流程详解

目录 1.CMake构建过程的基本流程 2.CMake构建的具体步骤 2.1.创建构建目录 2.2.使用 CMake 生成构建文件 2.3.编译和构建 2.4.清理构建文件 2.5.重新配置和构建 3.跨平台构建示例 4.工具链与交叉编译 5.CMake构建后的项目结构解析 5.1.CMake构建后的目录结构 5.2.构…...

Linux相关概念和易错知识点(42)(TCP的连接管理、可靠性、面临复杂网络的处理)

目录 1.TCP的连接管理机制&#xff08;1&#xff09;三次握手①握手过程②对握手过程的理解 &#xff08;2&#xff09;四次挥手&#xff08;3&#xff09;握手和挥手的触发&#xff08;4&#xff09;状态切换①挥手过程中状态的切换②握手过程中状态的切换 2.TCP的可靠性&…...

【大模型RAG】Docker 一键部署 Milvus 完整攻略

本文概要 Milvus 2.5 Stand-alone 版可通过 Docker 在几分钟内完成安装&#xff1b;只需暴露 19530&#xff08;gRPC&#xff09;与 9091&#xff08;HTTP/WebUI&#xff09;两个端口&#xff0c;即可让本地电脑通过 PyMilvus 或浏览器访问远程 Linux 服务器上的 Milvus。下面…...

Rapidio门铃消息FIFO溢出机制

关于RapidIO门铃消息FIFO的溢出机制及其与中断抖动的关系&#xff0c;以下是深入解析&#xff1a; 门铃FIFO溢出的本质 在RapidIO系统中&#xff0c;门铃消息FIFO是硬件控制器内部的缓冲区&#xff0c;用于临时存储接收到的门铃消息&#xff08;Doorbell Message&#xff09;。…...

AI书签管理工具开发全记录(十九):嵌入资源处理

1.前言 &#x1f4dd; 在上一篇文章中&#xff0c;我们完成了书签的导入导出功能。本篇文章我们研究如何处理嵌入资源&#xff0c;方便后续将资源打包到一个可执行文件中。 2.embed介绍 &#x1f3af; Go 1.16 引入了革命性的 embed 包&#xff0c;彻底改变了静态资源管理的…...

【VLNs篇】07:NavRL—在动态环境中学习安全飞行

项目内容论文标题NavRL: 在动态环境中学习安全飞行 (NavRL: Learning Safe Flight in Dynamic Environments)核心问题解决无人机在包含静态和动态障碍物的复杂环境中进行安全、高效自主导航的挑战&#xff0c;克服传统方法和现有强化学习方法的局限性。核心算法基于近端策略优化…...