Live data from Hacker News

Show HN: Parsing CSV files with GPU

github.com

11–20 of 63 posts

Re: Show HN: Parsing CSV files with GPU

#12

For file sizes where parsing speed really makes a difference, loading the entire file into memory doesn't seem feasible. Maybe some sort of a hybrid approach (load chunks into memory and parse them via the GPU) would provide some real benefits though.

I think there's a utility that does something similar (windows based, assuming it's available elsewhere), I remember it having a "crass" name, you'd think it would make it easier to remember, maybe F.U.C.K.?

Re: Show HN: Parsing CSV files with GPU

#13

I don't think CPU and GPU is going to make much difference here. You speed up in GPU run could be because of hot cache of file system. Try running GPU run first and non-GPU after that and plz post the results.

I used average time for multiple runs, both GPU and CPU benchmarks ran from memory.

Re: Show HN: Parsing CSV files with GPU

#14
I'm skeptical of the 8x speedup for several reasons, the main one being that this particular problem does not fit the paradigm of problems that work well on the GPU; the GPU cache is not used at all, and there are also many branches. You need to be able to use the cache of the GPU in your application, otherwise your performance is guaranteed to be memory-bound. The reason you want to avoid branches is that there is only one control unit per a number of cores on the GPU, which means that if some threads follow one branch they will have to stall until the other threads complete. Generally the only code that maps well to the GPU is that which contains large for loops and has good spacial locality (e.g. matrix multiplication).

The author is comparing a GPU to a CPU, yet the CPU is only running a single thread (supposedly, the author did not provide the CPU code used in the comparison). For a true comparison the full capability of the CPU should be exposed by means of a multithreaded application (and, as someone else has already mentioned, vector instructions such as SSE). Think performance per socket, not performance per thread.

Re: Show HN: Parsing CSV files with GPU

#15
post #5
post #3

Earlier quoted context omitted.

Yes, CPU version can be accelerated as well, depending on availability of SSE extensions.

Shouldn't that be the default assumption? It's pretty rare to not have SSE.

On X86_64 it's impossible not to have SSE. So unless you develop for 32bit X86 systems you can assume the availability of vector instructions.

Re: Show HN: Parsing CSV files with GPU

#16
post #5
post #3

Earlier quoted context omitted.

Yes, CPU version can be accelerated as well, depending on availability of SSE extensions.

Shouldn't that be the default assumption? It's pretty rare to not have SSE.

SSE is probably more common than a $1000 GPU.

Re: Show HN: Parsing CSV files with GPU

#17

I'm skeptical of the 8x speedup for several reasons, the main one being that this particular problem does not fit the paradigm of problems that work well on the GPU; the GPU cache is not used at all, and there are also many branches. You need to be able to use the cache of the GPU in your application, otherwise your performance is guaranteed to be memory-bound. The reason you want to avoid branches is that there is o…

> Generally the only code that maps well to the GPU is that which contains large for loops and has good spacial locality (e.g. matrix multiplication).

You also need high arithmetic intensity (the ratio of arithmetic/logical operations to memory loads). Of common CPU-bound tasks, CSV parsing has one of the lowest arithmetic intensities imaginable.

Re: Show HN: Parsing CSV files with GPU

#19

I'm skeptical of the 8x speedup for several reasons, the main one being that this particular problem does not fit the paradigm of problems that work well on the GPU; the GPU cache is not used at all, and there are also many branches. You need to be able to use the cache of the GPU in your application, otherwise your performance is guaranteed to be memory-bound. The reason you want to avoid branches is that there is o…

You hit the nail on the head. All of that on top of the fact that he is comparing a top of the line GPU against a mediocre i3 processor. GPU to CPU comparisons are always apples to oranges, but this is pretty bad.

I would like to see an OpenCL kernel that is run on both the GPU and CPU to possibly even the playing field a little.

Re: Show HN: Parsing CSV files with GPU

#20

I'm skeptical of the 8x speedup for several reasons, the main one being that this particular problem does not fit the paradigm of problems that work well on the GPU; the GPU cache is not used at all, and there are also many branches. You need to be able to use the cache of the GPU in your application, otherwise your performance is guaranteed to be memory-bound. The reason you want to avoid branches is that there is o…

> I'm skeptical of the 8x speedup for several reasons [...] yet the CPU is only running a single thread

That's why I'm not skeptical at all. A GPU program can operate over THOUSANDS many more data items in parallel than a single-threaded scalar CPU program can. Yet the speedup is not thousands, not even hundreds, but a mere 8.

Fits perfectly with

> main one being that this particular problem does not fit the paradigm of problems that work well on the GPU

Post reply on HN