Skip to content

Commit 9d7ecf7

Browse files
authored
Merge pull request #429 from pgangwar-ucsd/ripples-server-tbb-update
Ripples server integration with namespace changes
2 parents 4389236 + a32261c commit 9d7ecf7

69 files changed

Lines changed: 1978 additions & 455 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ if ("${VERSION_PATCH}" MATCHES "[0-9]+")
2222
endif()
2323
message(STATUS "${usher_VERSION}")
2424

25-
if(NOT APPLE)
26-
add_link_options("-Wl,--undefined-version")
27-
endif()
25+
#if(NOT APPLE)
26+
# add_link_options("-Wl,--undefined-version")
27+
#endif()
2828

2929
include(FetchContent)
3030
set(TBB_VERSION "v2022.2.0")
@@ -43,7 +43,8 @@ configure_file(src/version.hpp.in version.hpp)
4343

4444
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pipe -g -ggdb3 -Wno-unused-function -Wno-deprecated-declarations")
4545
#-DDEBUG_PARSIMONY_SCORE_CHANGE_CORRECT -fsanitize=address -DCHECK_PAR_MAIN -DEASY_DEBUG -DSTOP_ON_ERROR -DDETAILED_MERGER_CHECK -O0
46-
set(CMAKE_CXX_FLAGS_DEBUG " -fno-eliminate-unused-debug-symbols -O0")
46+
set(CMAKE_CXX_FLAGS_DEBUG " -fsanitize=address -fno-eliminate-unused-debug-symbols -O0")
47+
#set(CMAKE_CXX_FLAGS_DEBUG " -fno-eliminate-unused-debug-symbols -O0")
4748
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O3")
4849
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 ")
4950
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -77,9 +78,12 @@ AUX_SOURCE_DIRECTORY(src/matOptimize/apply_move patch_tree)
7778
AUX_SOURCE_DIRECTORY(src/check_samples_place check_samples_place)
7879
file(GLOB MATUTIL_SRCS "src/matUtils/*.cpp" "src/matUtils/*.hpp")
7980
file(GLOB RIPPLES_SRCS "src/ripples/*.cpp" "src/ripples/*.hpp")
81+
file(GLOB RIPPLES_SERVER_SRCS "src/ripples/server/*.cpp" "src/ripples/server/*.hpp")
8082
file(GLOB USHER_SAMPLED_SRCS "src/usher-sampled/static_tree_mapper/*" "src/usher-sampled/*.cpp" "src/usher-sampled/*.hpp")
8183
file(GLOB RIPPLES_FAST_SRCS "src/ripples/ripples_fast/*.cpp" "src/ripples/ripples_fast/*.hpp")
8284
file(GLOB RIPPLES_UTILS_SRCS "src/ripples/util/*.cpp" "src/ripples/util/*.hpp")
85+
file(GLOB RIPPLES_COPY_UTIL_SRCS "src/ripples/util/copy/*.cpp" "src/ripples/util/copy/*.hpp")
86+
file(GLOB RIPPLES_FILTRATION_SRCS "src/ripples/post_filtration/*.cpp" "src/ripples/post_filtration/*.hpp")
8387

8488
set_source_files_properties(src/mutation_annotated_tree.cpp PROPERTIES COMPILE_FLAGS -O3)
8589
set_source_files_properties(src/usher-sampled/wait_debug.cpp PROPERTIES COMPILE_FLAGS -O0)
@@ -108,13 +112,15 @@ if(DEFINED Protobuf_PATH)
108112
src/usher_mapper.cpp
109113
${RIPPLES_SRCS}
110114
)
115+
111116
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
112117
add_executable(ripples-fast
113118
src/mutation_annotated_tree.cpp
114119
src/usher_mapper.cpp
115120
${RIPPLES_FAST_SRCS}
116121
)
117122
endif()
123+
118124
add_executable(usher-sampled
119125
${USHER_SAMPLED_SRCS}
120126
src/matOptimize/main_helper.cpp
@@ -226,6 +232,7 @@ if(DEFINED Protobuf_PATH)
226232
TARGET ripples-fast
227233
PROTOS parsimony.proto)
228234
endif()
235+
229236
protobuf_generate(
230237
LANGUAGE cpp
231238
TARGET compareVCF
@@ -321,6 +328,7 @@ if(DEFINED Protobuf_PATH)
321328
${TAXO_HDRS}
322329
)
323330

