gpu并行计算 数据并行_并行计算使用GPU升级您的数据科学

本文探讨了如何利用GPU进行并行计算来增强数据科学项目的效果。通过GPU并行处理,可以显著提高大数据分析和人工智能任务的运算速度。
摘要由CSDN通过智能技术生成

gpu并行计算 数据并行

<Code for this article can be found here>

<本文的代码可以在 这里 找到 >

Are GPUs faster than CPUs? It’s a very loaded question, but the short answer is no, not always. In fact, for most general purpose computing, a CPU performs much better than a GPU. That’s because CPUs are designed with fewer processor cores that have higher clock speeds than the ones found on GPUs, allowing them to complete series of tasks very quickly. GPUs, on the other hand, have much greater number of cores and are designed for a different purpose. At inception, GPU was originally designed to accelerate the performance of graphics rendering. It did so by allowing the CPU to offload burdensome calculations and free up processing power. GPUs render images more quickly than a CPU because of its parallel processing architecture, which allows it to perform multiple calculations across streams of data simultaneously. The CPU is the brain of the operation, responsible for giving instructions to the rest of the system, including the GPU(s). Today, with the help of additional software, GPUs’ capabilities have expanded to significantly reduce the time it takes to complete certain types of computations required at the different stages of Data Science. It’s important to highlight that GPUs do not replace CPUs but rather act as a co-processors to accelerate scientific and engineering computing.

GPU是否比CPU快? 这是一个非常棘手的问题,但简短的答案不是,并非总是如此。 实际上,对于大多数通用计算,CPU的性能要比GPU好得多。 这是因为CPU设计的处理器内核数量较少时钟速度高于GPU上的时钟速度 ,从而使它们能够快速完成一系列任务。 另一方面,GPU具有更多的内核,并且是为不同目的而设计的。 最初,GPU最初旨在加速图形渲染的性能。 它通过允许CPU卸载繁重的计算并释放处理能力来做到这一点。 由于GPU的并行处理体系结构 ,因此GPU可以比CPU更快地渲染图像,这使得它可以跨数据流同时执行多个计算。 CPU是操作的大脑,负责向系统的其余部分(包括GPU)发出指令。 如今,借助附加软件,GPU的功能已得到扩展,以显着减少完成数据科学不同阶段所需的某些类型的计算所需的时间。 需要强调的是,GPU不能代替CPU,而可以充当协处理器以加速科学和工程计算。

CPU和GPU处理之间的比较: (Comparison between CPU and GPU processing:)

Image for post
GPU vs. CPU
GPU与CPU

*If you’d like to see a fun illustration, here’s a video from 2009

*如果您想看一个有趣的插图,这是 2009年 视频

用于数据科学的GPU并行处理 (GPU Parallel Processing for Data Science)

GPUs offer significant speed boost at a time when CPU performance increase has slowed down over the past few years (and sadly breaking Moore’s Law). Thus, it’s expected that the adoption to GPU computing will increase in the coming years. This feature is important in the field of Data Science, which involves processing very large datasets (in the form of matrices/vectors) efficiently. The SIMD design, or Single Instruction/Multiple Data, means that GPU computing can process multiple data with a single instruction, as is the case for matrix multiplication. As an example, Deep Learning can take advantage of parallel computing to reduce time spent in the training cycle since many of the convolution operations are repetitive. In fact, many of the steps in the Data Science workflow can be processed through the GPU (e.g. data preprocessing, feature engineering, and visualization), but they do require additional functions to implement. Since traditional computer programming isn’t written for parallel processing, they need to be converted to be GPU-enabled. GPU manufacturers are very keen on providing software support for developers to accelerate adoption.

在过去几年中,CPU性能的增长速度有所下降(并且令人沮丧地违反了摩尔定律 ),因此GPU可以显着提高速度。 因此,预计在未来几年中,将越来越多地采用GPU计算。 此功能在数据科学领域非常重要,该领域涉及有效处理非常大的数据集(以矩阵/矢量的形式)。 SIMD设计或单指令/多数据 ,意味着GPU计算可以用一条指令处理多个数据,就像矩阵乘法一样 。 例如,由于许多卷积运算是重复性的 ,因此深度学习可以利用并行计算来减少训练周期所花费的时间。 实际上,可以通过GPU处理数据科学工作流程中的许多步骤(例如,数据预处理,特征工程和可视化),但是它们确实需要实现其他功能。 由于传统的计算机编程不是为并行处理编写的,因此需要将它们转换为支持GPU的格式 。 GPU制造商非常热衷于为开发人员提供软件支持 ,以加快采用速度。

量化收益 (Quantifying the Gains)

To illustrate the impact GPU computing can have for Deep Learning purposes, I retrained the CIFAR-10 Object Recognition Model (from TensorFlow) with and without a GPU. The CIFAR-10 CNN Model is commonly used for benchmarking purposes. It’s trained with 60,000 32x32 color images through a 14 layers-CNN model, to give some perspective on the computation intensity. Since my primary focus is on computation speed, my comparison metric are examples per second and the total training time. The results show a 27X improvement when trained with a GPU.

为了说明GPU计算对深度学习的影响,我重新训练了带有和不带有GPU的CIFAR-10对象识别模型 (来自TensorFlow)。 CIFAR-10 CNN模型通常用于基准测试。 通过14层CNN模型对60,000张32x32彩色图像进行了训练,以提供有关计算强度的一些观点。 由于我的主要重点是计算速度,因此我的比较指标是每秒示例数总的训练时间 。 结果显示,使用GPU训练后,性能提高了27倍

Image for post
CIFAR-10 trained with NVIDIA RTX 2080 Ti GPU (CUDA 10.0) CIFAR-10经过NVIDIA RTX 2080 Ti GPU(CUDA 10.0)培训

GPU enables an extraordinary high throughput, cutting the training time down significantly. This translates directly to a lower cost in terms of both time and energy. The time savings could mean more iterations in the model development cycle for optimization (i.e. for Model Selection and Feature Tuning).

GPU可实现非凡的高吞吐量,从而大大减少了培训时间。 这直接转化为较低的时间和精力成本 。 节省时间可能意味着在模型开发周期中需要进行更多迭代以进行优化(例如,进行模型选择功能调整 )。

但是还有更多—云上的GPU (But There is More — GPU on the Cloud)

GPUs cloud computing has been made available on major cloud platforms such as Microsoft Azure, AWS, and Google Cloud on-demand. Though it isn’t always as fast as a state-of-the-art GPU Workstation. It provides accessibility and convenience, removing the need to invest in expensive hardware and maintenance.

GPU云计算已按需在主要的云平台上可用,例如Microsoft Azure,AWS和Google Cloud。 尽管它并不总是与最新的GPU工作站一样快。 它提供了可访问性和便利性,从而消除了对昂贵的硬件和维护进行投资的需要。

摘要 (Summary)

GPUs play a critical role in the field of Data Science. Due to the nature of their parallel architecture, they can quickly perform calculations on streams of data simultaneously, solving one of the toughest challenges for Artificial Intelligence and Machine Learning. Now is the time to get familiar with GPU computing — through the cloud or on your local machine.

GPU在数据科学领域起着至关重要的作用。 由于其并行架构的本质,他们可以同时快速地对数据流执行计算,从而解决了人工智能和机器学习最艰巨的挑战之一。 现在是时候通过云或本地计算机来熟悉GPU计算了。

翻译自: https://towardsdatascience.com/parallel-computing-upgrade-your-data-science-with-a-gpu-bba1cc007c24

gpu并行计算 数据并行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值