Add GPUBackend
This commit is contained in:
@@ -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()
|
||||
|
||||
9
benchmarks/benchmark_gpu.cpp
Normal file
9
benchmarks/benchmark_gpu.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <trigdx/gpu.hpp>
|
||||
|
||||
#include "benchmark_utils.hpp"
|
||||
|
||||
int main() {
|
||||
benchmark_sinf<GPUBackend>();
|
||||
benchmark_cosf<GPUBackend>();
|
||||
benchmark_sincosf<GPUBackend>();
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user