Changeset 1777


Ignore:
Timestamp:
Dec 13, 2011, 8:22:57 PM (8 years ago)
Author:
vla24
Message:

Fixed hash, ls, stl parser, edge boundary handler was broken

Location:
proto/SymbolTable
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • proto/SymbolTable/build_wcd.sh

    r1741 r1777  
    1 cd src && make wcd && python run_wcd.py ../test/test_files/test_dictionary.txt ../test/test_files/wcd_a_sailor_of_king_george_half.txt && cd ..
     1cd src && make wcd && python run_wcd.py ../test/test_files/test_dictionary.txt ../test/test_files/wcd_a_sailor_of_king_george.txt && cd ..
  • proto/SymbolTable/common_definitions.h

    r1771 r1777  
    88#define SIMD_type BitBlock
    99#define DEBUG 0
    10 #define PRINT_SYMBOL_DISTRIBUTION 1
    11 #define PRINT_DICTIONARY_INFO 0
     10#define PRINT_SYMBOL_DISTRIBUTION 0
     11#define PRINT_DICTIONARY_INFO 1
    1212#define SEGMENT_BLOCKS 12
    1313#define BUFFER_SIZE (BLOCK_SIZE * SEGMENT_BLOCKS)
  • proto/SymbolTable/src/Makefile

    r1722 r1777  
    1111SYMTAB_LIB=../symtab
    1212INCLUDES = -I$(SYMTAB_LIB) -I../lib/ -I../../parabix2/src
    13 PAPI_DIR=/usr/local/papi
     13PAPI_DIR=/usr/local
    1414
    1515ARCH=$(shell getconf LONG_BIT)
     
    3434        $(CC) $(INCLUDES) -o $(WCD_OUTFILE) $(WCD_SRCFILE) $(AFLAGS) -DBUFFER_PROFILING  -DPERF_SCRIPT
    3535
     36buffer_profiling_papi_wcd: $(WCD_SRCFILE)
     37        $(CC) $(INCLUDES) -o $(WCD_OUTFILE) $(WCD_SRCFILE) $(AFLAGS) -DCODE_CLOCKER  -DPERF_SCRIPT -DUSE_XMLWF $(CODE_CLOCKER)
     38
    3639all:
    3740        $(CC) $(INCLUDES) -o $(OUTFILE) $(SRCFILE) $(AFLAGS) -DUSE_XMLWF
     
    5255        $(CC) $(INCLUDES) -o $(OUTFILE) $(SRCFILE) $(AFLAGS) -DBUFFER_PROFILING  -DPERF_SCRIPT -DUSE_XMLWF
    5356
     57buffer_profiling_papi: $(SRCFILE)
     58        $(CC) $(INCLUDES) -o $(OUTFILE) $(SRCFILE) $(AFLAGS) -DCODE_CLOCKER  -DPERF_SCRIPT -DUSE_XMLWF $(CODE_CLOCKER)
     59
    5460asm:  $(SRCFILE)
    5561        $(CC) -o $(OUTFILE).s $(SRCFILE) $(AFLAGS) -S -fverbose-asm
  • proto/SymbolTable/symtab_hash_template.cpp

    r1721 r1777  
    251251      if (chars_avail > BUFFER_SIZE) chars_avail = BUFFER_SIZE;
    252252      buf_pos += chars_avail;
     253      if (!elem_starts_buf.size() == elem_ends_buf.size())
     254      {
     255          int start = elem_starts_buf.front();
     256          start = (start - buffer_base) - BUFFER_SIZE + buf_pos;
     257          elem_starts_buf.pop();
     258          elem_starts_buf.push(start);
     259      }
    253260      buffer_base = buf_pos;
    254261    }
  • proto/SymbolTable/symtab_ls_template.cpp

    r1721 r1777  
    242242      if (chars_avail > BUFFER_SIZE) chars_avail = BUFFER_SIZE;
    243243      buf_pos += chars_avail;
     244      if (!elem_starts_buf.size() == elem_ends_buf.size())
     245      {
     246          int start = elem_starts_buf.front();
     247          start = (start - buffer_base) - BUFFER_SIZE + buf_pos;
     248          elem_starts_buf.pop();
     249          elem_starts_buf.push(start);
     250      }
    244251      buffer_base = buf_pos;
    245252    }
  • proto/SymbolTable/symtab_stl_template.cpp

    r1741 r1777  
    244244      if (chars_avail > BUFFER_SIZE) chars_avail = BUFFER_SIZE;
    245245      buf_pos += chars_avail;
     246      if (!elem_starts_buf.size() == elem_ends_buf.size())
     247      {
     248          int start = elem_starts_buf.front();
     249          start = (start - buffer_base) - BUFFER_SIZE + buf_pos;
     250          elem_starts_buf.pop();
     251          elem_starts_buf.push(start);
     252      }
    246253      buffer_base = buf_pos;
    247254    }
  • proto/SymbolTable/wcd_common_functions.h

    r1722 r1777  
    4646{
    4747#if PRINT_DICTIONARY_INFO
    48     printf ("%i known words, %i unknown words\n",totalKnownWordsInDictionary, totalUnknownWordsInDictionary);
     48    fprintf (stderr, "%i known words, %i unknown words\n",totalKnownWordsInDictionary, totalUnknownWordsInDictionary);
    4949#endif
    5050}
  • proto/SymbolTable/wcd_hash_template.cpp

    r1741 r1777  
    6161    printWordCountInDictionary(totalUnknownWordsInDictionary, totalKnownWordsInDictionary);
    6262
     63
     64#if PRINT_SYMBOL_DISTRIBUTION
     65    print_GIDS(gids);
     66#endif
    6367    fclose(dictionaryfile);
    6468    fclose(infile);
    6569    fclose(outfile);
    66 
    67 #if PRINT_SYMBOL_DISTRIBUTION
    68     print_GIDS(gids);
    69 #endif
    7070
    7171    return(0);
     
    189189      if (chars_avail > BUFFER_SIZE) chars_avail = BUFFER_SIZE;
    190190      buf_pos += chars_avail;
     191      if (!elem_starts_buf.size() == elem_ends_buf.size())
     192      {
     193          int start = elem_starts_buf.front();
     194          start = (start - buffer_base) - BUFFER_SIZE + buf_pos;
     195          elem_starts_buf.pop();
     196          elem_starts_buf.push(start);
     197      }
    191198      buffer_base = buf_pos;
    192199    }
  • proto/SymbolTable/wcd_stl_template.cpp

    r1741 r1777  
    7272
    7373static inline int ElemStrt_check(int pos) {
     74//    printf("start: %i | start_pos: %i | buffer_base: %i | block_base: %i\n", buffer_base+ pos, pos, buffer_base, block_base);
    7475        elem_starts_buf.push(buffer_base + pos);
    7576        return 0;
     
    7778
    7879static inline int ElemEnd_check(int pos) {
     80//    printf("end: %i | end_pos: %i | buffer_base: %i | block_base: %i\n", buffer_base+ pos, pos, buffer_base, block_base);
    7981        elem_ends_buf.push(buffer_base + pos);
    8082        return 0;
     
    8789        int start = elem_starts_buf.front();
    8890        int end = elem_ends_buf.front();
     91//      printf ( "start %i\n", start);
     92//      printf ( "end   %i\n", end);
    8993        elem_starts_buf.pop();
    9094        elem_ends_buf.pop();
    9195        int length = end - start;
    92 
     96//      printf ( "length %i\n", length);
     97
     98//      if (length < 1)
     99//      {
     100//          printf ("NEGATIVE length %i\n", length);
     101//          continue;
     102//      }
    93103        //lookup or insert to symbol table
    94104#if DEBUG
     
    96106        strncpy ( symbol, source + start - buffer_base, length );
    97107        symbol[length] ='\0';
    98         printf ("start: %i[%i] | end: %i[%i] | length: %i | symbol: %s\n", start, start-buffer_base, end, end-buffer_base, length, symbol );
     108        printf ( "start: %i[%i] | end: %i[%i] | length: %i | symbol: %s\n", start, start-buffer_base, end, end-buffer_base, length, symbol );
    99109
    100110        delete symbol; symbol = 0;
     
    121131
    122132    do_symbol_table_lookup();
     133//    printf("END DO BLOCK\n");
    123134}
    124135
     
    188199      if (chars_avail > BUFFER_SIZE) chars_avail = BUFFER_SIZE;
    189200      buf_pos += chars_avail;
     201//      printf("ADVANCE BUFFER BASE | boundary: %i | buffer_base: %i | buf_pos: %i | buffer_base <- buf_pos\n", !elem_starts_buf.size() == elem_ends_buf.size(), buffer_base, buf_pos);
     202      if (!elem_starts_buf.size() == elem_ends_buf.size())
     203      {
     204          int start = elem_starts_buf.front();
     205          start = (start - buffer_base) - BUFFER_SIZE + buf_pos;
     206          elem_starts_buf.pop();
     207          elem_starts_buf.push(start);
     208//        printf ("BOUNDARY\n");
     209      }
    190210      buffer_base = buf_pos;
    191211    }
     
    216236    buf_pos += chars_avail;
    217237    buffer_base = buf_pos;
     238//    printf("ADVANCE BUFFER BASE\n");
    218239
    219240    if (allow_performance_check)
Note: See TracChangeset for help on using the changeset viewer.