Ignore:
Timestamp:
Mar 31, 2017, 3:05:41 PM (2 years ago)
Author:
nmedfort
Message:

Replaced stdin input stream with mmap'ed buffer and aligned each read call to the page size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5380 r5386  
    3636
    3737#include <llvm/Support/raw_ostream.h>
     38#include <sys/stat.h>
     39
    3840
    3941#ifdef CUDA_ENABLED
     
    302304        byteStream = new ExternalFileBuffer(iBuilder, iBuilder->getStreamSetTy(1, 8));
    303305        cast<ExternalFileBuffer>(byteStream)->setStreamSetBuffer(inputStream);
    304         sourceK = new kernel::MMapSourceKernel(iBuilder, segmentSize);
     306        sourceK = new kernel::MMapSourceKernel(iBuilder, segmentSize * bufferSegments);
    305307        sourceK->generateKernel({}, {byteStream});
    306308        sourceK->setInitialArguments({fileSize});
     
    483485    kernel::KernelBuilder * sourceK = nullptr;
    484486    if (usingStdIn) {
     487        // TODO: use fstat(STDIN_FILENO) to see if we can mmap the stdin safely and avoid the calls to read
     488
    485489        byteStream = new ExtensibleBuffer(iBuilder, iBuilder->getStreamSetTy(1, 8), segmentSize * bufferSegments);
    486490        cast<ExtensibleBuffer>(byteStream)->allocateBuffer();
     
    633637template<typename CodeUnit>
    634638void wrapped_report_match(const size_t lineNum, size_t line_start, size_t line_end, const CodeUnit * const buffer, const size_t filesize, const int fileIdx) {
    635 
    636  //   errs() << lineNum << " : (" << line_start << ", " << line_end << ") -- " << filesize << "\n";
    637 
    638639    assert (buffer);
    639640    assert (line_start <= line_end);
Note: See TracChangeset for help on using the changeset viewer.