首页 > 其他分享 >Common optimize technique

Common optimize technique

时间:2023-09-07 19:15:27浏览次数:44  
标签:instruction technique 矢量化 Common SIMD data optimize

Vectorization(矢量化)

Before we understand the vectorization, we can see a common secnario.
We have a array that has 100 float numbers, we want to calculate square of every data. If we use traditional computer, we need to calculate it one by one. For each calculation of data, an instruction needs to be excuted, it is a time-consuming process. As shown in the following figure.

Vectorization is an optimize technique, it uses SIMD(Single Instruction, Multiple Data)instruction set of modern processors to utilize one instruction to judge multiple data at the same time. It reduces the iteration times and overhead of commute instruction. As shown in the following figure.
画个图

矢量化技术依赖于处理器的SIMD指令集,例如Intel的SSE(Streaming SIMD Extensions)和AVX(Advanced Vector Extensions),以及ARM的NEON(Advanced SIMD)。这些指令集提供了特殊的指令和寄存器,可以同时处理多个数据项。

要实现矢量化,编译器需要具备优化器来自动将程序中的循环等代码转换成对应的SIMD指令。同时,编写代码时也需要遵循一些规则,以便编译器能够进行有效的矢量化优化。

总的来说,矢量化是一种通过同时处理多个数据项来提高计算效率的优化技术,可以显著提高程序的性能。它是现代计算机程序优化中的重要手段之一。

标签:instruction,technique,矢量化,Common,SIMD,data,optimize
From: https://www.cnblogs.com/hongyugao/p/17685824.html

相关文章

  • CommonJS 和 ECMAScript 转换
    CommonJS和ECMAScript前言:在完成一个加密工具的过程中,本来只想使用commonjs语法完成该功能,但是在使用chalk的时候发现chalk是通过ES模块导出的,无法使用require引入(当然也有一些方法,可以使用bable去转化,但是本人想实现使用es语法,目前还没写多少内容,以下是转化......
  • Java反序列化:CommonsCollections5调试分析
    基础知识1.BadAttributeValueExpException相关源码可以看到这个异常类的支持序列化和反序列化,同时在反序列化readObject函数中会涉及到toString函数publicclassBadAttributeValueExpExceptionextendsException{/*Serialversion*/privatestaticfinal......
  • 一次尝试:一种基于Common Lisp的简易单词本命令行工具
    绪论背景英语的学习给现代中国学生带来了极大的挑战。学习英语的一种常规做法是记录纸质笔记。然而,常规的纸质笔记具有书写慢、不易修改的特点……(编不下去了)。为了简化英语单词笔记记录、查看的操作,本文基于一种简单的数据管理方法,提出一种新型单词本,即lisp-dictionary命令行工......
  • log4j结合commons-logging配置总结
    作者fbysss关键字:loggingcommons-logging是一个通用的日志接口,commons-logging.jar包中自带了一个simplelog的实现log4j也实现了这个接口使用通用接口,方便在于如果更换实现的方式,只要修改一个配置项即可配置过程:commons-logging.properties必须放置在WEB-INF/classes/下面log4j.pro......
  • Java反序列化:CommonsCollections6调试分析
    JDK8u71大版本中AnnotationInvocationHandler.readObject被修改了,为了使得CC1能够利用,又造了一条CC6CC6解决的是CC1在高版本jdk上无法利用的问题这里搬一下web佬Boogipop的整理图:环境搭建JDK测试版本:JDK11基础知识1.CC1和CC6的恶意代码执行触发链再来捋顺一下这条恶......
  • Java:commons-codec实现byte数组和16进制字符串转换
    目录commons-codec实现原理封装StringUtil类commons-codec文档https://commons.apache.org/proper/commons-codec/https://mvnrepository.com/artifact/commons-codec/commons-codec坐标<dependency><groupId>commons-codec</groupId><artifactId>com......
  • Java:commons-codec实现byte数组和16进制字符串转换
    (目录)commons-codec文档https://commons.apache.org/proper/commons-codec/https://mvnrepository.com/artifact/commons-codec/commons-codec坐标<dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifact......
  • Apache Commons Logging 是如何决定使用哪个日志实现类的
    ApacheCommonsLogging像SLF4J一样,是个通用日志框架,广泛应用在各个开源组件中。说其通用,是因为它本身只提供了简单的日志输出的实现(org.apache.commons.logging.impl.SimpleLog和org.apache.commons.logging.impl.NoOpLog),主要是为你统一使用其他专业日志实现(Log4j、jdk1.4......
  • This TensorFlow binary is optimized to use available CPU instructions in perform
    ThisTensorFlowbinaryisoptimizedtouseavailableCPUinstructionsinperformance-criticaloperations.Toenablethefollowinginstructions:AVX2FMA,inotheroperations,rebuildTensorFlowwiththeappropriatecompilerflags.   这是TensorFlow库在安......
  • 【OpenCV】features2d_converters.cpp:2:10: fatal error: common.h: 没有那个文件或
    Linux环境下使用opencv的dnn模块调用yolov4遇到的坑(纯CPU)一、问题描述Ubuntu安装opencv4.4,第一次编译完成安装成功,发现编译时少加了几个选项,于是重新编译,结果报如下错误:opencv_contrib-4.4.0/modules/xfeatures2d/test/features2d/misc/java/src/cpp/\features2d_converters.cpp:......