<commit_before>// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2014 <NAME> <<EMAIL>>
//
// 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/.

#define EIGEN_USE_THREADS


#include "main.h"
#include <Eigen/CXX11/Tensor>
#include "thread/threadpool.h"

using Eigen::Tensor;

void test_cxx11_tensor_thread_pool()
{
  Eigen::Tensor<float, 3> in1(Eigen::array<ptrdiff_t, 3>(2,3,7));
  Eigen::Tensor<float, 3> in2(Eigen::array<ptrdiff_t, 3>(2,3,7));
  Eigen::Tensor<float, 3> out(Eigen::array<ptrdiff_t, 3>(2,3,7));

  in1.setRandom();
  in2.setRandom();

  ThreadPool thread_pool(2);
  thread_pool.StartWorkers();
  Eigen::ThreadPoolDevice thread_pool_device(&thread_pool, 3);<commit_msg>Fixed the threadpool test<commit_after>// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2014 <NAME> <<EMAIL>>
//
// 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/.

#define EIGEN_USE_THREADS


#include "main.h"
#include <Eigen/CXX11/Tensor>

using Eigen::Tensor;

void test_cxx11_tensor_thread_pool()
{
  Eigen::Tensor<float, 3> in1(Eigen::array<ptrdiff_t, 3>(2,3,7));
  Eigen::Tensor<float, 3> in2(Eigen::array<ptrdiff_t, 3>(2,3,7));
  Eigen::Tensor<float, 3> out(Eigen::array<ptrdiff_t, 3>(2,3,7));

  in1.setRandom();
  in2.setRandom();

  Eigen::ThreadPoolDevice thread_pool_device(3);
{'fraction_non_alphanumeric': 0.15502958579881657, 'fraction_numerical': 0.038461538461538464, 'mean_word_length': 4.7322033898305085, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2881473', 'n_tokens_mistral': 661, 'n_tokens_neox': 609, 'n_words': 168}