changeset 311:cac5b3465318

Added sequencehop on Indexing to optionally reduce size of large indexes. Added cleanup() call on WS query exit to fix MMAP memory leak
author mas01mc
date Sat, 09 Aug 2008 15:04:16 +0000
parents 435ffdaecae9
children 00cb98315f8c
files audioDB.cpp gengetopt.in index.cpp
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.cpp	Fri Aug 08 14:01:33 2008 +0000
+++ b/audioDB.cpp	Sat Aug 09 15:04:16 2008 +0000
@@ -88,6 +88,7 @@
     processArgs(argc, argv);
     assert(O2_ACTION(COM_QUERY));
     query(dbName, inFile, adbQueryResponse);
+    cleanup();
   } catch(char *err) {
     cleanup();
     throw(err);
@@ -101,6 +102,7 @@
     processArgs(argc, argv);
     assert(O2_ACTION(COM_STATUS));
     status(dbName, adbStatusResponse);
+    cleanup();
   } catch(char *err) {
     cleanup();
     throw(err);
--- a/gengetopt.in	Fri Aug 08 14:01:33 2008 +0000
+++ b/gengetopt.in	Sat Aug 09 15:04:16 2008 +0000
@@ -56,7 +56,7 @@
 option "rotate"       o "rotate query vectors for rotationally invariant search." flag off optional hidden
 option "resultlength" r "maximum length of the result list." int typestr="length" default="10" optional
 option "sequencelength" l "length of sequences for sequence search." int typestr="length" default="16" optional
-option "sequencehop"  h "hop size of sequence window for sequence search." int typestr="hop" default="1" dependon="QUERY" optional
+option "sequencehop"  h "hop size of sequence window for sequence search." int typestr="hop" default="1" optional
 option "absolute-threshold" - "absolute power threshold for consideration of query or target sequence (in Bels)" double optional
 option "relative-threshold" - "relative power threshold between query and target sequence (in Bels)" double dependon="QUERY" optional
 
--- a/index.cpp	Fri Aug 08 14:01:33 2008 +0000
+++ b/index.cpp	Sat Aug 09 15:04:16 2008 +0000
@@ -285,9 +285,11 @@
 Uns32T audioDB::index_insert_shingles(vector<vector<float> >* vv, Uns32T trackID, double* spp){
   Uns32T collisionCount = 0;
   cout << "[" << trackID << "]" << fileTable+trackID*O2_FILETABLE_ENTRY_SIZE;
-  for( Uns32T pointID=0 ; pointID < (*vv).size(); pointID++)
-    if(!use_absolute_threshold || (use_absolute_threshold && (*spp++ >= absolute_threshold)))
+  for( Uns32T pointID=0 ; pointID < (*vv).size(); pointID+=sequenceHop)
+    if(!use_absolute_threshold || (use_absolute_threshold && (*spp >= absolute_threshold))){
       collisionCount += lsh->insert_point((*vv)[pointID], index_from_trackInfo(trackID, pointID));
+      spp+=sequenceHop;
+    }
   return collisionCount;
 }
 
@@ -381,7 +383,7 @@
   lsh = index_allocate(indexName, false); // Get the header only here
   sequenceLength = lsh->get_lshHeader()->dataDim / dbH->dim; // shingleDim / vectorDim
   
-  if(!SERVER_LSH_INDEX_SINGLETON){  
+  if(lsh!=SERVER_LSH_INDEX_SINGLETON){  
     if( fabs(radius - lsh->get_radius())>fabs(O2_DISTANCE_TOLERANCE))
       printf("*** Warning: adb_radius (%f) != lsh_radius (%f) ***\n", radius, lsh->get_radius());
     printf("INDEX: dim %d\n", dbH->dim);