Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement runtime dispatch of SIMD code #96

Merged
merged 9 commits into from
Feb 5, 2024
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build trimal for Linux x86_64
if: matrix.arch == 'x86_64' && matrix.cpu_instr == 'non_SIMD'
run: cmake . -DDISABLE_SSE2=1 -DDISABLE_AVX2=1 && make && file bin/trimal && file bin/readal &&
Expand Down Expand Up @@ -67,4 +69,4 @@ jobs:
apt-get install -q -y cmake make g++ file
run: |
cmake . -DDISABLE_SSE2=1 -DDISABLE_AVX2=1 && make && file bin/trimal && file bin/readal &&
./scripts/generate_trimmed_msas.sh && ./scripts/compare_trimmed_msas.sh
./scripts/generate_trimmed_msas.sh && ./scripts/compare_trimmed_msas.sh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vendor/cpu_features"]
path = vendor/cpu_features
url = https://github.com/google/cpu_features
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ add_executable(test
${TRIMAL_OBJECTS})
SET_TARGET_PROPERTIES(test PROPERTIES EXCLUDE_FROM_ALL True)

# Add `cpu_features` for detecting supported SIMD at compile time
add_subdirectory(vendor/cpu_features)
include_directories(vendor/cpu_features/include)
target_link_libraries(trimal cpu_features)
target_link_libraries(readal cpu_features)

# Link the mathematical library to the targets
target_link_libraries(trimal m)
target_link_libraries(readal m)
Expand Down
14 changes: 14 additions & 0 deletions include/Statistics/Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,27 @@ namespace statistics {
class Identity;
class Overlap;

/**
* \brief Enum to store the different supported compute kernels for the statistics.
*/
enum ComputePlatform {
NONE,
SSE2,
AVX2,
NEON,
};

/**
* \brief Class to handle the interaction with Alignment and statistics objects.\n
* It serves as a wrapper or intermediate between the alignment and each specific stat.\n
* It also encapsulates the similarityMatrix.
*/
class Manager {
public:
/**
* \brief
* */
ComputePlatform platform = ComputePlatform::NONE;

/**
* \brief Gaps submodule
Expand Down
2 changes: 2 additions & 0 deletions include/reportsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ enum InfoCode {

RemovingDuplicateSequences = 4,

UsingPlatform = 5,


__MAXINFO
};
Expand Down
Loading
Loading