[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/navono/cpp-taskflow/master/example/executor.cpp [Back]  [Original]

// 2018/10/24 - created by Tsung-Wei Huang
//
// This program demonstrates how to share the executor among different
// taskflow objects to avoid over subcription of threads.

#include 
#include 
#include 
#include 

// Parameters
size_t MAX_TASKFLOW;
const size_t MAX_COUNT    = 100;
const size_t MAX_THREAD   = std::thread::hardware_concurrency();

// do some useful work
void matrix_multiplication() {

  thread_local std::random_device r;
  thread_local std::default_random_engine eng(r());
  thread_local std::uniform_int_distribution dist(1, 100);

  std::vector a (MAX_COUNT);
  std::vector b (MAX_COUNT);
  std::vector c (MAX_COUNT);
  
  // initialize the matrix
  for(size_t i=0; i

Web Proxy Viewer  |  New URL  |  Original Page