JDFTx  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thread.h File Reference

Utilities for threading (wrappers around std::thread) More...

#include <core/Util.h>
#include <thread>
#include <mutex>
#include <unistd.h>

Classes

class  AutoThreadCount
 Maintain thread timing statistics and automatically choose the optimum number of threads. More...
 

Functions

bool shouldThreadOperators ()
 
void suspendOperatorThreading ()
 call from multi-threaded top-level code to disable threading within operators called from a parallel section
 
void resumeOperatorThreading ()
 call after a parallel section in top-level code to resume threading within subsequent operator calls
 
template<typename Callable , typename... Args>
void threadLaunch (int nThreads, Callable *func, size_t nJobs, Args...args)
 A simple utility for running muliple threads. More...
 
template<typename Callable , typename... Args>
void threadLaunch (Callable *func, size_t nJobs, Args...args)
 
template<typename Callable , typename... Args>
void threadLaunch (AutoThreadCount *, Callable *func, size_t nJobs, Args...args)
 
template<typename Callable , typename... Args>
void threadedLoop (Callable *func, size_t nIter, Args...args)
 A parallelized loop. More...
 
template<typename Callable , typename... Args>
double threadedAccumulate (Callable *func, size_t nIter, Args...args)
 A parallelized loop with an accumulated return value. More...
 

Variables

int nProcsAvailable
 number of available processors (initialized to number of online processors, can be overriden)
 

Detailed Description

Utilities for threading (wrappers around std::thread)