Skip to content

Commit

Permalink
Merge branch 'dev-v0.6.0' into poa-gfa
Browse files Browse the repository at this point in the history
  • Loading branch information
edawson authored Sep 14, 2020
2 parents 18210af + b89a642 commit 74ba3a3
Show file tree
Hide file tree
Showing 50 changed files with 1,167 additions and 938 deletions.
2 changes: 1 addition & 1 deletion cmake/Format.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function(gw_enable_formatting_targets)
set(format_check_list "")

foreach(source IN LISTS FOLDER_FORMAT_SOURCES)
file(RELATIVE_PATH RELATIVE_PATH ${CMAKE_SOURCE_DIR} ${source})
file(RELATIVE_PATH RELATIVE_PATH ${PROJECT_SOURCE_DIR} ${source})

# Apply formatting
get_filename_component(SYMBOL_BASE_DIR ${RELATIVE_PATH} DIRECTORY)
Expand Down
4 changes: 2 additions & 2 deletions cmake/GitVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
macro (GitVersion)
execute_process(COMMAND
git describe --tag --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE CLARA_PARABRICKS_GENOMEWORKS_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)

endmacro ()
endmacro ()
24 changes: 12 additions & 12 deletions common/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,47 @@



project(gwbase)
set(MODULE_NAME gwbase)

find_package(CUDA 9.0 QUIET REQUIRED)

set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++14")
message(STATUS "nvcc flags for ${PROJECT_NAME}: ${CUDA_NVCC_FLAGS}")
message(STATUS "nvcc flags for ${MODULE_NAME}: ${CUDA_NVCC_FLAGS}")

