/
vuron
/
adept
Обзор
Документация
Войти
/
vuron
/
adept
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/vulkan_tests.cpp
50 строк
1 KB
lexasub
introduce optional usage openblas
09 апр 2025, 11:01
09 апр 2025, 11:01
3f09613
Код
Авторство
О чём код?
#include <adept/dispatch/dispatcher.hpp> #include "catch.hpp" #include "test_utils.hpp" using namespace adept; using namespace adept::test; namespace { struct VulkanGPUFixture { VulkanGPUFixture() { Dispatcher::instance().set_current_backend(device_t::GPU, backend_t::Vulkan); } }; } // namespace TEST_CASE_METHOD(VulkanGPUFixture, "tensor float64 fails", "[vulkan]") { Tensor t; REQUIRE_THROWS(t = Tensor::empty(TensorProperties{ .shape = {3, 3}, .device = device_t::GPU, .dtype = dtype_t::Float64})); } TEST_CASE_METHOD(VulkanGPUFixture, "tensor int32 fails", "[vulkan]") { Tensor t; REQUIRE_THROWS(t = Tensor::empty(TensorProperties{ .shape = {3, 3}, .device = device_t::GPU, .dtype = dtype_t::Int32})); } TEST_CASE_METHOD(VulkanGPUFixture, "tensor int8 fails", "[vulkan]") { Tensor t; REQUIRE_THROWS(t = Tensor::empty(TensorProperties{ .shape = {3, 3}, .device = device_t::GPU, .dtype = dtype_t::Int8})); } #ifdef WITH_CPU TEST_CASE_METHOD(VulkanGPUFixture, "tensors addf move device", "[vulkan]") { auto [dx, dy, dz] = make_test_data<float32_t, std::plus>(); Tensor x = Tensor::from_blob(dx.data(), TensorProperties{.shape = {3, 3}, .device = device_t::CPU}); Tensor y = Tensor::from_blob(dy.data(), TensorProperties{.shape = {3, 3}, .device = device_t::CPU}); x = x.gpu(); y = y.gpu(); auto z = x + y; equals(dz, z.cpu()); } #endif