Skip to content

Commit

Permalink
some small typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianshu Zhao committed Jan 15, 2025
1 parent cf813f0 commit d9c3234
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
16 changes: 9 additions & 7 deletions src/adas-insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ fn main() {
info!("Calling sketch_compressedkmer for OptDensHashSketch::<Kmer32bit, f64>");
let sketcher = Sketcher::new(&sketch_params);

println!("Loading HNSW index...");
// Load the HNSW index
let hnsw_res = hnswio.load_hnsw::<
<OptDensHashSketch<Kmer, f64> as SeqSketcherT<Kmer32bit>>::Sig,
Expand All @@ -175,17 +176,16 @@ fn main() {
);
}
};
println!("HNSW index loaded...");

println!("Sketching...");
// Set the number of threads globally using Rayon
rayon::ThreadPoolBuilder::new()
.num_threads(num_threads)
.build_global()
.unwrap();

// -------------------------------------------------
// 1) Create Crossbeam's unbounded channel.
// Producer will feed (seq_id, seq_seq) pairs.
use crossbeam::channel::unbounded;

let (tx, rx): (Sender<(Vec<u8>, Vec<u8>)>, Receiver<(Vec<u8>, Vec<u8>)>) = unbounded();

// 2) Producer thread: reads FASTA -> sends to channel
Expand Down Expand Up @@ -256,8 +256,7 @@ fn main() {
for handle in consumer_handles {
handle.join().expect("Consumer thread panicked");
}

println!("Inserting into HNSW index...");


// 6) Retrieve collected signatures & itemv
let signatures = Arc::try_unwrap(signatures)
Expand All @@ -272,6 +271,9 @@ fn main() {
}
};

println!("Sketching done.");

println!("Inserting into HNSW index...");
// 7) Create data as Vec<(&Vec<f64>, usize)> for HNSW insertion
let data: Vec<(&Vec<f64>, usize)> = signatures
.iter()
Expand All @@ -293,5 +295,5 @@ fn main() {

let _ = dumpall(dump_path_ref, &hnsw, &seqdict, &processing_params);

println!("HNSW index inserted successfully \n");
println!("Inserting inton HNSW index done. \n");
}
10 changes: 7 additions & 3 deletions src/adas-search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ fn main() {
);
};

println!("Sketching...");

// Load sketching parameters
let sketch_params = processing_params.get_sketching_params();

Expand All @@ -161,6 +161,7 @@ fn main() {
info!("Calling sketch_compressedkmer for OptDensHashSketch::<Kmer32bit, f64>");
let sketcher = Sketcher::new(&sketch_params);

println!("Loading HNSW index...");
// Load the HNSW index
let hnsw_res = hnswio.load_hnsw::<
<OptDensHashSketch<Kmer, f64> as SeqSketcherT<Kmer32bit>>::Sig,
Expand All @@ -184,7 +185,9 @@ fn main() {
);
}
};
println!("HNSW index loaded...");

println!("Sketching...");
// Set the number of threads globally using Rayon
rayon::ThreadPoolBuilder::new()
.num_threads(num_threads)
Expand Down Expand Up @@ -277,7 +280,7 @@ fn main() {
};
println!("Sketching done.");
// Searching
println!("Searching HNSW index...");

let ef_search = 5000;
let out_threshold = 1.0;
let outname = "adas.neighbors.txt";
Expand All @@ -297,6 +300,7 @@ fn main() {
}
let mut outfile = BufWriter::new(outfile.unwrap());

println!("Searching HNSW index...");
// We do parallel_search with our signature vector
let knn_neighbours = hnsw.parallel_search(&signatures, nb_answers_search, ef_search);
for i in 0..knn_neighbours.len() {
Expand All @@ -308,5 +312,5 @@ fn main() {
);
}
}
println!("Done. Search results saved to adas.neighbors.txt");
println!("Searching HNSW index done. Search results saved to adas.neighbors.txt");
}

0 comments on commit d9c3234

Please sign in to comment.