Skip to content
Snippets Groups Projects
Commit 29dfce26 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

Merge remote-tracking branch 'origin/new_idea'

parents 8b462847 52f86fba
No related branches found
No related tags found
No related merge requests found
...@@ -72,7 +72,7 @@ int main(int argc, char **argv) { ...@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
throw std::runtime_error("Error: HashMap is full!"); throw std::runtime_error("Error: HashMap is full!");
} }
if (kmer.backwardExt() == 'F') { if (upcxx::rank_me()==0 and kmer.backwardExt() == 'F') {
start_nodes.push_back(kmer); start_nodes.push_back(kmer);
} }
} }
...@@ -87,52 +87,67 @@ int main(int argc, char **argv) { ...@@ -87,52 +87,67 @@ int main(int argc, char **argv) {
auto start_read = std::chrono::high_resolution_clock::now(); auto start_read = std::chrono::high_resolution_clock::now();
std::list <std::list <kmer_pair>> contigs; std::list <std::list <kmer_pair>> contigs;//assume it is global addressed
for (const auto &start_kmer : start_nodes) { if (upcxx::rank_me()==0){
std::list <kmer_pair> contig; for (const auto &start_kmer : start_nodes) {
contig.push_back(start_kmer); std::list <kmer_pair> contig;
while (contig.back().forwardExt() != 'F') { contig.push_back(start_kmer);
kmer_pair kmer; contigs.push_back(contig);
bool success = hashmap.find(contig.back().next_kmer(), kmer); }
if (!success) { //now broadcast contigs, and broadcast the number of contig inside contigs to every processor
throw std::runtime_error("Error: k-mer not found in hashmap."); }
// the following will be done by every processor
bool all_done = false;
while (all_done==false){
for (int num=0;num<num_contig;num++){
check_if_this_contig_ends_with_F//update all_done
fetch_last_kmer_if_needed(contigs[i],upcxx::rank_me()).wait();
//return success,and contigs[i].back().next_kmer()
if (fetch_last_kmer_if_needed.success==true){
kmer_pair kmer;
bool success = hashmap.find(fetch_last_kmer_if_needed.next_kmer, kmer);
if (!success) {
//panic!
}
remotely_push_kmer_into_contig(contigs[i],kmer)
//contig.push_back(kmer);
} }
contig.push_back(kmer);
} }
contigs.push_back(contig);
} }
auto end_read = std::chrono::high_resolution_clock::now(); auto end_read = std::chrono::high_resolution_clock::now();
upcxx::barrier(); upcxx::barrier();
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
if (upcxx::rank_me()==0){
std::chrono::duration <double> read = end_read - start_read;
std::chrono::duration <double> insert = end_insert - start;
std::chrono::duration <double> total = end - start;
int numKmers = std::accumulate(contigs.begin(), contigs.end(), 0,
[] (int sum, const std::list <kmer_pair> &contig) {
return sum + contig.size();
});
if (run_type != "test") {
BUtil::print("Assembled in %lf total\n", total.count());
}
std::chrono::duration <double> read = end_read - start_read; if (run_type == "verbose") {
std::chrono::duration <double> insert = end_insert - start; printf("Rank %d reconstructed %d contigs with %d nodes from %d start nodes."
std::chrono::duration <double> total = end - start; " (%lf read, %lf insert, %lf total)\n", upcxx::rank_me(), contigs.size(),
numKmers, start_nodes.size(), read.count(), insert.count(), total.count());
int numKmers = std::accumulate(contigs.begin(), contigs.end(), 0, }
[] (int sum, const std::list <kmer_pair> &contig) {
return sum + contig.size();
});
if (run_type != "test") {
BUtil::print("Assembled in %lf total\n", total.count());
}
if (run_type == "verbose") {
printf("Rank %d reconstructed %d contigs with %d nodes from %d start nodes."
" (%lf read, %lf insert, %lf total)\n", upcxx::rank_me(), contigs.size(),
numKmers, start_nodes.size(), read.count(), insert.count(), total.count());
}
if (run_type == "test") { if (run_type == "test") {
std::ofstream fout("test_" + std::to_string(upcxx::rank_me()) + ".dat"); std::ofstream fout("test_" + std::to_string(upcxx::rank_me()) + ".dat");
for (const auto &contig : contigs) { for (const auto &contig : contigs) {
fout << extract_contig(contig) << std::endl; fout << extract_contig(contig) << std::endl;
}
fout.close();
} }
fout.close();
} }
upcxx::finalize(); upcxx::finalize();
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment