CN110187962A - 一种基于CUDA的Gridding算法优化方法及装置 - Google Patents

一种基于CUDA的Gridding算法优化方法及装置 Download PDF

Info

Publication number
CN110187962A
CN110187962A CN201910344869.0A CN201910344869A CN110187962A CN 110187962 A CN110187962 A CN 110187962A CN 201910344869 A CN201910344869 A CN 201910344869A CN 110187962 A CN110187962 A CN 110187962A
Authority
CN
China
Prior art keywords
function
cuda
gridding
gpu
gridding algorithm
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910344869.0A
Other languages
English (en)
Inventor
胡馨艺
赵亚群
赵志诚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Information Engineering University of PLA Strategic Support Force
Original Assignee
Information Engineering University of PLA Strategic Support Force
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Information Engineering University of PLA Strategic Support Force filed Critical Information Engineering University of PLA Strategic Support Force
Priority to CN201910344869.0A priority Critical patent/CN110187962A/zh
Publication of CN110187962A publication Critical patent/CN110187962A/zh
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5072Grid computing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Processing (AREA)

Abstract

本发明涉及并行化技术领域,公开一种基于CUDA的Gridding算法优化方法,包括:步骤1:根据Gridding算法中函数调用次数,得出调用次数最高的前M个函数;步骤2:通过矩阵矢量化方法,在CUDA中对所述M个函数进行GPU并行化处理。本发明还公开一种基于CUDA的Gridding算法优化装置,包括:比较模块和并行化模块。本发明缩短了Gridding算法整体的运算时间,提高了运行效率,且不影响输入输出数据的格式和大小。

Description

