Graph Framework
Loading...
Searching...
No Matches
workflow::manager< T, SAFE_MATH > Class Template Reference

Class representing a workflow manager. More...

#include <workflow.hpp>

Public Member Functions

 manager (const size_t index)
 Workflow manager constructor.
 
template<order O = run_item>
void add_callback_item (std::function< void(void)> callback)
 Add a pre callback function.
 
template<order O = run_item>
void add_item (graph::input_nodes< T, SAFE_MATH > in, graph::output_nodes< T, SAFE_MATH > out, graph::map_nodes< T, SAFE_MATH > maps, graph::input_nodes< T, SAFE_MATH > atomics, graph::shared_random_state< T, SAFE_MATH > state, const std::string name, const size_t size)
 Add a workflow item.
 
template<order O = run_item>
void add_zero_item (graph::input_nodes< T, SAFE_MATH > in)
 Add a zero item.
 
template<order O = run_item>
void add_copy_item (graph::copy_nodes< T, SAFE_MATH > maps)
 Add a copy item.
 
template<order O = run_item>
void add_loop_item (graph::input_nodes< T, SAFE_MATH > in, graph::output_nodes< T, SAFE_MATH > out, graph::map_nodes< T, SAFE_MATH > maps, graph::input_nodes< T, SAFE_MATH > atomics, graph::shared_random_state< T, SAFE_MATH > state, const std::string name, const size_t size, const size_t iterations)
 Add a loop item.
 
template<order O = run_item>
void add_converge_item (graph::input_nodes< T, SAFE_MATH > in, graph::output_nodes< T, SAFE_MATH > out, graph::map_nodes< T, SAFE_MATH > maps, graph::input_nodes< T, SAFE_MATH > atomics, graph::shared_random_state< T, SAFE_MATH > state, const std::string name, const size_t size, const T tol=1.0E-30, const size_t max_iter=1000)
 Add a converge item.
 
void compile ()
 Compile the workflow items.
 
template<order O = run_item>
void run ()
 Run work items.
 
void wait ()
 Wait for GPU queue to finish.
 
void copy_to_device (graph::shared_leaf< T, SAFE_MATH > &node, T *destination)
 Copy buffer contents to the device.
 
void copy_to_host (graph::shared_leaf< T, SAFE_MATH > &node, T *destination)
 Copy contexts of buffer to host.
 
void print (const size_t index, const graph::output_nodes< T, SAFE_MATH > &nodes)
 Print results.
 
T check_value (const size_t index, const graph::shared_leaf< T, SAFE_MATH > &node)
 Check the value.
 
jit::context< T, SAFE_MATH > & get_context ()
 Get the jit context.
 

Detailed Description

template<jit::float_scalar T, bool SAFE_MATH = false>
class workflow::manager< T, SAFE_MATH >

Class representing a workflow manager.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.

Constructor & Destructor Documentation

◆ manager()

template<jit::float_scalar T, bool SAFE_MATH = false>
workflow::manager< T, SAFE_MATH >::manager ( const size_t  index)
inline

Workflow manager constructor.

For GPU devices, this select the device number to run on. For CPU devices this parameter is ignored.

Note
It is possible to create multiple workflow managers for the same GPU device and may have performance benefits todo so.
Parameters
[in]indexDevice index.

Member Function Documentation

◆ add_callback_item()

template<jit::float_scalar T, bool SAFE_MATH = false>
template<order O = run_item>
void workflow::manager< T, SAFE_MATH >::add_callback_item ( std::function< void(void)>  callback)
inline

Add a pre callback function.

Template Parameters
OThe workflow::order
Parameters
[in]callbackLambda function to run.

◆ add_converge_item()

template<jit::float_scalar T, bool SAFE_MATH = false>
template<order O = run_item>
void workflow::manager< T, SAFE_MATH >::add_converge_item ( graph::input_nodes< T, SAFE_MATH >  in,
graph::output_nodes< T, SAFE_MATH >  out,
graph::map_nodes< T, SAFE_MATH >  maps,
graph::input_nodes< T, SAFE_MATH >  atomics,
graph::shared_random_state< T, SAFE_MATH >  state,
const std::string  name,
const size_t  size,
const T  tol = 1.0E-30,
const size_t  max_iter = 1000 
)
inline

Add a converge item.

Template Parameters
OThe workflow::order
Parameters
[in]inInput variables.
[in]outOutput nodes.
[in]mapsSetter maps.
[in]atomicsInput variables for atomic operations.
[in]stateRandom state node.
[in]nameName of the work item.
[in]sizeSize of the work item.
[in]tolTolerance to converge the function to.
[in]max_iterMaximum number of iterations before giving up.

