blob: 73571ddf10c4ef7d6cfca4a715e7268999e5a1de [file] [log] [blame]
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2016 Benoit Steiner <benoit.steiner.goog@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// 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/.
#ifndef EIGEN_CXX11_THREADPOOL_MODULE
#define EIGEN_CXX11_THREADPOOL_MODULE
#include "../../../Eigen/Core"
#include <Eigen/src/Core/util/DisableStupidWarnings.h>
/** \defgroup CXX11_ThreadPool_Module C++11 ThreadPool Module
*
* This module provides 2 threadpool implementations
* - a simple reference implementation
* - a faster non blocking implementation
*
* This module requires C++11.
*
* \code
* #include <Eigen/CXX11/ThreadPool>
* \endcode
*/
// The code depends on CXX11, so only include the module if the
// compiler supports it.
#if __cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900
#include <cstddef>
#include <cstring>
#include <stdint.h>
#include <time.h>
#include <vector>
using ::std::vector;
#include <atomic>
#include <deque>
using ::std::deque;
#include <functional>
using ::std::binary_function;
using ::std::equal_to;
using ::std::greater;
#include <memory>
using ::std::allocator;
#if defined(EIGEN_USE_CUSTOM_THREAD_POOL)
// Use standard C++ synchronization primitives.
#include <condition_variable>
#include <mutex>
#include <thread>
#else
// Use tensorflow synchronization primitives.
#include "third_party/tensorflow/core/platform/types.h"
#include "third_party/tensorflow/core/platform/mutex.h"
#endif // EIGEN_USE_CUSTOM_THREAD_POOL
#ifdef EIGEN_USE_CUSTOM_THREAD_POOL
typedef std::mutex mutex;
typedef std::condition_variable condition_variable;
typedef std::unique_lock<std::mutex> mutex_lock;
#else
typedef tensorflow::mutex mutex;
typedef tensorflow::condition_variable condition_variable;
typedef tensorflow::mutex_lock mutex_lock;
#endif
#include "unsupported/Eigen/CXX11/Core"
#include "unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h"
#include "unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h"
#include "unsupported/Eigen/CXX11/src/Tensor/ThreadPoolInterface.h"
#include "unsupported/Eigen/CXX11/src/Tensor/TensorNonBlockingThreadPool.h"
#include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceType.h"
#endif
#include <Eigen/src/Core/util/ReenableStupidWarnings.h>
#endif // EIGEN_CXX11_THREADPOOL_MODULE