Halide 配置 visual studio
Halide是一种编程语言,使得在现代机器上编写高性能图像和数组处理代码更加容易。Halide支持如下的平台:

CPU体系结构:X86,ARM,MIPS,Hexagon,PowerPC

操作系统:Linux,Windows,macOS,Android,iOS,Qualcomm QuRT

GPU计算API:CUDA,OpenCL,OpenGL,OpenGL计算着色器,Apple Metal,Microsoft Direct X 12

Halide并不是独立的编程语言,而是嵌入在C ++中。 这意味可以像编写c++代码一样编写halide代码。本文会介绍如何通过配置环境,在visual studio上可以跑Halide代码

1.一个视频介绍

https://halide-lang.org/cvpr2015.html
很好的博客介绍

2.halide下载

https://github.com/halide/Halide/releases
Windows下载x86-64的版本, 后面会在vs上进行配置

3.Test 代码,包含很多测试性能的例子

https://github.com/halide/Halide/tree/master/test

4.在windows visual studio 2022中配置 halide 14.0步骤

1)解压后的文件夹

2)配置环境变量

比如下面路径
D:\Halide-14.0.0-x86-64-windows\Halide-14.0.0-x86-64-windows\bin\Release

3)新建控制台应用,

在属性管理器中, release x64下新建halidePropertySheet属性页,后续配置完成这个属性页后,保存下来,再建立其他用到halide的时候直接复制该属性页就可以。

解决方案配置选择 release x64

复制https://halide-lang.org/docs/tutorial_2lesson_01_basics_8cpp-example.html中的代码用于验证。

// The only Halide header file you need is Halide.h. It includes all of Halide.
#include "Halide.h"// We'll also include stdio for printf.
#include <stdio.h>int main(int argc, char** argv) {// This program defines a single-stage imaging pipeline that// outputs a grayscale diagonal gradient.// A 'Func' object represents a pipeline stage. It's a pure// function that defines what value each pixel should have. You// can think of it as a computed image.Halide::Func gradient;// Var objects are names to use as variables in the definition of// a Func. They have no meaning by themselves.Halide::Var x, y;// We typically use Vars named 'x' and 'y' to correspond to the x// and y axes of an image, and we write them in that order. If// you're used to thinking of images as having rows and columns,// then x is the column index, and y is the row index.// Funcs are defined at any integer coordinate of its variables as// an Expr in terms of those variables and other functions.// Here, we'll define an Expr which has the value x + y. Vars have// appropriate operator overloading so that expressions like// 'x + y' become 'Expr' objects.Halide::Expr e = x + y;// Now we'll add a definition for the Func object. At pixel x, y,// the image will have the value of the Expr e. On the left hand// side we have the Func we're defining and some Vars. On the right// hand side we have some Expr object that uses those same Vars.gradient(x, y) = e;// This is the same as writing:////   gradient(x, y) = x + y;//// which is the more common form, but we are showing the// intermediate Expr here for completeness.// That line of code defined the Func, but it didn't actually// compute the output image yet. At this stage it's just Funcs,// Exprs, and Vars in memory, representing the structure of our// imaging pipeline. We're meta-programming. This C++ program is// constructing a Halide program in memory. Actually computing// pixel data comes next.// Now we 'realize' the Func, which JIT compiles some code that// implements the pipeline we've defined, and then runs it.  We// also need to tell Halide the domain over which to evaluate the// Func, which determines the range of x and y above, and the// resolution of the output image. Halide.h also provides a basic// templatized image type we can use. We'll make an 800 x 600// image.Halide::Buffer<int32_t> output = gradient.realize({ 800, 600 });// Halide does type inference for you. Var objects represent// 32-bit integers, so the Expr object 'x + y' also represents a// 32-bit integer, and so 'gradient' defines a 32-bit image, and// so we got a 32-bit signed integer image out when we call// 'realize'. Halide types and type-casting rules are equivalent// to C.// Let's check everything worked, and we got the output we were// expecting:for (int j = 0; j < output.height(); j++) {for (int i = 0; i < output.width(); i++) {// We can access a pixel of an Buffer object using similar// syntax to defining and using functions.if (output(i, j) != i + j) {printf("Something went wrong!\n""Pixel %d, %d was supposed to be %d, but instead it's %d\n",i, j, i + j, output(i, j));return -1;}}}// Everything worked! We defined a Func, then called 'realize' on// it to generate and run machine code that produced an Buffer.printf("Success!\n");return 0;
}

4)配置 属性页

添加包含目录和库目录

修改 c++语言标准为 c++ 17

链接器-常规-附加库目录

连接器-输入-附加依赖项

