Skip to content

Commit

Permalink
removed paryfor dependency: with omp is faster
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed Nov 25, 2020
1 parent 8bcc6de commit 4352669
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@
[submodule "deps/dirtyzipf"]
path = deps/dirtyzipf
url = https://github.com/ekg/dirtyzipf.git
[submodule "deps/paryfor"]
path = deps/paryfor
url = https://github.com/ekg/paryfor.git
[submodule "deps/atomicbitvector"]
path = deps/atomicbitvector
url = https://github.com/ekg/atomicbitvector.git
14 changes: 1 addition & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,6 @@ ExternalProject_Add(xoshiro
ExternalProject_Get_property(xoshiro SOURCE_DIR)
set(xoshiro_INCLUDE "${SOURCE_DIR}")

# paryfor parallel_for
ExternalProject_Add(paryfor
SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/paryfor"
UPDATE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND ""
CONFIGURE_COMMAND "")
ExternalProject_Get_property(paryfor SOURCE_DIR)
set(paryfor_INCLUDE "${SOURCE_DIR}")

ExternalProject_Add(atomicbitvector
SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/atomicbitvector/include"
UPDATE_COMMAND ""
Expand Down Expand Up @@ -446,8 +436,7 @@ set(odgi_DEPS
mmmulti
ips4o
xoshiro
atomicqueue
paryfor)
atomicqueue)
add_dependencies(odgi_objs ${odgi_DEPS})

set(odgi_INCLUDES
Expand Down Expand Up @@ -479,7 +468,6 @@ set(odgi_INCLUDES
"${random_distributions_INCLUDE}"
"${dirtyzipf_INCLUDE}"
"${xoshiro_INCLUDE}"
"${paryfor_INCLUDE}"
"${atomicbitvector_INCLUDE}")

set(odgi_LIBS
Expand Down
1 change: 0 additions & 1 deletion deps/paryfor
Submodule paryfor deleted from 509b28
17 changes: 10 additions & 7 deletions src/odgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// graph.cpp
//

#include <thread>
#include "odgi.hpp"

namespace odgi {
Expand Down Expand Up @@ -814,13 +815,14 @@ void graph_t::apply_ordering(const std::vector<handle_t>& order_in, bool compact
std::mutex node_unavailable_mutex;
atomicbitvector::atomic_bv_t node_unavailable(ids.size());

paryfor::parallel_for<uint64_t>(
0, path_metadata_v.size(), 16,
[&](uint64_t idx, int tid) {
uint64_t path_metadata_v_size = path_metadata_v.size();

#pragma omp parallel for schedule(static,1) num_threads(16)
for (uint64_t idx = 0; idx < path_metadata_v_size; ++idx) {
if (path_metadata_v[idx].length > 0) {
bool from_left_else_right = (tid % 2 == 0);
bool from_left_else_right = (idx & 1);

auto& p = path_metadata_v.at(idx);
auto& p = path_metadata_v[idx];
step_handle_t step = from_left_else_right ? p.first : p.last;
step_handle_t xxx_step = from_left_else_right ? p.last : p.first;

Expand Down Expand Up @@ -920,8 +922,9 @@ void graph_t::apply_ordering(const std::vector<handle_t>& order_in, bool compact
}
} while (true);
}
});
*this = ordered;
};

*this = ordered;
}

void graph_t::apply_path_ordering(const std::vector<path_handle_t>& order) {
Expand Down
2 changes: 1 addition & 1 deletion src/odgi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "hash_map.hpp"
#include "node.hpp"

#include "paryfor.hpp"
#include <omp.h>
#include "atomic_bitvector.hpp"
#include <mutex>

Expand Down

0 comments on commit 4352669

Please sign in to comment.