Skip to content

ExtremeScale/ThreadPool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Chris Sullivan
May 5, 2016
1ada200 · May 5, 2016

History

40 Commits
Apr 30, 2016
May 5, 2016
Mar 21, 2016
Apr 30, 2016
Apr 29, 2016
Mar 15, 2016
Mar 23, 2016
Apr 30, 2016

Repository files navigation

std::thread based thread pool

A simple std::thread based thread pool with a parallel-for loop implementation.

Example of how to perform STREAM benchmark scale operation in parallel:

void scale(int i, double* a, double* b) {
        a[i]=4*b[i];
}

int main () {

        ThreadPool pool(8);

        int N = 1e9;
        auto a = (double*)calloc(N,sizeof(double));
        auto b = (double*)calloc(N,sizeof(double));
        for (int i=0; i<N; i++) { b[i] = i; }

        {
            Timer timer([&](int elapsed) { cout << elapsed*1e-6 << " ms\n"; });
            pool.ParallelFor(0,N,scale,a,b);
        }


        return 0;
}

About

A simple C++11 threadpool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.1%
  • Makefile 3.7%
  • CMake 0.2%