Loading .gitmodules +0 −3 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ [submodule "vendor/rampler"] path = vendor/rampler url = https://github.com/rvaser/rampler [submodule "vendor/logger"] path = vendor/logger url = https://github.com/rvaser/logger [submodule "vendor/ClaraGenomicsAnalysis"] path = vendor/ClaraGenomicsAnalysis url = https://github.com/clara-genomics/ClaraGenomicsAnalysis CMakeLists.txt +5 −6 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.2) project(racon) set(racon_version 1.4.7) set(racon_version 1.4.10) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) Loading Loading @@ -30,6 +30,7 @@ include_directories(${PROJECT_SOURCE_DIR}/src) set(racon_sources src/main.cpp src/logger.cpp src/polisher.cpp src/overlap.cpp src/sequence.cpp Loading Loading @@ -58,9 +59,6 @@ endif() if (NOT TARGET edlib) add_subdirectory(vendor/edlib EXCLUDE_FROM_ALL) endif() if (NOT TARGET logger) add_subdirectory(vendor/logger EXCLUDE_FROM_ALL) endif() if (racon_enable_cuda) if (DEFINED CLARAGENOMICSANALYSIS_SDK_PATH) list(APPEND CMAKE_PREFIX_PATH "${CLARAGENOMICSANALYSIS_SDK_PATH}/cmake") Loading Loading @@ -90,7 +88,7 @@ if (racon_enable_cuda) endif() endif() target_link_libraries(racon bioparser spoa thread_pool edlib_static logger) target_link_libraries(racon bioparser spoa thread_pool edlib_static) if (racon_enable_cuda) target_link_libraries(racon cudapoa cudaaligner) endif() Loading @@ -106,6 +104,7 @@ if (racon_build_tests) set(racon_test_sources test/racon_test.cpp src/logger.cpp src/polisher.cpp src/overlap.cpp src/sequence.cpp Loading @@ -123,7 +122,7 @@ if (racon_build_tests) add_subdirectory(vendor/googletest/googletest EXCLUDE_FROM_ALL) endif() target_link_libraries(racon_test bioparser spoa thread_pool edlib_static logger gtest_main) target_link_libraries(racon_test bioparser spoa thread_pool edlib_static gtest_main) if (racon_enable_cuda) target_link_libraries(racon_test cudapoa cudaaligner) endif() Loading src/cuda/cudapolisher.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -10,11 +10,11 @@ #include <cuda_profiler_api.h> #include "sequence.hpp" #include "logger.hpp" #include "cudapolisher.hpp" #include <claragenomics/utils/cudautils.hpp> #include "bioparser/bioparser.hpp" #include "logger/logger.hpp" namespace racon { Loading src/logger.cpp 0 → 100644 +56 −0 Original line number Diff line number Diff line /*! * @file logger.cpp * * @brief Logger source file */ #include <iostream> #include "logger.hpp" namespace racon { Logger::Logger() : time_(0.), bar_(0), time_point_() { } Logger::~Logger() { } void Logger::log() { auto now = std::chrono::steady_clock::now(); if (time_point_ != std::chrono::time_point<std::chrono::steady_clock>()) { time_ += std::chrono::duration_cast<std::chrono::duration<double>>(now - time_point_).count(); } time_point_ = now; } void Logger::log(const std::string& msg) const { std::cerr << msg << " " << std::fixed << std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - time_point_).count() << " s" << std::endl; } void Logger::bar(const std::string& msg) { ++bar_; std::string progress_bar = "[" + std::string(bar_, '=') + (bar_ == 20 ? "" : ">" + std::string(19 - bar_, ' ')) + "]"; std::cerr << msg << " " << progress_bar << " " << std::fixed << std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - time_point_).count() << " s"; bar_ %= 20; if (bar_ == 0) { std::cerr << std::endl; } else { std::cerr << "\r"; } } void Logger::total(const std::string& msg) const { std::cerr << msg << " " << std::fixed << time_ + std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - time_point_).count() << " s" << std::endl; } } src/logger.hpp 0 → 100644 +56 −0 Original line number Diff line number Diff line /*! * @file logger.hpp * * @brief Logger header file */ #pragma once #include <cstdint> #include <chrono> #include <string> namespace racon { static const std::string version = "v1.0.0"; class Logger { public: Logger(); Logger(const Logger&) = default; Logger& operator=(const Logger&) = default; Logger(Logger&&) = default; Logger& operator=(Logger&&) = default; ~Logger(); /*! * @brief Resets the time point */ void log(); /*! * @brief Prints the elapsed time from last time point to stderr */ void log(const std::string& msg) const; /*! * @brief Prints a progress bar and the elapsed time from last time to * stderr (the progress bar resets after 20 calls) */ void bar(const std::string& msg); /*! * @brief Prints the total elapsed time from the first log() call */ void total(const std::string& msg) const; private: double time_; std::uint32_t bar_; std::chrono::time_point<std::chrono::steady_clock> time_point_; }; } Loading
.gitmodules +0 −3 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ [submodule "vendor/rampler"] path = vendor/rampler url = https://github.com/rvaser/rampler [submodule "vendor/logger"] path = vendor/logger url = https://github.com/rvaser/logger [submodule "vendor/ClaraGenomicsAnalysis"] path = vendor/ClaraGenomicsAnalysis url = https://github.com/clara-genomics/ClaraGenomicsAnalysis
CMakeLists.txt +5 −6 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.2) project(racon) set(racon_version 1.4.7) set(racon_version 1.4.10) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) Loading Loading @@ -30,6 +30,7 @@ include_directories(${PROJECT_SOURCE_DIR}/src) set(racon_sources src/main.cpp src/logger.cpp src/polisher.cpp src/overlap.cpp src/sequence.cpp Loading Loading @@ -58,9 +59,6 @@ endif() if (NOT TARGET edlib) add_subdirectory(vendor/edlib EXCLUDE_FROM_ALL) endif() if (NOT TARGET logger) add_subdirectory(vendor/logger EXCLUDE_FROM_ALL) endif() if (racon_enable_cuda) if (DEFINED CLARAGENOMICSANALYSIS_SDK_PATH) list(APPEND CMAKE_PREFIX_PATH "${CLARAGENOMICSANALYSIS_SDK_PATH}/cmake") Loading Loading @@ -90,7 +88,7 @@ if (racon_enable_cuda) endif() endif() target_link_libraries(racon bioparser spoa thread_pool edlib_static logger) target_link_libraries(racon bioparser spoa thread_pool edlib_static) if (racon_enable_cuda) target_link_libraries(racon cudapoa cudaaligner) endif() Loading @@ -106,6 +104,7 @@ if (racon_build_tests) set(racon_test_sources test/racon_test.cpp src/logger.cpp src/polisher.cpp src/overlap.cpp src/sequence.cpp Loading @@ -123,7 +122,7 @@ if (racon_build_tests) add_subdirectory(vendor/googletest/googletest EXCLUDE_FROM_ALL) endif() target_link_libraries(racon_test bioparser spoa thread_pool edlib_static logger gtest_main) target_link_libraries(racon_test bioparser spoa thread_pool edlib_static gtest_main) if (racon_enable_cuda) target_link_libraries(racon_test cudapoa cudaaligner) endif() Loading
src/cuda/cudapolisher.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -10,11 +10,11 @@ #include <cuda_profiler_api.h> #include "sequence.hpp" #include "logger.hpp" #include "cudapolisher.hpp" #include <claragenomics/utils/cudautils.hpp> #include "bioparser/bioparser.hpp" #include "logger/logger.hpp" namespace racon { Loading
src/logger.cpp 0 → 100644 +56 −0 Original line number Diff line number Diff line /*! * @file logger.cpp * * @brief Logger source file */ #include <iostream> #include "logger.hpp" namespace racon { Logger::Logger() : time_(0.), bar_(0), time_point_() { } Logger::~Logger() { } void Logger::log() { auto now = std::chrono::steady_clock::now(); if (time_point_ != std::chrono::time_point<std::chrono::steady_clock>()) { time_ += std::chrono::duration_cast<std::chrono::duration<double>>(now - time_point_).count(); } time_point_ = now; } void Logger::log(const std::string& msg) const { std::cerr << msg << " " << std::fixed << std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - time_point_).count() << " s" << std::endl; } void Logger::bar(const std::string& msg) { ++bar_; std::string progress_bar = "[" + std::string(bar_, '=') + (bar_ == 20 ? "" : ">" + std::string(19 - bar_, ' ')) + "]"; std::cerr << msg << " " << progress_bar << " " << std::fixed << std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - time_point_).count() << " s"; bar_ %= 20; if (bar_ == 0) { std::cerr << std::endl; } else { std::cerr << "\r"; } } void Logger::total(const std::string& msg) const { std::cerr << msg << " " << std::fixed << time_ + std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - time_point_).count() << " s" << std::endl; } }
src/logger.hpp 0 → 100644 +56 −0 Original line number Diff line number Diff line /*! * @file logger.hpp * * @brief Logger header file */ #pragma once #include <cstdint> #include <chrono> #include <string> namespace racon { static const std::string version = "v1.0.0"; class Logger { public: Logger(); Logger(const Logger&) = default; Logger& operator=(const Logger&) = default; Logger(Logger&&) = default; Logger& operator=(Logger&&) = default; ~Logger(); /*! * @brief Resets the time point */ void log(); /*! * @brief Prints the elapsed time from last time point to stderr */ void log(const std::string& msg) const; /*! * @brief Prints a progress bar and the elapsed time from last time to * stderr (the progress bar resets after 20 calls) */ void bar(const std::string& msg); /*! * @brief Prints the total elapsed time from the first log() call */ void total(const std::string& msg) const; private: double time_; std::uint32_t bar_; std::chrono::time_point<std::chrono::steady_clock> time_point_; }; }