5)以上完成后保存属性页,点击运行程序,程序正常运行,表示配置正确,可以正常使用halide

5. 有用的资源

CSDN上的 halide编程技术指南

官网example

很好的博客介绍

Halide 配置 visual studio相关推荐

  1. 配置 Visual Studio 2019以进行 iOS 开发

    前言 在安装vs2019时有个选项:在vs2019中进行Android和ios开发,是不是普大喜空,再次膜拜地表最强IDE vs2019,幻想着在windows下跑Android和Ios程序..... ...

  2. 配置Visual Studio Code的SciLab开发环境

    配置Visual Studio Code的SciLab开发环境 引言 整体思路 插件安装 设置环境变量 设置setting.json 引言 由于美国将一批中国高校列入了实体清单制裁,近日Mathwor ...

  3. 配置Visual Studio 2015+OpenGL可运行蓝宝书源码

    首先要感谢CSDN的两位博主的参考博文,http://blog.csdn.net/iceteaset/article/details/50359559    http://blog.csdn.net/ ...

  4. Linux操作系统Ubuntu 22.04配置Visual Studio Code与C++代码开发环境的方法

      本文介绍在Linux Ubuntu操作系统下,配置Visual Studio Code软件与C++ 代码开发环境的方法.   在文章虚拟机VMware Workstation Pro中配置Linu ...

  5. 安装opencv3.0.0与配置Visual studio 2008

    http://jingyan.baidu.com/article/b907e627cb97cd46e7891c3d.html 本经验详细介绍了最新版的opencv3.0.0的安装方法,与visual ...

  6. macOS配置Visual Studio Code开发Java项目

    今天折腾了一会vs code下配置Java开发环境,现贴出配置步骤. 1.开发环境: macOS Mojave JDK 1.8 Visual Studio Code 2.macOS下查看jdk安装路径 ...

  7. CLion配置visual studio(msvc)和JOM多核编译

    安装visual studio(msvc) 如果你只是开发Window平台的软件时, 最好使用MSVC,这样可以使用大量的第三方lib,还有很多的构建指令,毕竟window上MSVC才是王道.从Vis ...

  8. 配置Visual Studio 2017+OpenGL可运行蓝宝书源码

    https://blog.csdn.net/perseverancep/article/details/72476727 先根据上面这篇文字步骤意义操作,完了 如果运行报错LINK错误.lib文件打不 ...

  9. Windows10 配置深度学习环境(使用本地GPU,配置Visual Studio 2017 + CUDA 10.1 + TensorFlow-GPU 2.3.0)

    目录 配置环境 1. 安装Anaconda 2. 安装 Visual Studio 3. 安装 CUDA 4. 安装 CUDNN 5. 安装 TensorFlow-GPU 最近需要使用TensorFl ...

最新文章

  1. WannaCry 不相信眼泪 它需要你的安全防御与响应能力
  2. 美国密西西比州立大学招收机器学习、数据挖掘方向全奖博士生
  3. php用array_merge实现无限级分类
  4. java EE中JPA介绍
  5. SAP Kyma能像SAP BYD那样做field extension吗
  6. POJ 1852 Ants 分析
  7. javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplicati
  8. 更司马懿学管理计算机,跟司马懿学管理(一)无悔的选择是好选择
  9. Xception论文笔记
  10. GCC和TCC编译TCC
  11. 栈的增长方向(ZZ)
  12. 【小知识】二分类问题,应该选择sigmoid还是softmax?
  13. PIC单片机开发环境搭建
  14. linux提取曲线数据软件,曲线图转数据工具软件(Engauge Digitizer)提取文献中的数据...
  15. 字节跳动算法工程师总结:腾讯+字节+阿里面经真题汇总,含面试题+答案
  16. Mac Ports的安装和卸载
  17. 汉字生成woff字体文件
  18. 马云卸职CEO的启示
  19. 大数据特征及基本技能
  20. 美德乐吸奶器怎么样-

热门文章

  1. OpenGL入门示例8——图形平移、旋转、缩放
  2. 应用服务Application Services
  3. trinity的简介、下载及使用
  4. PHP:【微信小程序】初识微信小程序,微信小程序配置
  5. 2范数和F范数的区别
  6. Linux之安装node
  7. GPS从入门到放弃(八) --- GPS卫星速度解算
  8. 独轮平衡车c语言源码,双轮平衡车程序 - 源码下载|嵌入式/单片机编程|源代码 - 源码中国...
  9. 推荐一款绝对不能错过的 ORM 框架 dbVisitor,目前版本 4.3.0
  10. Oracle执行语句跟踪(1)——使用sql trace实现语句追踪