331+
324332
add_executable(ripples
325333
src/mutation_annotated_tree.cpp
326334
src/usher_mapper.cpp
@@ -497,6 +505,19 @@ if(DEFINED Protobuf_PATH)
497505
src/matOptimize/main_load_tree.cpp
498506
src/matOptimize/priority_conflict_resolver.cpp
499507
src/usher-sampled/driver/socket.cpp
508+
src/mutation_annotated_tree.cpp
509+
src/usher_mapper.cpp
510+
src/usher_common.cpp
511+
# ripples server
512+
src/ripples/ripples_fast/ripples_util.cpp
513+
src/ripples/ripples_fast/ripples.cpp
514+
src/ripples/ripples_fast/ripple_aux.cpp
515+
src/ripples/ripples_fast/ripples_mapper.cpp
516+
src/ripples/ripples_fast/ripple_merger.cpp
517+
src/ripples/util/text_parser.cpp
518+
${RIPPLES_SERVER_SRCS}
519+
${RIPPLES_COPY_UTIL_SRCS}
520+
${RIPPLES_FILTRATION_SRCS}
500521
${patch_tree}
501522
${New_Profitable_Moves_Enumerators}
502523
)
@@ -566,6 +587,7 @@ TARGET_LINK_LIBRARIES(ripplesInit PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${
566587

567588
TARGET_COMPILE_OPTIONS(ripples PRIVATE)
568589
TARGET_LINK_LIBRARIES(ripples PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
590+
569591
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
570592
TARGET_LINK_LIBRARIES(ripples-fast PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
571593
endif()

src/check_samples_place/check_samples.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#include <unordered_set>
1111
#include <utility>
1212
#include <vector>
13-
namespace MAT = Mutation_Annotated_Tree;
13+
namespace MAT = MatOptimize::Mutation_Annotated_Tree;
14+
using namespace MatOptimize;
1415
//add mutation m to parent_mutations, which represent the mutation of a node relative to root,
1516
//or update major allele if already present
1617
void ins_mut(Mutation_Set &parent_mutations,const Mutation_Annotated_Tree::Mutation &m,bool is_leaf) {

src/check_samples_place/import_vcf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <unordered_set>
3232
#include <utility>
3333
#include <vector>
34-
namespace MAT = Mutation_Annotated_Tree;
34+
namespace MAT = MatOptimize::Mutation_Annotated_Tree;
3535
#define ZLIB_BUFSIZ 0x10000
3636
size_t read_size;
3737
size_t alloc_size;

src/check_samples_place/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <cstdio>
33
#include <unordered_set>
44
#include <string>
5-
namespace MAT = Mutation_Annotated_Tree;
5+
namespace MAT = MatOptimize::Mutation_Annotated_Tree;
66
#include "src/matOptimize/check_samples.hpp"
77
void Sample_Input(const char *name, Original_State_t& ori_state,
88
MAT::Tree &tree);

src/matOptimize/Fitch_Sankoff.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <emmintrin.h>
1616
#include <smmintrin.h>
1717
#endif
18-
namespace MAT = Mutation_Annotated_Tree;
18+
namespace MAT = MatOptimize::Mutation_Annotated_Tree;
1919
//get state of ancestor at position
2020
nuc_one_hot get_this_state(MAT::Node* ancestor,int position) {
2121
auto iter = ancestor->mutations.find(position);
@@ -311,6 +311,8 @@ int FS_forward_assign_states_only(const std::vector<MAT::Node*>& bfs_ordered_nod
311311
return mutation_count;
312312
}
313313
#endif
314+
315+
using namespace MatOptimize;
314316
void Fitch_Sankoff_Whole_Tree(const std::vector<backward_pass_range>& child_idx_range,const std::vector<forward_pass_range>& parent_idx,const MAT::Mutation & base,const mutated_t& mutated,Fitch_Sankoff_Out_Container& output,MAT::Tree* try_similar) {
315317

316318
FS_backward_pass(child_idx_range,output.minor_major_allele,mutated,base.get_ref_one_hot());

src/matOptimize/Fitch_Sankoff.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <tbb/concurrent_vector.h>
55
#include <tbb/enumerable_thread_specific.h>
66
#include <vector>
7-
namespace MAT=Mutation_Annotated_Tree;
87
struct backward_pass_range {
98
size_t first_child_bfs_idx;
109
size_t child_size;
@@ -28,7 +27,7 @@ struct mutated_t_comparator {
2827
return lhs.first>rhs.first;
2928
}
3029
};
31-
typedef std::vector<MAT::Mutation> mut_vect_t;
30+
typedef std::vector<MatOptimize::MAT::Mutation> mut_vect_t;
3231
struct Fitch_Sankoff_Out_Container {
3332
std::vector<mut_vect_t> output;
3433
std::vector<uint8_t> minor_major_allele;
@@ -39,13 +38,13 @@ struct Fitch_Sankoff_Out_Container {
3938
}
4039
}
4140
};
42-
void Fitch_Sankoff_prep(const std::vector<Mutation_Annotated_Tree::Node*>& bfs_ordered_nodes, std::vector<backward_pass_range>& child_idx_range,std::vector<forward_pass_range>& parent_idx);
43-
void Fitch_Sankoff_Whole_Tree(const std::vector<backward_pass_range>& child_idx_range,const std::vector<forward_pass_range>& parent_idx,const Mutation_Annotated_Tree::Mutation & base,const mutated_t& mutated,Fitch_Sankoff_Out_Container& output,Mutation_Annotated_Tree::Tree* try_similar=nullptr);
41+
void Fitch_Sankoff_prep(const std::vector<MatOptimize::MAT::Node*>& bfs_ordered_nodes, std::vector<backward_pass_range>& child_idx_range,std::vector<forward_pass_range>& parent_idx);
42+
void Fitch_Sankoff_Whole_Tree(const std::vector<backward_pass_range>& child_idx_range,const std::vector<forward_pass_range>& parent_idx,const MatOptimize::Mutation_Annotated_Tree::Mutation & base,const mutated_t& mutated,Fitch_Sankoff_Out_Container& output,MatOptimize::Mutation_Annotated_Tree::Tree* try_similar=nullptr);
4443
#if defined CHECK_STATE_REASSIGN||defined DEBUG_PARSIMONY_SCORE_CHANGE_CORRECT
45-
void FS_backward_pass(const std::vector<Mutation_Annotated_Tree::Node*> bfs_ordered_nodes, std::vector<uint8_t>& boundary1_major_allele,const std::unordered_map<std::string, nuc_one_hot>& mutated,nuc_one_hot ref_nuc);
46-
int FS_forward_assign_states_only(const std::vector<Mutation_Annotated_Tree::Node*>& bfs_ordered_nodes,const std::vector<uint8_t>& boundary1_major_allele,const nuc_one_hot parent_state,std::vector<uint8_t>& states_out,std::vector<std::vector<Mutation_Annotated_Tree::Node*>>& children_mutation_count);
44+
void FS_backward_pass(const std::vector<MatOptimize::MAT::Node*> bfs_ordered_nodes, std::vector<uint8_t>& boundary1_major_allele,const std::unordered_map<std::string, nuc_one_hot>& mutated,nuc_one_hot ref_nuc);
45+
int FS_forward_assign_states_only(const std::vector<MatOptimize::MAT::Node*>& bfs_ordered_nodes,const std::vector<uint8_t>& boundary1_major_allele,const nuc_one_hot parent_state,std::vector<uint8_t>& states_out,std::vector<std::vector<MatOptimize::Mutation_Annotated_Tree::Node*>>& children_mutation_count);
4746
#endif
4847
void set_state_from_cnt(const std::array<int,4>& data, uint8_t& boundary1_major_allele_out);
4948
typedef tbb::enumerable_thread_specific<Fitch_Sankoff_Out_Container> FS_result_per_thread_t;
5049
void deallocate_FS_cache(FS_result_per_thread_t& in);
51-
void fill_muts(FS_result_per_thread_t& in, std::vector<MAT::Node*>& bfs_ordered_nodes);
50+
void fill_muts(FS_result_per_thread_t& in, std::vector<MatOptimize::MAT::Node*>& bfs_ordered_nodes);

src/matOptimize/Mutation_Collection.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <tbb/blocked_range.h>
66
#include <tbb/parallel_for.h>
77
#include <vector>
8-
using namespace Mutation_Annotated_Tree;
8+
using namespace MatOptimize::Mutation_Annotated_Tree;
99
void Mutations_Collection::merge_out(const Mutations_Collection &other,
1010
Mutations_Collection &out,
1111
char keep_self) const {
@@ -165,7 +165,7 @@ Mutations_Collection::iterator Mutations_Collection::find_next(int pos) {
165165
}
166166

167167

168-
int Mutation_Annotated_Tree::Mutations_Collection::count_valid_mutations() const {
168+
int MatOptimize::Mutation_Annotated_Tree::Mutations_Collection::count_valid_mutations() const {
169169
int count=0;
170170
for(const auto & mut:mutations) {
171171
if (mut.is_valid()) {
@@ -174,8 +174,8 @@ int Mutation_Annotated_Tree::Mutations_Collection::count_valid_mutations() const
174174
}
175175
return count;
176176
}
177-
void Mutation_Annotated_Tree::Mutations_Collection::remove_invalid() {
178-
std::vector<Mutation_Annotated_Tree::Mutation> out;
177+
void MatOptimize::Mutation_Annotated_Tree::Mutations_Collection::remove_invalid() {
178+
std::vector<MatOptimize::Mutation_Annotated_Tree::Mutation> out;
179179
out.reserve(mutations.size());
180180
for (const auto& mut : mutations) {
181181
if (mut.is_valid()) {
@@ -185,11 +185,11 @@ void Mutation_Annotated_Tree::Mutations_Collection::remove_invalid() {
185185
mutations.swap(out);
186186
}
187187

188-
bool Mutation_Annotated_Tree::Mutations_Collection::no_valid_mutation()const {
188+
bool MatOptimize::Mutation_Annotated_Tree::Mutations_Collection::no_valid_mutation()const {
189189
for(auto& mut:mutations) {
190190
if (mut.is_valid()) {
191191
return false;
192192
}
193193
}
194194
return true;
195-
}
195+
}

src/matOptimize/Profitable_Moves_Enumerators/Profitable_Moves_Enumerators-debug.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <string>
44
#ifndef NDEBUG
55
#include "../mutation_annotated_tree.hpp"
6-
namespace MAT = Mutation_Annotated_Tree;
6+
namespace MAT = MatOptimize::Mutation_Annotated_Tree;
77
#include "../Fitch_Sankoff.hpp"
88
#include "../check_samples.hpp"
99
#include <unordered_set>
@@ -173,4 +173,4 @@ int get_parsimmony_score_only(MAT::Node *src, MAT::Node *dst, MAT::Node *LCA,con
173173
return parsimony_score_change;
174174
}
175175
#endif
176-
#endif
176+
#endif

src/matOptimize/Profitable_Moves_Enumerators/Profitable_Moves_Enumerators.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "../stack_allocator.hpp"
1111
typedef std::vector<std::array<std::vector<unsigned int>, 4>> mutated_node_dfs_idx_t;
1212
extern mutated_node_dfs_idx_t mutated_node_dfs_idx;
13-
namespace MAT = Mutation_Annotated_Tree;
13+
namespace MAT = MatOptimize::Mutation_Annotated_Tree;
1414
//Class for recording change in major allele set
1515
class Mutation_Count_Change {
1616
int position;

src/matOptimize/Profitable_Moves_Enumerators/possible_change.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
void make_range_tree(const std::vector<MAT::Node *> &dfs_ordered_nodes,
2121
tbb::concurrent_vector<node_info> &in, range_tree &out,
2222
size_t idx);
23-
namespace MAT = Mutation_Annotated_Tree;
23+
namespace MAT = MatOptimize::Mutation_Annotated_Tree;
2424
short default_decrement_effect[4];
2525
short default_increment_effect[4];
2626
struct initer {

0 commit comments

Comments
 (0)