◆ add_copy_item()

template<jit::float_scalar T, bool SAFE_MATH = false>
template<order O = run_item>
void workflow::manager< T, SAFE_MATH >::add_copy_item ( graph::copy_nodes< T, SAFE_MATH >  maps)
inline

Add a copy item.

Template Parameters
OThe workflow::order
Parameters
[in]mapsCopy maps.

◆ add_item()

template<jit::float_scalar T, bool SAFE_MATH = false>
template<order O = run_item>
void workflow::manager< T, SAFE_MATH >::add_item ( graph::input_nodes< T, SAFE_MATH >  in,
graph::output_nodes< T, SAFE_MATH >  out,
graph::map_nodes< T, SAFE_MATH >  maps,
graph::input_nodes< T, SAFE_MATH >  atomics,
graph::shared_random_state< T, SAFE_MATH >  state,
const std::string  name,
const size_t  size 
)
inline

Add a workflow item.

Template Parameters
OThe workflow::order
Parameters
[in]inInput variables.
[in]outOutput nodes.
[in]mapsSetter maps.
[in]atomicsInput variables for atomic operations.
[in]stateRandom state node.
[in]nameName of the work item.
[in]sizeSize of the work item.

◆ add_loop_item()

template<jit::float_scalar T, bool SAFE_MATH = false>
template<order O = run_item>
void workflow::manager< T, SAFE_MATH >::add_loop_item ( graph::input_nodes< T, SAFE_MATH >  in,
graph::output_nodes< T, SAFE_MATH >  out,
graph::map_nodes< T, SAFE_MATH >  maps,
graph::input_nodes< T, SAFE_MATH >  atomics,
graph::shared_random_state< T, SAFE_MATH >  state,
const std::string  name,
const size_t  size,
const size_t  iterations 
)
inline

Add a loop item.

Template Parameters
OThe workflow::order
Parameters
[in]inInput variables.
[in]outOutput nodes.
[in]mapsSetter maps.
[in]atomicsInput variables for atomic operations.
[in]stateRandom state node.
[in]nameName of the work item.
[in]sizeSize of the work item.
[in]iterationsNumber of iterations.

◆ add_zero_item()

template<jit::float_scalar T, bool SAFE_MATH = false>
template<order O = run_item>
void workflow::manager< T, SAFE_MATH >::add_zero_item ( graph::input_nodes< T, SAFE_MATH >  in)
inline

Add a zero item.

Template Parameters
OThe workflow::order
Parameters
[in]inInput variables.

◆ check_value()

template<jit::float_scalar T, bool SAFE_MATH = false>
T workflow::manager< T, SAFE_MATH >::check_value ( const size_t  index,
const graph::shared_leaf< T, SAFE_MATH > &  node 
)
inline

Check the value.

Parameters
[in]indexParticle index to check value for.
[in]nodeNode to check the value for.
Returns
The value at the index.

◆ copy_to_device()

template<jit::float_scalar T, bool SAFE_MATH = false>
void workflow::manager< T, SAFE_MATH >::copy_to_device ( graph::shared_leaf< T, SAFE_MATH > &  node,
T *  destination 
)
inline

Copy buffer contents to the device.

Parameters
[in]nodeNode to copy buffer to.
[in]destinationHost side buffer to copy from.

◆ copy_to_host()

template<jit::float_scalar T, bool SAFE_MATH = false>
void workflow::manager< T, SAFE_MATH >::copy_to_host ( graph::shared_leaf< T, SAFE_MATH > &  node,
T *  destination 
)
inline

Copy contexts of buffer to host.

Parameters
[in]nodeNode to copy buffer from.
[in,out]destinationHost side buffer to copy to.

◆ get_context()

template<jit::float_scalar T, bool SAFE_MATH = false>
jit::context< T, SAFE_MATH > & workflow::manager< T, SAFE_MATH >::get_context ( )
inline

Get the jit context.

Returns
The jit context.

◆ print()

template<jit::float_scalar T, bool SAFE_MATH = false>
void workflow::manager< T, SAFE_MATH >::print ( const size_t  index,
const graph::output_nodes< T, SAFE_MATH > &  nodes 
)
inline

Print results.

Parameters
[in]indexParticle index to print.
[in]nodesNodes to output.

◆ run()

template<jit::float_scalar T, bool SAFE_MATH = false>
template<order O = run_item>
void workflow::manager< T, SAFE_MATH >::run ( )
inline

Run work items.

Template Parameters
OThe workflow::order

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