mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Enabled the new threadpool tests
This commit is contained in:
parent
9c064b5a97
commit
bebb89acfa
@ -275,6 +275,10 @@ inline void verify_impl(bool condition, const char *testname, const char *file,
|
|||||||
|
|
||||||
#define VERIFY(a) ::verify_impl(a, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(a))
|
#define VERIFY(a) ::verify_impl(a, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(a))
|
||||||
|
|
||||||
|
#define VERIFY_GE(a, b) ::verify_impl(a >= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(a >= b))
|
||||||
|
#define VERIFY_LE(a, b) ::verify_impl(a <= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(a <= b))
|
||||||
|
|
||||||
|
|
||||||
#define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b))
|
#define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b))
|
||||||
#define VERIFY_IS_NOT_EQUAL(a, b) VERIFY(!test_is_equal(a, b))
|
#define VERIFY_IS_NOT_EQUAL(a, b) VERIFY(!test_is_equal(a, b))
|
||||||
#define VERIFY_IS_APPROX(a, b) VERIFY(verifyIsApprox(a, b))
|
#define VERIFY_IS_APPROX(a, b) VERIFY(verifyIsApprox(a, b))
|
||||||
|
@ -116,6 +116,8 @@ if(EIGEN_TEST_CXX11)
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
ei_add_test(cxx11_float16)
|
ei_add_test(cxx11_float16)
|
||||||
|
ei_add_test(cxx11_eventcount "-pthread" "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
|
ei_add_test(cxx11_runqueue "-pthread" "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
ei_add_test(cxx11_meta)
|
ei_add_test(cxx11_meta)
|
||||||
ei_add_test(cxx11_tensor_simple)
|
ei_add_test(cxx11_tensor_simple)
|
||||||
# ei_add_test(cxx11_tensor_symmetry)
|
# ei_add_test(cxx11_tensor_symmetry)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// Public License v. 2.0. If a copy of the MPL was not distributed
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
||||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#define EIGEN_USE_THREADS
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <Eigen/CXX11/ThreadPool>
|
#include <Eigen/CXX11/ThreadPool>
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
// Public License v. 2.0. If a copy of the MPL was not distributed
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
||||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#define EIGEN_USE_THREADS
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#include <Eigen/CXX11/ThreadPool>
|
#include <Eigen/CXX11/ThreadPool>
|
||||||
|
|
||||||
static void test_basic_runqueue()
|
void test_basic_runqueue()
|
||||||
{
|
{
|
||||||
RunQueue<int, 4> q;
|
RunQueue<int, 4> q;
|
||||||
// Check empty state.
|
// Check empty state.
|
||||||
@ -96,7 +96,7 @@ static void test_basic_runqueue()
|
|||||||
// 1 element (either front or back at random). So queue always contains at least
|
// 1 element (either front or back at random). So queue always contains at least
|
||||||
// 1 element, but otherwise changes chaotically. Another thread constantly tests
|
// 1 element, but otherwise changes chaotically. Another thread constantly tests
|
||||||
// that the queue is not claimed to be empty.
|
// that the queue is not claimed to be empty.
|
||||||
static void test_empty_runqueue()
|
void test_empty_runqueue()
|
||||||
{
|
{
|
||||||
RunQueue<int, 4> q;
|
RunQueue<int, 4> q;
|
||||||
q.PushFront(1);
|
q.PushFront(1);
|
||||||
@ -136,7 +136,7 @@ static void test_empty_runqueue()
|
|||||||
// Stress is a chaotic random test.
|
// Stress is a chaotic random test.
|
||||||
// One thread (owner) calls PushFront/PopFront, other threads call PushBack/
|
// One thread (owner) calls PushFront/PopFront, other threads call PushBack/
|
||||||
// PopBack. Ensure that we don't crash, deadlock, and all sanity checks pass.
|
// PopBack. Ensure that we don't crash, deadlock, and all sanity checks pass.
|
||||||
static void test_stress_runqueue()
|
void test_stress_runqueue()
|
||||||
{
|
{
|
||||||
const int kEvents = 1 << 18;
|
const int kEvents = 1 << 18;
|
||||||
RunQueue<int, 8> q;
|
RunQueue<int, 8> q;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user