Changeset 5584


Ignore:
Timestamp:
Jul 31, 2017, 11:51:16 AM (3 months ago)
Author:
lindanl
Message:

More fixes for editd.

File:
1 edited

Legend:

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

    r5583 r5584  
    2828#include <fcntl.h>
    2929#include <mutex>
     30#include <boost/uuid/sha1.hpp>
    3031
    3132#include <toolchain/NVPTXDriver.h>
     
    4546
    4647static cl::opt<int> editDistance("edit-dist", cl::desc("Edit Distance Value"), cl::init(2));
    47 static cl::opt<int> optPosition("opt-pos", cl::desc("Optimize position"), cl::init(8));
     48static cl::opt<int> optPosition("opt-pos", cl::desc("Optimize position"), cl::init(0));
    4849static cl::opt<int> stepSize("step-size", cl::desc("Step Size"), cl::init(3));
    4950static cl::opt<int> prefixLen("prefix", cl::desc("Prefix length"), cl::init(3));
     
    6970std::vector<std::vector<std::string>> pattGroups;
    7071
    71 void run_second_filter(int total_len, int pattern_segs, float errRate){
     72void run_second_filter(int pattern_segs, int total_len, float errRate){
    7273
    7374    if(matchList.empty()) return;
     
    164165}
    165166
     167inline static std::string sha1sum(const std::string & str) {
     168    char buffer[41];    // 40 hex-digits and the terminating null
     169    uint32_t digest[5]; // 160 bits in total
     170    boost::uuids::detail::sha1 sha1;
     171    sha1.process_bytes(str.c_str(), str.size());
     172    sha1.get_digest(digest);
     173    snprintf(buffer, sizeof(buffer), "%.8x%.8x%.8x%.8x%.8x",
     174             digest[0], digest[1], digest[2], digest[3], digest[4]);
     175    return std::string(buffer);
     176}
    166177
    167178std::string createName(const std::vector<std::string> & patterns) {
     
    184195
    185196PatternKernel::PatternKernel(const std::unique_ptr<kernel::KernelBuilder> & b, const std::vector<std::string> & patterns)
    186 : PabloKernel(b, createName(patterns), {{b->getStreamSetTy(4), "pat"}}, {{b->getStreamSetTy(editDistance + 1), "E"}})
     197: PabloKernel(b, sha1sum(createName(patterns)), {{b->getStreamSetTy(4), "pat"}}, {{b->getStreamSetTy(editDistance + 1), "E"}})
    187198, mPatterns(patterns) { 
    188199}
     
    201212    basisBits[3] = entry.createExtract(pat, 3, "G");
    202213    re::Pattern_Compiler pattern_compiler(*this);
     214    if (optPosition == 0) optPosition = editDistance + 6;
    203215    pattern_compiler.compile(mPatterns, entry, basisBits, editDistance, optPosition, stepSize);
    204216}
Note: See TracChangeset for help on using the changeset viewer.