Skip to content

Commit

Permalink
Fix Cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
spond committed Mar 24, 2022
1 parent 2ecb352 commit 55565df
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 75 deletions.
80 changes: 19 additions & 61 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(TN93)

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -33,7 +33,6 @@ add_executable(
src/argparse_cluster.cpp
)


add_executable(
seqcoverage
src/charfreqs.cpp
Expand Down Expand Up @@ -87,65 +86,28 @@ add_executable(
src/argparse_fasta_diff.cpp
)

#set(DEFAULT_COMPILE_FLAGS "-O3 -march=native -g -mveclibabi=svml -mstringop-strategy=vector_loop -Wa,-q")
set(DEFAULT_COMPILE_FLAGS "-O3 -std=c++11 -march=native -funroll-loops -g")
set(DEFAULT_COMPILE_OPTIONS -O3 -std=c++14 -funroll-loops )
set(DEFAULT_LINK_OPTIONS ${DEFAULT_COMPILE_OPTIONS})

add_definitions(${DEFAULT_COMPILE_OPTIONS})

set(DEFAULT_LINK_FLAGS "${DEFAULT_COMPILE_FLAGS}")

#add_compile_options (-O3 -std=c++14 -march=native -funroll-loops )

find_package(OpenMP)

if (${OPENMP_FOUND})
set_target_properties(
tn93
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} ${OpenMP_CXX_FLAGS}"
LINK_FLAGS "${DEFAULT_LINK_FLAGS} ${OpenMP_CXX_FLAGS}"
)
set_target_properties(
tn93-cluster
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} ${OpenMP_CXX_FLAGS}"
LINK_FLAGS "${DEFAULT_LINK_FLAGS} ${OpenMP_CXX_FLAGS}"
)
set_target_properties(
selectreads
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} ${OpenMP_CXX_FLAGS}"
LINK_FLAGS "${DEFAULT_LINK_FLAGS} ${OpenMP_CXX_FLAGS}"
)
set_target_properties(
seqcoverage
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} ${OpenMP_CXX_FLAGS}"
LINK_FLAGS "${DEFAULT_LINK_FLAGS} ${OpenMP_CXX_FLAGS}"
)
set_target_properties(
ShortestPathTN93
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} ${OpenMP_CXX_FLAGS}"
LINK_FLAGS "${DEFAULT_LINK_FLAGS} ${OpenMP_CXX_FLAGS}"
)
set_target_properties(
readreduce
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} ${OpenMP_CXX_FLAGS}"
LINK_FLAGS "${DEFAULT_LINK_FLAGS} ${OpenMP_CXX_FLAGS}"
)

set_target_properties(
fasta_diff
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} ${OpenMP_CXX_FLAGS}"
LINK_FLAGS "${DEFAULT_LINK_FLAGS} ${OpenMP_CXX_FLAGS} "
)

endif (${OPENMP_FOUND})

set_target_properties(
fasta_diff
PROPERTIES
COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} -std=c++14 "
)
if(${OPENMP_FOUND})
add_definitions(${OpenMP_CXX_FLAGS})
target_link_libraries(tn93 PRIVATE ${DEFAULT_LIBRARIES} OpenMP::OpenMP_CXX)
target_link_libraries(tn93-cluster PRIVATE ${DEFAULT_LIBRARIES} OpenMP::OpenMP_CXX)
target_link_libraries(selectreads PRIVATE ${DEFAULT_LIBRARIES} OpenMP::OpenMP_CXX)
target_link_libraries(seqcoverage PRIVATE ${DEFAULT_LIBRARIES} OpenMP::OpenMP_CXX)
target_link_libraries(readreduce PRIVATE ${DEFAULT_LIBRARIES} OpenMP::OpenMP_CXX)
target_link_libraries(fasta_diff PRIVATE ${DEFAULT_LIBRARIES} OpenMP::OpenMP_CXX)
target_link_libraries(ShortestPathTN93 PRIVATE ${DEFAULT_LIBRARIES} OpenMP::OpenMP_CXX)
endif(${OPENMP_FOUND})



install(
TARGETS tn93
Expand Down Expand Up @@ -199,10 +161,6 @@ add_custom_target(TN93SP
)


#add_custom_target(SEQCOVERAGE
# DEPENDS seqcoverage
#)

install(
TARGETS nucfreqsfasta
RUNTIME DESTINATION bin
Expand Down
5 changes: 2 additions & 3 deletions src/ShortestPathTN93.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,13 @@ void reportPathToSource (const unsigned long which_index, FILE* output, const bo
void relaxDistanceEstimates (const unsigned long theSequence, const long firstSequenceLength, const char resolutionOption, const long min_overlap, const double step_penalty) {
const unsigned long left_to_do = workingNodes.length();
double my_distance_estimate = distanceEstimates.value (theSequence);
#ifdef _OPENMP


#if _OPENMP >= 201511 && __GNUC__ >= 9
#if _OPENMP >= 200805
#pragma omp parallel for default(none) shared(my_distance_estimate,nodeParents,workingNodes,distanceEstimates, step_penalty, min_overlap, resolutionOption, firstSequenceLength, theSequence, left_to_do)
#else
#pragma omp parallel for default(none) shared(my_distance_estimate,nodeParents,workingNodes,distanceEstimates)
#endif
#endif


for (long remaining = 0; remaining < left_to_do; remaining ++) {
Expand Down
17 changes: 6 additions & 11 deletions src/read_reducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ void merge_current_clusters (StringBuffer& current_clusters, Vector& sequence_le
long try_cluster = -1;

#ifdef _OPENMP

#if _OPENMP >= 200805
#pragma omp parallel shared(current_clusters, sequence_lengths, cluster_id, try_cluster, cluster_merge, cluster1, did_some_merges, merged_cluster_count)
#else
#pragma omp parallel shared(cluster_id, try_cluster, cluster_merge, cluster1, did_some_merges, merged_cluster_count)
#endif
#if _OPENMP >= 200805
#pragma omp parallel shared(current_clusters, sequence_lengths, cluster_id, try_cluster, cluster_merge, cluster1, did_some_merges, merged_cluster_count)
#else
#pragma omp parallel shared(cluster_id, try_cluster, cluster_merge, cluster1, did_some_merges, merged_cluster_count)
#endif
#endif
{
#pragma omp for schedule (dynamic)
Expand Down Expand Up @@ -125,15 +124,11 @@ void handle_a_sequence (StringBuffer& current_sequence, StringBuffer& current_cl
long try_cluster = -1;

#ifdef _OPENMP
#if _OPENMP >= 201511 && __GNUC__ >= 9
#pragma omp parallel for default(none) shared(currently_defined_clusters, try_cluster, sequence_lengths, current_sequence, current_clusters,min_overlap,firstSequenceLength)
#else
#if _OPENMP >= 200805
#pragma omp parallel for default(none) shared(currently_defined_clusters, try_cluster, sequence_lengths, current_sequence, current_clusters)
#pragma omp parallel for default(none) shared(currently_defined_clusters, try_cluster, sequence_lengths, current_sequence, current_clusters, firstSequenceLength, min_overlap)
#else
#pragma omp parallel for default(none) shared(currently_defined_clusters, try_cluster)
#endif
#endif
#endif
for (long cluster_index = 0; cluster_index < currently_defined_clusters; cluster_index ++) {
#pragma omp flush (try_cluster)
Expand Down

0 comments on commit 55565df

Please sign in to comment.