阅读并行使用CUDA多个文本文件 [英] Read multiple text files in parallel using Cuda

查看:208
本文介绍了阅读并行使用CUDA多个文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想搜索的多个文件中的字符串并行使用CUDA。我已计划使用PFAC库搜索给定的字符串。与此问题是如何访问并行的多个文件。

I would like to search for a given string in multiple files in parallel using CUDA. I have planned to use pfac library to search for the given string. The problem with this is how to access multiple files in parallel.

例如:我们有一个包含文件1000的文件夹里面有被搜索

Example: We have a folder containing 1000s of files which has to be searched.

这里的问题是如何我应该访问多个文件中给定的folder.The文件的文件夹中应动态获取与每个线程应被分配一个文件中搜索给定的字符串

The problem here is how should i access multiple files in the given folder.The files in the folder should be dynamically obtained and each thread should be assigned a file to search the given string.

是否有可能????

编辑:

在这篇文章:非常快​​的文本文件处理(C ++)。他使​​用Boost库阅读16 seconds.While在我来说,我要读的较小的文件,1000 3 GB的文本文件

In this post: very fast text file processing (C++) .He is using the boost library to read a 3 GB text file in 16 seconds.While in my case I have to read 1000s of smaller files

感谢您

推荐答案

在CUDA做你的任务将帮助不大了CPU在做同样的事情。

Doing your task in CUDA will not help much over doing the same thing in CPU.

假设你的文件存储在一个标准的,磁性硬盘,典型的单线程CPU程序会消耗:

Assuming that your files are stored on a standard, magnetic HDD, the typical single-threaded CPU program would consume:


  1. 关于5ms的寻找到文件的存储部门,并把它读头下。

  2. 约10ms到1MB的文件(假设100MB / s的读取速度)加载到RAM内存

  3. 小于0.1毫秒,从RAM使用线性搜索算法加载1MB的数据给CPU缓存和处理它。

这是针对单个文件15.1ms。如果你有1000个文件,这将需要15.1s做的工作。

That is 15.1ms for a single file. If you have 1000 files, it will take 15.1s to do the work.

现在,如果我给你超强的GPU与内存无限带宽,无延迟,和无限的处理器速度,你将能够没有时间执行任务(3)。然而,HDD读取仍然会消耗完全相同的时间。 GPU不能parallelise另一个独立设备的工作。
结果,而不是消费15.1s,你会立即在15.0s。

Now, if I give you super-powerful GPU with infinite memory bandwith, no latency, and infinite processor speed, you will be able to perform the task (3) with no time. However, HDD reads will still consume exactly the same time. GPU cannot parallelise the work of another, independent device. As a result, instead of spending 15.1s, you will now do it in 15.0s.

无限GPU会给你一个0.6%的速度提升。一个真正的GPU甚至会无法​​接近!

The infinite GPU would give you a 0.6% speedup. A real GPU would be not even close to that!

在更一般的情况:如果你考虑使用CUDA,问自己:是实际的计算问题的瓶颈。

In more general case: If you consider using CUDA, ask yourself: is the actual computation the bottleneck of the problem?


  • 如果是 - 继续搜索在CUDA世界可能的解决方案

  • 如果没有 - CUDA帮不了你

如果你对付的小文件thousants,你需要进行读取的时候,考虑的技术,可以攻击的瓶颈。有些人可能包括:

If you deal with thousants of tiny files and you need to perform reads often, consider techniques that can "attack" your bottleneck. Some may include:


  • RAM缓冲

  • 把你的硬盘驱动器的RAID配置

  • 获得一个SSD

可能有更多的选择,我不是在这方面的专家。

there may be more options, I am not an expert in that area.

这篇关于阅读并行使用CUDA多个文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