Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ParallelTestHelpers::ParallelRunner Class Reference

Runs a callable in parallel. More...

#include <ParallelRunner.h>

Public Member Functions

 ParallelRunner ()
 
 ParallelRunner (const int threads)
 
template<class Function , class... Args>
void runParallel (Function &&f, Args &&...args)
 
template<class Function , class... Args>
void runSerial (Function &&f, Args &&...args)
 
int size () const
 

Private Attributes

std::shared_ptr< Mantid::Parallel::detail::ThreadingBackend > m_backend
 
std::shared_ptr< Mantid::Parallel::detail::ThreadingBackend > m_serialBackend
 

Detailed Description

Runs a callable in parallel.

This is mainly a helper for testing code with MPI calls. ParallelRunner passes a Communicator as first argument to the callable. In runs with only a single MPI rank the callable is executed in threads to mimic MPI ranks.

Definition at line 24 of file ParallelRunner.h.

Constructor & Destructor Documentation

◆ ParallelRunner() [1/2]

ParallelTestHelpers::ParallelRunner::ParallelRunner ( )

Definition at line 16 of file ParallelRunner.cpp.

References m_backend, and m_serialBackend.

◆ ParallelRunner() [2/2]

ParallelTestHelpers::ParallelRunner::ParallelRunner ( const int  threads)

Definition at line 29 of file ParallelRunner.cpp.

References m_backend, and m_serialBackend.

Member Function Documentation

◆ runParallel()

template<class Function , class... Args>
void ParallelTestHelpers::ParallelRunner::runParallel ( Function &&  f,
Args &&...  args 
)

Definition at line 43 of file ParallelRunner.h.

References m_backend.

Referenced by ParallelTestHelpers::runParallel().

◆ runSerial()

template<class Function , class... Args>
void ParallelTestHelpers::ParallelRunner::runSerial ( Function &&  f,
Args &&...  args 
)

Definition at line 39 of file ParallelRunner.h.

References m_serialBackend.

◆ size()

int ParallelTestHelpers::ParallelRunner::size ( ) const

Definition at line 41 of file ParallelRunner.cpp.

References m_backend.

Member Data Documentation

◆ m_backend

std::shared_ptr<Mantid::Parallel::detail::ThreadingBackend> ParallelTestHelpers::ParallelRunner::m_backend
private

Definition at line 35 of file ParallelRunner.h.

Referenced by ParallelRunner(), runParallel(), and size().

◆ m_serialBackend

std::shared_ptr<Mantid::Parallel::detail::ThreadingBackend> ParallelTestHelpers::ParallelRunner::m_serialBackend
private

Definition at line 36 of file ParallelRunner.h.

Referenced by ParallelRunner(), and runSerial().


The documentation for this class was generated from the following files: