摘要本文主要研究干涉光谱复原的原理和算法,重点研究FFT算法在GPU上的实现过程和软件实现方法,为仪器软件的编制提供技术支撑。
本课题要解决的问题是用FFT算法进行光谱复原并且能够在GPU上实现,分析结果。光谱复原[1]包括四个步骤,分别是去直流、切趾、相位校正和FFT,其核心就是FFT算法。将核心算法FFT分别用OpenCL和C语言在GPU和CPU上运行,输出各自的运行时间。通过修改FFT算法的执行次数,发现GPU在浮点运算中的巨大优越性,其运算速度远大于CPU。
对FFT算法的执行次数少的时候,程序在GPU和CPU上运行时间差不多,甚至GPU的运行时间比CPU的运行时间更长;随着对FFT算法的执行次数的增长,程序在GPU和CPU上的运行时间也在增长,但CPU运行时间的增长速度远远大于GPU运行时间的增长速度。这就表明,运算越繁琐,在CPU上运行时间和在GPU上运行时间的比值越大,越能体现GPU的强大运算能力。由此得出结论:复杂繁琐的浮点运算更适合在GPU而非CPU上运行。28222
关键词 光谱复原 FFT算法 GPU CPU 毕业论文设计说明书外文摘要
Title The Study on Hyperspectral Restoration Algorithms Based on the GPU
Abstract
This paper studies the principles and algorithms of spectrum reconstruction, focusing on the process of FFT algorithm implementing on GPU and the methods of software implementation, which provides technical support for the preparation of the instrument software.
The task is to reconstruct spectrum with FFT, implement FFT on the GPU and analyse the results. Spectrum Reconstruction consists of four steps, including DC removal, apodization, phase correction and FFT. The core of the process is FFT algorithm. The FFT core algorithms were run on GPU and CPU with OpenCL and Visual C respectively, outputting the running time. By modifying the times of executions of FFT algorithm, the great advantages in floating-point operations of GPU were showed and its operation is much faster than CPU.
With a small number of execution times, the running time on GPU and CPU is similar, and the former is even longer than the latter. With the increasing of execution times, the running time on GPU and CPU is growing, but the growth speed of the running time on CPU is far greater than that on GPU. This indicates that the more complicated the operation is, the greater the ratio of running time on CPU and that on GPU is, which indicates the powerful computing capability of GPU better. In conclusion, it is more suitable to run the complex floating-point operation on the GPU rather than the CPU.
Keywords spectrum reconstruction FFT GPU CPU
目 次
1 引言 1
1.1 课题背景和意义 1
1.2 GPU和OpenCL 2
1.3 论文主要工作 … 2
1.4 本章小结 … 3
2 高光谱复原算法的基本原理 … 4
2.1 傅里叶变换的光谱学原理 4
2.2 干涉条纹的数据处理步骤 5
2.3 本章小结 11
3 FFT算法在GPU上的实现 13
3.1 FFT核心函数 … 13
3.2 双缓冲 … 14
3.3 主函数 … 15
3.4 本章小结 16
4 实验及结果分析 17
4.1 实验结果 17
4.2 GPU和CPU的差异 21
4.3 本章小结 22
结论 … 23
致谢 … 24
参考文献 … 25
附录A FFT算法在GPU上的实现程序(OpenCL) … 27
附录B FFT算法在CPU上的实现程序(C语言) … 36