Commit ca11ff49 authored by Davis King's avatar Davis King

Added more stuff to tests

parent 5f5c46f4
...@@ -47,6 +47,7 @@ namespace ...@@ -47,6 +47,7 @@ namespace
matrix<float> truth = 2*mat(c)+trans(mat(a))*trans(mat(b)); matrix<float> truth = 2*mat(c)+trans(mat(a))*trans(mat(b));
a.async_copy_to_device(); b.async_copy_to_device(); c.async_copy_to_device();
cuda::gemm(2, c, 1, a, true, b, true); cuda::gemm(2, c, 1, a, true, b, true);
DLIB_TEST(max(abs(truth-mat(c))) < 1e-6); DLIB_TEST(max(abs(truth-mat(c))) < 1e-6);
} }
...@@ -59,6 +60,7 @@ namespace ...@@ -59,6 +60,7 @@ namespace
matrix<float> truth = 2*mat(c)+trans(mat(a))*mat(b); matrix<float> truth = 2*mat(c)+trans(mat(a))*mat(b);
a.async_copy_to_device(); b.async_copy_to_device(); c.async_copy_to_device();
cuda::gemm(2, c, 1, a, true, b, false); cuda::gemm(2, c, 1, a, true, b, false);
DLIB_TEST(max(abs(truth-mat(c))) < 1e-6); DLIB_TEST(max(abs(truth-mat(c))) < 1e-6);
} }
...@@ -71,6 +73,7 @@ namespace ...@@ -71,6 +73,7 @@ namespace
matrix<float> truth = 2*mat(c)+mat(a)*trans(mat(b)); matrix<float> truth = 2*mat(c)+mat(a)*trans(mat(b));
a.async_copy_to_device(); b.async_copy_to_device(); c.async_copy_to_device();
cuda::gemm(2, c, 1, a, false, b, true); cuda::gemm(2, c, 1, a, false, b, true);
DLIB_TEST(max(abs(truth-mat(c))) < 1e-6); DLIB_TEST(max(abs(truth-mat(c))) < 1e-6);
} }
...@@ -83,6 +86,7 @@ namespace ...@@ -83,6 +86,7 @@ namespace
matrix<float> truth = mat(c)+mat(a)*trans(mat(b)); matrix<float> truth = mat(c)+mat(a)*trans(mat(b));
a.async_copy_to_device(); b.async_copy_to_device(); c.async_copy_to_device();
cuda::gemm(1, c, 1, a, false, b, true); cuda::gemm(1, c, 1, a, false, b, true);
DLIB_TEST(max(abs(truth-mat(c))) < 1e-6); DLIB_TEST(max(abs(truth-mat(c))) < 1e-6);
} }
...@@ -95,6 +99,7 @@ namespace ...@@ -95,6 +99,7 @@ namespace
matrix<float> truth = 2*mat(c)+mat(a)*mat(b); matrix<float> truth = 2*mat(c)+mat(a)*mat(b);
a.async_copy_to_device(); b.async_copy_to_device(); c.async_copy_to_device();
cuda::gemm(2, c, 1, a, false, b, false); cuda::gemm(2, c, 1, a, false, b, false);
DLIB_TEST(max(abs(truth-mat(c))) < 1e-6); DLIB_TEST(max(abs(truth-mat(c))) < 1e-6);
} }
...@@ -104,6 +109,7 @@ namespace ...@@ -104,6 +109,7 @@ namespace
c = std::numeric_limits<float>::infinity(); c = std::numeric_limits<float>::infinity();
a = matrix_cast<float>(gaussian_randm(a.num_samples(),a.size()/a.num_samples())); a = matrix_cast<float>(gaussian_randm(a.num_samples(),a.size()/a.num_samples()));
b = matrix_cast<float>(gaussian_randm(b.num_samples(),b.size()/b.num_samples())); b = matrix_cast<float>(gaussian_randm(b.num_samples(),b.size()/b.num_samples()));
a.async_copy_to_device(); b.async_copy_to_device(); c.async_copy_to_device();
matrix<float> truth = mat(a)*mat(b); matrix<float> truth = mat(a)*mat(b);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment