Skip to content

Commit

Permalink
get thread count to build correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ekg committed May 1, 2020
1 parent 352a73a commit b558a12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/xg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,8 @@ void XG::from_enumerators(const std::function<void(const std::function<void(cons
edge_to_from_mm->append(as_integer(to_handle), as_integer(from_handle));
});
handle_t max_handle = number_bool_packing::pack(r_iv.size(), true);
edge_from_to_mm->index(as_integer(max_handle));
edge_to_from_mm->index(as_integer(max_handle));
edge_from_to_mm->index(get_thread_count(), as_integer(max_handle));
edge_to_from_mm->index(get_thread_count(), as_integer(max_handle));

// calculate g_iv size
size_t g_iv_size =
Expand Down Expand Up @@ -1355,7 +1355,7 @@ void XG::index_node_to_path(const std::string& basename) {
#ifdef VERBOSE_DEBUG
std::cerr << path_count << " of " << path_count << " ~ 100.0000%" << std::endl;
#endif
node_path_mm->index(node_count+1);
node_path_mm->index(get_thread_count(), node_count+1);

#ifdef VERBOSE_DEBUG
std::cerr << "determining size of node to path position mappings" << std::endl;
Expand Down Expand Up @@ -2459,4 +2459,14 @@ std::string get_dir() {

}

int get_thread_count(void) {
int thread_count = 1;
#pragma omp parallel
{
#pragma omp master
thread_count = omp_get_num_threads();
}
return thread_count;
}

}
3 changes: 3 additions & 0 deletions src/xg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,4 +607,7 @@ std::string get_dir();

} // namespace temp_file

/// Uses OMP to get the count of threads
int get_thread_count(void);

}

0 comments on commit b558a12

Please sign in to comment.