-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from chinwobble/fix-test
Use SIMD for sequence::reversecomplement
- Loading branch information
Showing
48 changed files
with
621 additions
and
5,506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Copyright (c) 2021-2022-2023-2024 Luca Cappa | ||
# Released under the term specified in file LICENSE.txt | ||
# SPDX short identifier: MIT | ||
|
||
# A "pure" GitHub workflow using CMake, Ninja and vcpkg to build a C/C++ codebase. | ||
# It leverages both CMakePresets.json and vcpkg.json. | ||
# It is called "pure workflow" because it is an example which minimizes the usage of | ||
# custom GitHub Actions, but leverages directly the tools that could be easily run on | ||
# your development machines (i.e. CMake, vcpkg, Ninja) to ensure a perfectly identical | ||
# and reproducible local build (on your development machine) and a remote build on | ||
# build agents. | ||
name: ci-cmake | ||
on: | ||
push: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- v11 | ||
- main | ||
|
||
jobs: | ||
job: | ||
name: ${{ matrix.os }}-${{ github.workflow }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-24.04, macos-13, macos-14, windows-2022] | ||
env: | ||
# Indicates the location of the vcpkg as a Git submodule of the project repository. | ||
# Not using "VCPKG_ROOT" because a variable with the same name is defined in the VS's | ||
# Developer Command Prompt environment in VS 2022 17.6, which would override this one | ||
# if it had the same name. | ||
_VCPKG_: ${{ github.workspace }}/vcpkg | ||
# Tells vcpkg where binary packages are stored. | ||
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/bincache | ||
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. | ||
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' | ||
|
||
steps: | ||
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage | ||
# for Binary Caching. | ||
- uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | ||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" | ||
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE | ||
shell: bash | ||
|
||
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. | ||
- uses: lukka/get-cmake@latest | ||
|
||
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching | ||
# when it is being run afterwards by CMake. | ||
- name: Restore vcpkg | ||
uses: actions/cache@v4 | ||
with: | ||
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the | ||
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. | ||
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. | ||
path: | | ||
${{ env._VCPKG_ }} | ||
!${{ env._VCPKG_ }}/buildtrees | ||
!${{ env._VCPKG_ }}/packages | ||
!${{ env._VCPKG_ }}/downloads | ||
!${{ env._VCPKG_ }}/installed | ||
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. | ||
key: | | ||
${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} | ||
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. | ||
# As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK. | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: install build dependencies (Ubuntu) | ||
run: sudo apt update && sudo apt install -y libisal-dev | ||
if: runner.os == 'Linux' | ||
- name: install build dependencies (MacOS) | ||
run: brew install isa-l | ||
if: runner.os == 'macOS' | ||
# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install | ||
# the dependencies as specified in vcpkg.json. Note that the vcpkg's toolchain is specified | ||
# in the CMakePresets.json file. | ||
# This step also runs vcpkg with Binary Caching leveraging GitHub Action cache to | ||
# store the built packages artifacts. | ||
- name: Restore from cache the dependencies and generate project files | ||
run: | | ||
cmake --preset ninja-multi-vcpkg | ||
# Build (Release configuration only) the whole project with Ninja (which is spawn by CMake). | ||
# | ||
# Note: if the preset misses the "configuration", it is possible to explicitly select the | ||
# configuration with the `--config` flag, e.g.: | ||
# run: cmake --build --preset ninja-vcpkg --config Release | ||
- name: Build (Release configuration) | ||
run: | | ||
cmake --build --preset ninja-vcpkg-release | ||
- name: run benchmarks | ||
run: | | ||
./builds/ninja-multi-vcpkg/Release/fastplong_benchmarks | ||
if: runner.os != 'Windows' | ||
|
||
- name: run tests | ||
run: | | ||
./builds/ninja-multi-vcpkg/Release/fastplong_tests | ||
# Test the whole project with CTest, again Release configuration only. | ||
# - name: Test (Release configuration) | ||
# run: | | ||
# ctest --preset test-release |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ | |
*.out | ||
*.app | ||
bin | ||
builds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "vcpkg"] | ||
path = vcpkg | ||
url = https://github.com/microsoft/vcpkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
"ms-vscode.cpptools", | ||
"ms-vscode.cmake-tools" | ||
], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": [ | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# CMakeLists.txt | ||
cmake_minimum_required(VERSION 3.21) | ||
project(fastplong VERSION 0.2.1) | ||
set(CMAKE_CXX_STANDARD 23) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# Find dependencies provided by vcpkg (via vcpkg.cmake) | ||
find_package(hwy CONFIG REQUIRED) | ||
find_package(benchmark CONFIG REQUIRED) | ||
find_package(libdeflate CONFIG REQUIRED) | ||
|
||
if (MSVC) | ||
find_package(unofficial-isal CONFIG REQUIRED) | ||
set( | ||
FASTPLONG_LIBS | ||
hwy::hwy | ||
unofficial::isal::isal | ||
$<IF:$<TARGET_EXISTS:libdeflate::libdeflate_shared>,libdeflate::libdeflate_shared,libdeflate::libdeflate_static> | ||
) | ||
else() | ||
set( | ||
FASTPLONG_LIBS | ||
hwy::hwy | ||
$<IF:$<TARGET_EXISTS:libdeflate::libdeflate_shared>,libdeflate::libdeflate_shared,libdeflate::libdeflate_static> | ||
-lisal | ||
) | ||
endif() | ||
|
||
if (CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "x86_64") | ||
add_compile_options(-march=haswell -maes) | ||
## HWY_AVX3 which is 512 | ||
# SET(GCC_COVERAGE_COMPILE_FLAGS "-march=sapphirerapids") | ||
endif() | ||
if (MSVC) | ||
add_compile_options(/arch:AVX2) | ||
endif() | ||
|
||
set( | ||
FASTPLONG_SOURCES | ||
src/adaptertrimmer.cpp | ||
src/editdistance.cpp | ||
src/evaluator.cpp | ||
src/fastareader.cpp | ||
src/fastqreader.cpp | ||
src/filter.cpp | ||
src/filterresult.cpp | ||
src/jsonreporter.cpp | ||
src/htmlreporter.cpp | ||
src/nucleotidetree.cpp | ||
src/options.cpp | ||
src/polyx.cpp | ||
src/processor.cpp | ||
src/read.cpp | ||
src/readpool.cpp | ||
src/seprocessor.cpp | ||
src/sequence.cpp | ||
src/stats.cpp | ||
src/threadconfig.cpp | ||
src/writer.cpp | ||
src/writerthread.cpp | ||
) | ||
|
||
set( | ||
FASTPLONG_TEST_SOURCES | ||
test/adaptertrimmer_test.cpp | ||
test/fastareader_test.cpp | ||
test/filter_test.cpp | ||
test/nucleotidetree_test.cpp | ||
test/read_test.cpp | ||
test/evaluator_test.cpp | ||
test/fastqreader_test.cpp | ||
test/globals.cpp | ||
test/polyx_test.cpp | ||
test/sequence_test.cpp | ||
) | ||
include_directories( | ||
/usr/local/include | ||
# arm64 mac install location | ||
/opt/homebrew/include | ||
) | ||
link_directories( | ||
/usr/local/lib | ||
# arm64 mac install location | ||
/opt/homebrew/lib | ||
) | ||
|
||
|
||
if (NOT MSVC) | ||
# benchmark target | ||
add_executable(fastplong_benchmarks) | ||
target_sources( | ||
fastplong_benchmarks PRIVATE | ||
benchmarks/sequence_benchmark.cpp | ||
test/globals.cpp | ||
${FASTPLONG_SOURCES} | ||
) | ||
target_link_libraries( | ||
fastplong_benchmarks PRIVATE | ||
${FASTPLONG_LIBS} | ||
benchmark::benchmark | ||
benchmark::benchmark_main | ||
) | ||
endif() | ||
# main target | ||
add_executable(fastplong src/main.cpp ${FASTPLONG_SOURCES}) | ||
target_link_libraries( | ||
fastplong PUBLIC | ||
${FASTPLONG_LIBS} | ||
) | ||
# tests target | ||
enable_testing() | ||
find_package(GTest CONFIG REQUIRED) | ||
add_executable(fastplong_tests ${FASTPLONG_SOURCES} ${FASTPLONG_TEST_SOURCES}) | ||
target_link_libraries( | ||
fastplong_tests PRIVATE | ||
${FASTPLONG_LIBS} | ||
GTest::gtest | ||
GTest::gtest_main | ||
-lpthread | ||
) | ||
add_test(fastplong_tests fastplong_tests) |
Oops, something went wrong.