Add GPUBackend

This commit is contained in:
2025-08-01 14:20:32 +00:00
parent 404fbd3c02
commit b7c13be6c0
17 changed files with 233 additions and 11 deletions

View File

@@ -11,3 +11,8 @@ if(USE_MKL)
add_executable(benchmark_mkl benchmark_mkl.cpp)
target_link_libraries(benchmark_mkl PRIVATE trigdx)
endif()
if(USE_GPU)
add_executable(benchmark_gpu benchmark_gpu.cpp)
target_link_libraries(benchmark_gpu PRIVATE trigdx gpu)
endif()

View File

@@ -0,0 +1,9 @@
#include <trigdx/gpu.hpp>
#include "benchmark_utils.hpp"
int main() {
benchmark_sinf<GPUBackend>();
benchmark_cosf<GPUBackend>();
benchmark_sincosf<GPUBackend>();
}

View File

@@ -25,7 +25,7 @@ template <typename Backend> inline void benchmark_sinf() {
x[i] = (i % 360) * 0.0174533f; // degrees to radians
Backend backend;
backend.init();
backend.init(N);
auto start = std::chrono::high_resolution_clock::now();
backend.compute_sinf(N, x.data(), s.data());
@@ -44,7 +44,7 @@ template <typename Backend> inline void benchmark_cosf() {
x[i] = (i % 360) * 0.0174533f; // degrees to radians
Backend backend;
backend.init();
backend.init(N);
auto start = std::chrono::high_resolution_clock::now();
backend.compute_cosf(N, x.data(), c.data());
@@ -63,7 +63,7 @@ template <typename Backend> inline void benchmark_sincosf() {
x[i] = (i % 360) * 0.0174533f; // degrees to radians
Backend backend;
backend.init();
backend.init(N);
auto start = std::chrono::high_resolution_clock::now();
backend.compute_sincosf(N, x.data(), s.data(), c.data());