Skip to content

Commit

Permalink
trying to debug on TACC which means getting ASAN bulit in
Browse files Browse the repository at this point in the history
  • Loading branch information
ekg committed Jun 4, 2024
1 parent 75a6631 commit debeff7
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")

if (${CMAKE_BUILD_TYPE} MATCHES Release)
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
#set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG")
# set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
if (NOT EXTRA_FLAGS)
set(EXTRA_FLAGS "-Ofast -march=x86-64-v3")
set(EXTRA_FLAGS "-Ofast -march=x86-64-v3 -g")
endif()
endif ()

Expand Down Expand Up @@ -103,11 +103,20 @@ ExternalProject_Add(jemalloc
BUILD_IN_SOURCE 1
)

ExternalProject_Add(gcc-13.2.0
URL https://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gcc-13.2.0
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/gcc-13.2.0 --enable-languages=c,c++ --disable-multilib --enable-libsanitizer=address
BUILD_COMMAND $(MAKE)
INSTALL_COMMAND $(MAKE) install
BUILD_IN_SOURCE 1
)

add_executable(wfmash
src/common/utils.cpp
src/interface/main.cpp)

add_dependencies(wfmash htslib gsl libdeflate jemalloc)
add_dependencies(wfmash htslib gsl libdeflate jemalloc gcc-13.2.0)

target_include_directories(wfmash PRIVATE
src
Expand Down Expand Up @@ -135,6 +144,7 @@ target_link_libraries(wfmash
z
${CMAKE_CURRENT_BINARY_DIR}/libdeflate/lib64/libdeflate.a
Threads::Threads
${CMAKE_CURRENT_BINARY_DIR}/gcc-13.2.0/lib64/libasan.a
)

configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR})
Expand Down
4 changes: 2 additions & 2 deletions src/common/wflign/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")

if (${CMAKE_BUILD_TYPE} MATCHES Release)
#set(EXTRA_FLAGS "-Ofast -march=x86-64-v3 -flto -fno-fat-lto-objects")
set(EXTRA_FLAGS "-Ofast -march=x86-64-v3")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG") # reset CXX_FLAGS to replace -O3 with -Ofast
set(EXTRA_FLAGS "-Ofast -march=x86-64-v3 -g")
#set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG") # reset CXX_FLAGS to replace -O3 with -Ofast
endif ()

if (${CMAKE_BUILD_TYPE} MATCHES Debug)
Expand Down
4 changes: 2 additions & 2 deletions src/common/wflign/src/wflign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ int wflambda_extend_match(
if (f != alignments.end()) {
is_a_match = (alignments[k] != nullptr);
} else {
const int query_begin = v * step_size;
const int target_begin = h * step_size;
const int64_t query_begin = v * step_size;
const int64_t target_begin = h * step_size;

// The last fragment can be longer than segment_length_to_use (max 2*segment_length_to_use - 1)
const uint16_t segment_length_to_use_q =
Expand Down
2 changes: 1 addition & 1 deletion src/common/wflign/src/wflign_alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,4 +642,4 @@ bool hack_cigar(wfa::cigar_t &cigar, const char *query, const char *target,
}
}
return ok;
}*/
}*/
13 changes: 10 additions & 3 deletions src/common/wflign/src/wflign_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,25 @@ bool do_wfa_segment_alignment(
const char* query,
std::vector<rkmh::hash_t>*& query_sketch,
const uint64_t& query_length,
const int& j,
const int64_t& j,
const std::string& target_name,
const char* target,
std::vector<rkmh::hash_t>*& target_sketch,
const uint64_t& target_length,
const int& i,
const int64_t& i,
const uint16_t& segment_length_q,
const uint16_t& segment_length_t,
const uint16_t& step_size,
wflign_extend_data_t* extend_data,
alignment_t& aln) {

// if our i or j index plus segment length in the query or target is too long we'll make a memory access error and weird stuff will happen
if (i + segment_length_t > target_length || j + segment_length_q > query_length) {
// display function parameters
std::cerr << "query_name: " << query_name << " query_length: " << query_length << " target_name: " << target_name << " target_length: " << target_length << std::endl;
std::cerr << "i: " << i << " j: " << j << " segment_length_t: " << segment_length_t << " segment_length_q: " << segment_length_q << std::endl;
}

// first make the sketches if we haven't yet
if (query_sketch == nullptr) {
query_sketch = new std::vector<rkmh::hash_t>();
Expand All @@ -48,7 +55,7 @@ bool do_wfa_segment_alignment(
++extend_data->num_sketches_allocated;
}
if (target_sketch == nullptr) {
target_sketch = new std::vector<rkmh::hash_t>();
target_sketch = new std::vector<rkmh::hash_t>();
*target_sketch = rkmh::hash_sequence(
target + i, segment_length_t, extend_data->minhash_kmer_size, (uint64_t)((float)segment_length_t * extend_data->mash_sketch_rate));
++extend_data->num_sketches_allocated;
Expand Down
6 changes: 3 additions & 3 deletions src/common/wflign/src/wflign_patch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ namespace wflign {
const char* query,
std::vector<rkmh::hash_t>*& query_sketch,
const uint64_t& query_length,
const int& j,
const int64_t& j,
const std::string& target_name,
const char* target,
std::vector<rkmh::hash_t>*& target_sketch,
const uint64_t& target_length,
const int& i,
const int64_t& i,
const uint16_t& segment_length_q,
const uint16_t& segment_length_t,
const uint16_t& step_size,
Expand Down Expand Up @@ -120,4 +120,4 @@ namespace wflign {
void encodeOneStep(const char *filename, std::vector<unsigned char> &image, unsigned width, unsigned height);
} /* namespace wflign */

#endif /* WFLIGN_PATCH_HPP_ */
#endif /* WFLIGN_PATCH_HPP_ */

0 comments on commit debeff7

Please sign in to comment.