Add GPUBackend
This commit is contained in:
@@ -26,3 +26,9 @@ add_test(NAME test_lookup COMMAND test_lookup)
|
||||
if(USE_MKL)
|
||||
add_test(NAME test_mkl COMMAND test_mkl)
|
||||
endif()
|
||||
|
||||
if(USE_GPU)
|
||||
add_executable(test_gpu test_gpu.cpp)
|
||||
target_link_libraries(test_gpu PRIVATE trigdx Catch2::Catch2WithMain)
|
||||
add_test(NAME test_gpu COMMAND test_gpu)
|
||||
endif()
|
||||
|
||||
10
tests/test_gpu.cpp
Normal file
10
tests/test_gpu.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <trigdx/gpu.hpp>
|
||||
|
||||
#include "test_utils.hpp"
|
||||
|
||||
TEST_CASE("sinf") { test_sinf<GPUBackend>(1e-1f); }
|
||||
|
||||
TEST_CASE("cosf") { test_cosf<GPUBackend>(1e-1f); }
|
||||
|
||||
TEST_CASE("sincosf") { test_sincosf<GPUBackend>(1e-1f); }
|
||||
@@ -18,7 +18,7 @@ template <typename Backend> inline void test_sinf(float tol) {
|
||||
|
||||
ReferenceBackend ref;
|
||||
Backend backend;
|
||||
backend.init();
|
||||
backend.init(N);
|
||||
|
||||
ref.compute_sinf(N, x.data(), s_ref.data());
|
||||
backend.compute_sinf(N, x.data(), s.data());
|
||||
@@ -37,7 +37,7 @@ template <typename Backend> inline void test_cosf(float tol) {
|
||||
|
||||
ReferenceBackend ref;
|
||||
Backend backend;
|
||||
backend.init();
|
||||
backend.init(N);
|
||||
|
||||
ref.compute_cosf(N, x.data(), c_ref.data());
|
||||
backend.compute_cosf(N, x.data(), c.data());
|
||||
@@ -56,7 +56,7 @@ template <typename Backend> inline void test_sincosf(float tol) {
|
||||
|
||||
ReferenceBackend ref;
|
||||
Backend backend;
|
||||
backend.init();
|
||||
backend.init(N);
|
||||
|
||||
ref.compute_sincosf(N, x.data(), s_ref.data(), c_ref.data());
|
||||
backend.compute_sincosf(N, x.data(), s.data(), c.data());
|
||||
|
||||
Reference in New Issue
Block a user