get_property(gw_library_type GLOBAL PROPERTY gw_library_type)
add_library(${PROJECT_NAME} ${gw_library_type}
add_library(${MODULE_NAME} ${gw_library_type}
src/cudautils.cpp
src/logging.cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog ${CUDA_LIBRARIES})
target_link_libraries(${MODULE_NAME} PUBLIC spdlog ${CUDA_LIBRARIES})

if (gw_profiling)
find_library(NVTX_LIBRARY nvToolsExt HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib64)
target_compile_definitions(${PROJECT_NAME} PUBLIC -DGW_PROFILING)
target_link_libraries(${PROJECT_NAME} PUBLIC ${NVTX_LIBRARY})
target_compile_definitions(${MODULE_NAME} PUBLIC -DGW_PROFILING)
target_link_libraries(${MODULE_NAME} PUBLIC ${NVTX_LIBRARY})
endif()

if (gw_device_synchronize_kernels)
target_compile_definitions(${PROJECT_NAME} PUBLIC GW_DEVICE_SYNCHRONIZE)
target_compile_definitions(${MODULE_NAME} PUBLIC GW_DEVICE_SYNCHRONIZE)
endif()

if(gw_enable_caching_allocator)
target_compile_definitions(${PROJECT_NAME} PUBLIC GW_ENABLE_CACHING_ALLOCATOR)
target_compile_definitions(${MODULE_NAME} PUBLIC GW_ENABLE_CACHING_ALLOCATOR)
endif()

target_include_directories(${PROJECT_NAME}
target_include_directories(${MODULE_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${CUDA_INCLUDE_DIRS}
)

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
install(TARGETS ${MODULE_NAME}
EXPORT ${MODULE_NAME}
DESTINATION lib
INCLUDES DESTINATION include
)
install(DIRECTORY include/ DESTINATION include)
install(EXPORT ${PROJECT_NAME} DESTINATION cmake)
install(EXPORT ${MODULE_NAME} DESTINATION cmake)

# Add documentation
add_doxygen_source_dir(${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand Down
16 changes: 8 additions & 8 deletions common/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@



project(gwio)
set(MODULE_NAME gwio)

get_property(gw_library_type GLOBAL PROPERTY gw_library_type)
add_library(${PROJECT_NAME} ${gw_library_type}
add_library(${MODULE_NAME} ${gw_library_type}
src/fasta_parser.cpp
src/kseqpp_fasta_parser.cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC gwbase z)
target_link_libraries(${MODULE_NAME} PUBLIC gwbase z)

add_doxygen_source_dir(${CMAKE_CURRENT_SOURCE_DIR}/include/claraparabricks/genomeworks/io)

target_include_directories(${PROJECT_NAME}
target_include_directories(${MODULE_NAME}
PRIVATE
${KSEQPP_DIR}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

target_compile_options(${PROJECT_NAME} PRIVATE -Werror)
target_compile_options(${MODULE_NAME} PRIVATE -Werror)

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
install(TARGETS ${MODULE_NAME}
EXPORT ${MODULE_NAME}
DESTINATION lib
INCLUDES DESTINATION include
)
install(DIRECTORY include/ DESTINATION include)
install(EXPORT ${PROJECT_NAME} DESTINATION cmake)
install(EXPORT ${MODULE_NAME} DESTINATION cmake)

# Add auto formatting.
gw_enable_auto_formatting("${CMAKE_CURRENT_SOURCE_DIR}")
24 changes: 12 additions & 12 deletions cudaaligner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@



project(cudaaligner)
set(MODULE_NAME cudaaligner)

# Project specific NVCC flags
if((CUDA_VERSION_MAJOR GREATER 10) OR (CUDA_VERSION_MAJOR EQUAL 10 AND CUDA_VERSION_MINOR GREATER 0))
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++14 --expt-relaxed-constexpr")
else()
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++14")
endif()
message(STATUS "nvcc flags for cudaaligner: ${CUDA_NVCC_FLAGS}")
message(STATUS "nvcc flags for ${MODULE_NAME}: ${CUDA_NVCC_FLAGS}")

get_property(gw_library_type GLOBAL PROPERTY gw_library_type)
cuda_add_library(cudaaligner ${gw_library_type}
cuda_add_library(${MODULE_NAME} ${gw_library_type}
src/cudaaligner.cpp
src/aligner.cpp
src/alignment.cpp
Expand All @@ -44,25 +44,25 @@ cuda_add_library(cudaaligner ${gw_library_type}
src/hirschberg_myers_gpu.cu
)

add_library(cudaaligner_internal INTERFACE)
target_include_directories(cudaaligner_internal INTERFACE
add_library(${MODULE_NAME}_internal INTERFACE)
target_include_directories(${MODULE_NAME}_internal INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/src
)

target_link_libraries(cudaaligner gwbase cub)
target_link_libraries(${MODULE_NAME} gwbase cub)

target_compile_options(cudaaligner PRIVATE -Werror -Wall -Wextra)
target_compile_options(${MODULE_NAME} PRIVATE -Werror -Wall -Wextra)
if (gw_optimize_for_native_cpu)
target_compile_options(cudapoa PRIVATE -march=native)
endif()

target_include_directories(cudaaligner
target_include_directories(${MODULE_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

target_compile_options(cudaaligner PRIVATE -Werror)
target_compile_options(${MODULE_NAME} PRIVATE -Werror)

add_doxygen_source_dir(${CMAKE_CURRENT_SOURCE_DIR}/include)

Expand All @@ -71,14 +71,14 @@ add_subdirectory(tests)
add_subdirectory(benchmarks)
add_subdirectory(samples)

install(TARGETS cudaaligner
install(TARGETS ${MODULE_NAME}
COMPONENT logging
EXPORT cudaaligner
EXPORT ${MODULE_NAME}
DESTINATION lib
INCLUDES DESTINATION include
)
install(DIRECTORY include/ DESTINATION include)
install(EXPORT cudaaligner DESTINATION cmake)
install(EXPORT ${MODULE_NAME} DESTINATION cmake)

# Add auto formatting.
gw_enable_auto_formatting("${CMAKE_CURRENT_SOURCE_DIR}")
4 changes: 2 additions & 2 deletions cudaaligner/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@



project(benchmark_cudaaligner)
set(MODULE_NAME benchmark_cudaaligner)

set(SOURCES
main.cpp
Expand All @@ -28,7 +28,7 @@ set(LIBS
cudaaligner
gwbase)

gw_add_benchmarks(${PROJECT_NAME} "cudaaligner" "${SOURCES}" "${LIBS}")
gw_add_benchmarks(${MODULE_NAME} "cudaaligner" "${SOURCES}" "${LIBS}")

install(FILES README.md
DESTINATION benchmarks/cudaaligner)
8 changes: 4 additions & 4 deletions cudaaligner/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@



project(sample_cudaaligner)
set(MODULE_NAME sample_cudaaligner)

add_executable(${PROJECT_NAME}
add_executable(${MODULE_NAME}
sample_cudaaligner.cpp
)

target_link_libraries(${PROJECT_NAME}
target_link_libraries(${MODULE_NAME}
cudaaligner
)

install(TARGETS ${PROJECT_NAME}
install(TARGETS ${MODULE_NAME}
DESTINATION samples)
2 changes: 1 addition & 1 deletion cudaaligner/src/batched_device_matrices.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public:

for (int32_t i = 0; i < n_matrices + 1; ++i)
{
offsets_host_[i] = max_elements_per_matrix * i;
offsets_host_[i] = static_cast<ptrdiff_t>(max_elements_per_matrix) * i;
}

construct_device_matrices_async(stream);
Expand Down
32 changes: 16 additions & 16 deletions cudamapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@



project(cudamapper)
set(MODULE_NAME cudamapper)

# Process data subdirectory first
add_subdirectory(data)

GitVersion()

configure_file(${CMAKE_SOURCE_DIR}/common/base/src/version.cpp.in
configure_file(${PROJECT_SOURCE_DIR}/common/base/src/version.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/version.cpp)

find_package(CUDA 9.0 QUIET REQUIRED)
Expand All @@ -41,10 +41,10 @@ else()
CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS "Auto")
endif()
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${ARCH_FLAGS}")
message(STATUS "nvcc flags for cudamapper: ${CUDA_NVCC_FLAGS}")
message(STATUS "nvcc flags for ${MODULE_NAME}: ${CUDA_NVCC_FLAGS}")
endif()

cuda_add_library(cudamapper
cuda_add_library(${MODULE_NAME}
src/application_parameters.cpp
src/cudamapper.cpp
src/index_batcher.cu
Expand All @@ -62,39 +62,39 @@ cuda_add_library(cudamapper
src/utils.cpp
${CMAKE_CURRENT_BINARY_DIR}/version.cpp)

target_include_directories(cudamapper
target_include_directories(${MODULE_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_link_libraries(cudamapper gwbase gwio cub)
target_compile_options(cudamapper PRIVATE -Werror)
target_link_libraries(${MODULE_NAME} gwbase gwio cub)
target_compile_options(${MODULE_NAME} PRIVATE -Werror)

add_doxygen_source_dir(${CMAKE_CURRENT_SOURCE_DIR}/include)

cuda_add_executable(cudamapper-bin
cuda_add_executable(${MODULE_NAME}-bin
src/main.cu
)

target_compile_options(cudamapper-bin PRIVATE -Werror)
target_link_libraries(cudamapper-bin cudamapper cudaaligner)
set_target_properties(cudamapper-bin PROPERTIES OUTPUT_NAME cudamapper)
target_compile_options(${MODULE_NAME}-bin PRIVATE -Werror)
target_link_libraries(${MODULE_NAME}-bin ${MODULE_NAME} cudaaligner)
set_target_properties(${MODULE_NAME}-bin PROPERTIES OUTPUT_NAME ${MODULE_NAME})


# Add tests folder
add_subdirectory(tests)
add_subdirectory(samples)

install(TARGETS cudamapper
EXPORT cudamapper
install(TARGETS ${MODULE_NAME}
EXPORT ${MODULE_NAME}
DESTINATION lib
INCLUDES DESTINATION include
)
install(DIRECTORY include/ DESTINATION include)
install(EXPORT cudamapper DESTINATION cmake)
install(EXPORT ${MODULE_NAME} DESTINATION cmake)

install(TARGETS cudamapper-bin
EXPORT cudamapper-bin
install(TARGETS ${MODULE_NAME}-bin
EXPORT ${MODULE_NAME}-bin
DESTINATION bin
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,51 @@ class IndexHostCopyBase
const cudaStream_t cuda_stream = 0);
};

/// IndexDescriptor Implementation - Every Index is defined by its first read and the number of reads
/// Used in conjunction with a fasta parser object to create an index
class IndexDescriptor
{
public:
/// \brief constructor
IndexDescriptor(read_id_t first_read,
number_of_reads_t number_of_reads);

/// \brief getter
read_id_t first_read() const;

/// \brief getter
number_of_reads_t number_of_reads() const;

/// \brief returns hash value
std::size_t get_hash() const;

private:
/// \brief generates hash
void generate_hash();

/// first read in index
read_id_t first_read_;
/// number of reads in index
number_of_reads_t number_of_reads_;
/// hash of this object
std::size_t hash_;
};

/// \brief equality operator
bool operator==(const IndexDescriptor& lhs,
const IndexDescriptor& rhs);

/// \brief inequality operator
bool operator!=(const IndexDescriptor& lhs,
const IndexDescriptor& rhs);

/// IndexDescriptorHash - operator() calculates hash of a given IndexDescriptor
struct IndexDescriptorHash
{
/// \brief caclulates hash of given IndexDescriptor
std::size_t operator()(const IndexDescriptor& index_descriptor) const;
};

} // namespace cudamapper

} // namespace genomeworks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <string>

#include <claraparabricks/genomeworks/cudamapper/types.hpp>
#include <claraparabricks/genomeworks/cudamapper/index.hpp>

namespace claraparabricks
{
Expand Down Expand Up @@ -50,6 +51,14 @@ void print_paf(const std::vector<Overlap>& overlaps,
int32_t kmer_size,
std::mutex& write_output_mutex);

/// \brief returns a vector of IndexDescriptors in which the sum of basepairs of all reads in one IndexDescriptor is at most max_basepairs_per_index
/// If a single read exceeds max_chunk_size it will be placed in its own IndexDescriptor.
///
/// \param parser parser to get the reads from
/// \param max_basepairs_per_index the maximum number of basepairs in an IndexDescriptor
/// \return vector of IndexDescriptors
std::vector<IndexDescriptor> group_reads_into_indices(const io::FastaParser& parser,
number_of_basepairs_t max_basepairs_per_index = 1000000);
} // namespace cudamapper

} // namespace genomeworks
Expand Down
Loading

0 comments on commit 74ba3a3

Please sign in to comment.