GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Categories
  • Newsletter
  • Submit
  • Login
  • Awesome C++
  • CSV

This view

  • Original page
  • New address

GeezerVison is showing cpp.libhunt.com — nvParse Alternatives - C++ CSV | LibHunt

  • Subscribe
  • Submit
  • Categories
  • About
  • Login

nvParse

Fast, gpu-based CSV parser

antonmks logo
Source Code    Changelog
Suggest Changes
Take the C++ Developer Survey - About 6 minutes on the tools, libraries and AI you use with C++. You get the results by email. Take the survey »
Popularity
4.0
Stable
Activity
0.0
Stable
Stars 564
Watchers 23
Forks 27
Last Commit almost 10 years ago

Description

Parsing delimiter-separated files is a common task in data processing. The regular way of extracting the columns from a text file is to use strtok function.

Programming language: Cuda
License: Apache License 2.0
Tags: Parsing     CSV     Parser     CSV Parser     GPU    

nvParse alternatives and similar libraries

Based on the "CSV" category.
Alternatively, view nvParse alternatives based on common mentions on social networks and blogs.

  • Fast C++ CSV Parser

    7.0 2.9 nvParse VS Fast C++ CSV Parser
    fast-cpp-csv-parser
    ben-strasser logo
  • Vince's CSV Parser

    5.6 8.8 nvParse VS Vince's CSV Parser
    A modern C++ CSV parser and serializer that doesn't make you choose between ease of use or performance.
    vincentlaucsb logo
  • SaaSHub - Software Alternatives and Reviews

    SaaSHub helps you find the best software and product alternatives
    Promo www.saashub.com
    SaaSHub Logo
  • Rapidcsv

    5.5 6.1 nvParse VS Rapidcsv
    C++ CSV parser library
    d99kris logo
  • csv

    3.3 2.5 nvParse VS csv
    DISCONTINUED. CSV for Modern C++
  • lazycsv

    2.4 5.1 nvParse VS lazycsv
    A fast, lightweight and single-header C++ csv parser library
    ashtum logo
  • CSV Parser for C++ by TG

    0.9 8.0 nvParse VS CSV Parser for C++ by TG
    A C++ library for parsing, reading CSV files that supports mixed data types, customizable delimiters, and efficient data manipulation. Perfect for data processing, analysis, and integration into larger C++ projects.
    TejasvaGupta05 logo

Do you think we are missing an alternative of nvParse or a related project?

Add another 'CSV' Library

Popular Comparisons

  • nvParse
    vs
    Fast C++ CSV Parser
  • nvParse
    vs
    csv
  • nvParse
    vs
    Vince's CSV Parser
  • nvParse
    vs
    Rapidcsv
  • nvParse
    vs
    lazycsv

README

nvParse

Parsing CSV files with GPU

Parsing delimiter-separated files is a common task in data processing. The regular way of extracting the columns from a text file is to use strtok function :

char * p = strtok(line, "|");
while (p != NULL)
{
    printf ("%s\n",p);
    p = strtok (NULL, "|");
}

However this method of parsing is CPU bound because

  • it doesn't take advantage of multiple cores of modern CPUs.

  • memory bandwidth limitations

This is how the same task can be done using a GPU :

auto break_cnt = thrust::count(d_readbuff.begin(), d_readbuff.end(), '\n');
thrust::device_vector<int> dev_pos(break_cnt);
thrust::copy_if(thrust::make_counting_iterator(0),
                thrust::make_counting_iterator(bytes_read-1),
                d_readbuff.begin(), dev_pos.begin(), _1 == '\n');

The first line counts the number of lines in a buffer (assuming that file is read into memory and copied to gpu buffer d_readbuff). The second line creates a vector in gpu memory that will hold the positions of new line characters. The last line compares the characters in a buffer to new line character and, if a match is found, copies the position of the character to dev_pos vector.

Now that we know the starting positions of every line in a buffer, we can launch a gpu procedure that will parse the lines using several thousands gpu cores :

thrust::counting_iterator<unsigned int> begin(0);
parse_functor ff(...); // examples of call's parameters are in test.cu file
thrust::for_each(begin, begin + break_cnt, ff);

As a result we get the needed columns in separate arrays in gpu memory and can copy them to host memory. Or convert them to binary values using relevant gpu procedures :

gpu_atoll atoll_ff(...);
thrust::for_each(begin, begin + break_cnt, atoll_ff);

Benchmarks !

Hardware : PC with one Intel i3-4130, 16GB of RAM, one 2TB hard drive and GTX Titan

File : 750MB lineitem.tbl text file (6001215 lines)

Parsing 1 field using CPU :

$ time cut -d "|" -f 6 lineitem.tbl > /dev/null

real 0m28.764s

Parsing 11 fields using hand-written program with strtok : (no threads, no memory-mapped file)

14.5s

Parsing 11 fields using GPU :

$ time ./test

0.77s

And the actual gpu parsing part is done in just 0.25 seconds.

P.S. Thanks to Nicolas Guillemot for suggestion on memory-mapping files.

Do not miss the trending, libraries, news and articles with our weekly report.

Awesome C++ is part of the LibHunt network. Terms. Privacy Policy.

(CC)
BY-SA
Spin The Wheel Of Names for a cryptographically secure random name picker.
Schedule a when to meet poll.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.