一种基于CUDA的Gridding算法优化方法及装置
技术领域
本发明涉及并行化技术领域,特别涉及一种基于CUDA的Gridding算法优化方法及装置。
背景技术
天文学数据不管是在数据量,数据的复杂度还是数据增长的速度上都在以非常惊人的速度增长。在过去的几十年里,研发的射电望远镜在灵敏度、数据的质量以及图像分辨率方面都有很大的提升,望远镜采集数据的速率非常大。SKA作为世界上最大综合孔径射电望远镜,每秒采集的数据量计划大于12Tb,相当于2013年底中国互联网国际出口带宽的3.5倍,相当于谷歌每年数据量的30倍。这样的科学数据处理需要百亿亿次级别的超级计算机来完成,这个处理速度相当于目前全球最快超级计算机天河2号性能的52倍,由于其本身对实时性有严格的要求,所以计算能力方面将面临一个巨大的挑战。就目前来说对计算能力以及处理速度在不断地提高,通过传统的提高CPU主频来提高处理能力上受到集成电路的种种限制,在这种情况下,多核处理器应运而生并逐渐成为主流。目前,新集群采用多核解决面临的计算问题。因此多核的CPU和多核加速器(如GPU、Cell/BE等)成为解决大量时效性数据的趋势。
在天文成像过程中,网格化(Gridding)和去网格化(Degridding)是最耗时的两个操作。如果处理的数据是EB量级或以上时,消耗的时间非常多不能通过调整计算机的性能来缓和。目前来说并行化算法是提高计算速度的一个重要途径,也是射电天文数据处理的主要方式。传统的网格化一般都是在CPU上运行,使得加速器在每一个浮点上的带宽变得很小,应用的时效性降低。
发明内容
本发明针对现有的网格化算法应用时效性低的问题,提出了一种基于CUDA的Gridding算法优化方法及装置。
为了实现上述目的,本发明采用以下技术方案:
一种基于CUDA的Gridding算法优化方法,包括:
步骤1:根据Gridding算法中函数调用次数,得出调用次数最高的前M个函数;
步骤2:通过矩阵矢量化方法,在CUDA中对所述M个函数进行GPU并行化处理。
进一步地,在所述步骤1之后,还包括:
在CUDA中实现基于GPU的Gridding算法,替换ARL算法库中的Gridding算法。
进一步地,所述步骤2包括:
步骤2.1:对需要进行GPU并行化处理的所述M个函数,在显存上分配数组;
步骤2.2:将需处理的数据从内存传输到显存;
步骤2.3:划分块和线程,确定线程结构;
步骤2.4:执行核函数,所述核函数包括初始化GCF函数和GPU下的Gridding算法;
步骤2.5:将执行结果从显存复制回内存。
一种基于CUDA的Gridding算法优化装置,包括:
比较模块,用于根据Gridding算法中函数调用次数,得出调用次数最高的前M个函数;
并行化模块,用于在CUDA中对所述M个函数进行GPU并行化处理。
进一步地,还包括:
替换模块,用于在CUDA中实现基于GPU的Gridding算法,替换ARL算法库中的Gridding算法。
进一步地,所述并行化模块包括:
分配子模块,用于对需要进行GPU并行化处理的所述M个函数,在显存上分配数组;
传输子模块,用于将需处理的数据从内存传输到显存;
划分子模块,用于划分块和线程,确定线程结构;
执行子模块,用于执行核函数,所述核函数包括初始化GCF函数和GPU下的Gridding算法;
复制子模块,用于将执行结果从显存复制回内存。
与现有技术相比,本发明具有的有益效果:
本发明对ARL算法库中的Gridding算法中调用次数多的前M个函数进行基于GPU的并行化,将ARL算法库中Gridding算法整体替换成GPU下的Gridding算法。方案缩短了Gridding算法整体的运算时间,提高了运行效率,且不影响输入输出数据的格式和大小。这一结果为SKA事业的发展提供了极大的改进可能,不仅能节约时间成本,还能减少经济成本。
附图说明
图1为本发明实施例的一种基于CUDA的Gridding算法优化方法的基本流程图;
图2为本发明实施例的一种基于CUDA的Gridding算法优化方法的并行化流程图;
图3为本发明实施例的一种基于CUDA的Gridding算法优化方法的Gridding算法优化前后运行时间对比图;
图4为本发明实施例的一种基于CUDA的Gridding算法优化方法的Degridding算法优化前后运行时间对比图;
图5为本发明实施例的一种基于CUDA的Gridding算法优化装置的结构示意图;
图6为本发明实施例的一种基于CUDA的Gridding算法优化装置的并行化模块结构示意图。
具体实施方式
为使更好的理解本发明,对出现在本实施例中的名词进行解释:
ARL:ARL(Algorithm Reference Library)是基于python的算法参考库,实现了校准和成像算法(https://github.com/SKA-ScienceDataProcessor/algorithm-reference-library SKA)。
下面结合附图和具体的实施例对本发明做进一步的解释说明:
实施例一:
如图1所示,一种基于CUDA的Gridding算法优化方法,包括以下步骤:
步骤S101:根据Gridding算法中函数调用次数,得出调用次数最高的前M个函数;具体地,Gridding算法中可优化的主要函数及其被调用次数如表1所示。
表1 Gridding算法中可优化的主要函数及其被调用次数
由表1可以看出,grdsf函数的被调用次数最高,达到370次,anti_aliasing_calculate(抗混淆函数)被调用185次,convolutional_degrid(卷积解网格函数)被调用47次,convolutional_grid(卷积网格函数)被调用44次,weight_gridding被调用2次,gridder和gridder_numba没有被调用。本实施例中,选择调用次数最高的前3个函数进行优化,分别为:anti_aliasing_calculate,convolutional_degrid,convolutional_grid。虽然grdsf函数被调用次数最高,但是不选择优化它,这是因为它在anti_aliasing_calculate函数中被调用了2次,因此选择优化anti_aliasing_calculate函数,这也就意味着优化了grdsf函数。
其中,各函数功能如下:
grdsf:将获取网格函数以及对网格进行修正,输入到图像边缘的距离,输出网格函数和网格校正函数。
anti_aliasing_calculate:计算prolate(抛物线)球体抗混淆函数。
convolutional_degrid:进行卷积解网格。
convolutional_grid:进行卷积网格。
weight_gridding:重新调整网格权重。
gridder:在给定的位置上的网格,通过使用索引来选择卷积核。
gridder_numba:在给定位置的网格,按照输入数据选择卷积核。
进一步地,在所述步骤S101之后,还包括:
在CUDA中实现基于GPU的Gridding算法,替换ARL算法库中的Gridding算法。
对应的,还包括:
在CUDA中实现基于GPU的Degridding(反网格化)算法,替换ARL算法库中的Degridding算法。
需要注意的是,ARL算法库是用Python语言编写的,Python和CUDA的封装和调用,以及ARL算法库中输入输出数据的接口要保持一致。
步骤S102:通过矩阵矢量化方法,在CUDA中对所述M个函数进行GPU并行化处理。
具体地,所述步骤S102包括:
步骤S1021:对需要进行GPU并行化处理的所述M个函数,在显存上分配数组;
步骤S1022:将需处理的数据从内存传输到显存;
步骤S1023:划分块和线程,确定线程结构;
步骤S1024:执行核函数,所述核函数包括初始化GCF函数和GPU下的Gridding算法;GCF函数为网格修正函数,用来校正由于网格而导致紊乱的图像。
步骤S1025:将执行结果从显存复制回内存。
为验证本发明的效果,进行如下实验:
对需要优化的3个函数(anti_aliasing_calculate,convolutional_degrid,convolutional_grid),分别在多CPU和GPU下进行实现。并在CUDA中分别实现基于多CPU和GPU的Gridding和Degridding算法,替换掉ARL算法库中的算法。
实验环境见表2。
表2实验环境
主机型号 MG50-G20
CPU Intel Xeon E5-2620 V3
GPU NVidia Tesla k80 GPU
内存 816GB DDR4内存;最大支持768GB
操作系统 CentOS 7
对Gridding算法中的3个函数分别基于多CPU、GPU进行优化,其优化结果如表3所示:
表3 Gridding中的3个函数基于多CPU、GPU的运行时间
ARL(python) 多CPU GPU
时间(s) 0.844 0.792 0.775
由表3的实验结果可见,多CPU的方法使性能提高了6.16%,基于GPU的方法使性能提高了8.18%。
再经过整体的并行化处理,ARL算法库中Gridding算法和Degridding算法的运行时间,以及基于CUDA的Gridding算法和Degridding算法的运行时间对比见图3和图4。
从图3和图4可以看出,随着数据量增大(数据量达到1亿以上),优化后的Gridding算法在运算时间上提升6倍以上,对应的Degridding算法在运算时间上提上将近10倍。
实施例二:
如图5所示,一种基于CUDA的Gridding算法优化装置,包括:
比较模块201,用于根据Gridding算法中函数调用次数,得出调用次数最高的前M个函数;
并行化模块202,用于在CUDA中对所述M个函数进行GPU并行化处理。
具体地,还包括:
替换模块203,用于在CUDA中实现基于GPU的Gridding算法,替换ARL算法库中的Gridding算法。
具体地,如图6所示,所述并行化模块202包括:
分配子模块2021,用于对需要进行GPU并行化处理的所述M个函数,在显存上分配数组;
传输子模块2022,用于将需处理的数据从内存传输到显存;
划分子模块2023,用于划分块和线程,确定线程结构;
执行子模块2024,用于执行核函数,所述核函数包括初始化GCF函数和GPU下的Gridding算法;
复制子模块2025,用于将执行结果从显存复制回内存。
以上所示仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。

Claims (6)

1.一种基于CUDA的Gridding算法优化方法,其特征在于,包括:
步骤1:根据Gridding算法中函数调用次数,得出调用次数最高的前M个函数;
步骤2:通过矩阵矢量化方法,在CUDA中对所述M个函数进行GPU并行化处理。
2.根据权利要求1所述的一种基于CUDA的Gridding算法优化方法,其特征在于,在所述步骤1之后,还包括:
在CUDA中实现基于GPU的Gridding算法,替换ARL算法库中的Gridding算法。
3.根据权利要求1所述的一种基于CUDA的Gridding算法优化方法,其特征在于,所述步骤2包括:
步骤2.1:对需要进行GPU并行化处理的所述M个函数,在显存上分配数组;
步骤2.2:将需处理的数据从内存传输到显存;
步骤2.3:划分块和线程,确定线程结构;
步骤2.4:执行核函数,所述核函数包括初始化GCF函数和GPU下的Gridding算法;
步骤2.5:将执行结果从显存复制回内存。
4.一种基于CUDA的Gridding算法优化装置,其特征在于,包括:
比较模块,用于根据Gridding算法中函数调用次数,得出调用次数最高的前M个函数;
并行化模块,用于在CUDA中对所述M个函数进行GPU并行化处理。
5.根据权利要求4所述的一种基于CUDA的Gridding算法优化装置,其特征在于,还包括:
替换模块,用于在CUDA中实现基于GPU的Gridding算法,替换ARL算法库中的Gridding算法。
6.根据权利要求4所述的一种基于CUDA的Gridding算法优化装置,其特征在于,所述并行化模块包括:
分配子模块,用于对需要进行GPU并行化处理的所述M个函数,在显存上分配数组;
传输子模块,用于将需处理的数据从内存传输到显存;
划分子模块,用于划分块和线程,确定线程结构;
执行子模块,用于执行核函数,所述核函数包括初始化GCF函数和GPU下的Gridding算法;
复制子模块,用于将执行结果从显存复制回内存。
CN201910344869.0A 2019-04-26 2019-04-26 一种基于CUDA的Gridding算法优化方法及装置 Pending CN110187962A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910344869.0A CN110187962A (zh) 2019-04-26 2019-04-26 一种基于CUDA的Gridding算法优化方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910344869.0A CN110187962A (zh) 2019-04-26 2019-04-26 一种基于CUDA的Gridding算法优化方法及装置

Publications (1)

Publication Number Publication Date
CN110187962A true CN110187962A (zh) 2019-08-30

Family

ID=67715182

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910344869.0A Pending CN110187962A (zh) 2019-04-26 2019-04-26 一种基于CUDA的Gridding算法优化方法及装置

Country Status (1)

Country Link
CN (1) CN110187962A (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112986944A (zh) * 2021-03-04 2021-06-18 西安电子科技大学 一种基于cuda异构并行加速的雷达mti和mtd实现方法

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635046A (zh) * 2009-08-13 2010-01-27 东软集团股份有限公司 基于统一计算设备架构技术的图像处理方法和装置
CN103038660A (zh) * 2010-03-23 2013-04-10 马克思-普朗克科学促进协会 利用正则非线性反演重建过程对mr图像的序列进行重建的方法和设备
CN104375838A (zh) * 2014-11-27 2015-02-25 浪潮电子信息产业股份有限公司 一种基于OpenMP对天文学软件Gridding的优化方法
US20160104279A1 (en) * 2014-10-10 2016-04-14 Cedars-Sinai Medical Center Method and system for "push-button" comprehensive cardiac mr examination using continuous self-gated 3d radial imaging
CN107064930A (zh) * 2017-03-29 2017-08-18 西安电子科技大学 基于gpu的雷达前视成像方法
CN108874547A (zh) * 2018-06-27 2018-11-23 郑州云海信息技术有限公司 一种天文学软件Gridding的数据处理方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635046A (zh) * 2009-08-13 2010-01-27 东软集团股份有限公司 基于统一计算设备架构技术的图像处理方法和装置
CN103038660A (zh) * 2010-03-23 2013-04-10 马克思-普朗克科学促进协会 利用正则非线性反演重建过程对mr图像的序列进行重建的方法和设备
US20160104279A1 (en) * 2014-10-10 2016-04-14 Cedars-Sinai Medical Center Method and system for "push-button" comprehensive cardiac mr examination using continuous self-gated 3d radial imaging
CN104375838A (zh) * 2014-11-27 2015-02-25 浪潮电子信息产业股份有限公司 一种基于OpenMP对天文学软件Gridding的优化方法
CN107064930A (zh) * 2017-03-29 2017-08-18 西安电子科技大学 基于gpu的雷达前视成像方法
CN108874547A (zh) * 2018-06-27 2018-11-23 郑州云海信息技术有限公司 一种天文学软件Gridding的数据处理方法及装置

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
吴怀广等: "ARL中Gridding算法的并行化实现", 《轻工学报》 *
阮敬: "《Python数据分析基础》", 30 September 2017 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112986944A (zh) * 2021-03-04 2021-06-18 西安电子科技大学 一种基于cuda异构并行加速的雷达mti和mtd实现方法
CN112986944B (zh) * 2021-03-04 2023-09-08 西安电子科技大学 一种基于cuda异构并行加速的雷达mti和mtd实现方法

Similar Documents

Publication Publication Date Title
KR102443546B1 (ko) 행렬 곱셈기
Venkataramani et al. Scaledeep: A scalable compute architecture for learning and evaluating deep networks
US11442785B2 (en) Computation method and product thereof
Vazquez et al. Improving the performance of the sparse matrix vector product with GPUs
Chen et al. A small-footprint accelerator for large-scale neural networks
US9606797B2 (en) Compressing execution cycles for divergent execution in a single instruction multiple data (SIMD) processor
US8364739B2 (en) Sparse matrix-vector multiplication on graphics processor units
WO2019205617A1 (zh) 一种矩阵乘法的计算方法及装置
US11816574B2 (en) Structured pruning for machine learning model
US20200242468A1 (en) Neural network computation device, neural network computation method and related products
WO2021179281A1 (en) Optimizing low precision inference models for deployment of deep neural networks
Barrachina et al. Efficient and portable GEMM-based convolution operators for deep neural network training on multicore processors
CN106484532B (zh) 面向sph流体模拟的gpgpu并行计算方法
CN110187962A (zh) 一种基于CUDA的Gridding算法优化方法及装置
Yang 8 steps to 3.7 tflop/s on nvidia v100 gpu: Roofline analysis and other tricks
CN109447239A (zh) 一种基于arm的嵌入式卷积神经网络加速方法
Braun An evaluation of GPU acceleration for sparse reconstruction
Li et al. Automatic FFT performance tuning on OpenCL GPUs
Barhen et al. High performance FFT on multicore processors
Agrawal et al. A GPU based Real-Time CUDA implementation for obtaining Visual Saliency
US11907118B2 (en) Interleaved data conversion to change data formats
Chu et al. Efficient Algorithm Design of Optimizing SpMV on GPU
Hosseinabady et al. Pipelined streaming computation of histogram in FPGA OpenCL
Yang et al. An energy-efficient implementation of LU factorization on heterogeneous systems
Zhao et al. Comprehensive analysis of the heterogeneous computing performance of DNNs under typical frameworks on cloud and edge computing platforms

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190830