default_tuner Struct Template Reference

Default (NOP) implementations of the tuner interface. More...

List of all members.

Public Types

typedef Partitioner partitioner_type
 The type of the partitioner.

Public Member Functions

int priority (const Tag &, Arg &) const
 Allows defnintion of priorites to individual steps (which are identified by the tag).
template<typename T>
void depends (const Tag &, Arg &, T &) const
 Allows declaration of data dependencies (to items) of given step (identified by the tag).
bool preschedule () const
 returns whether the step should be pre-scheduled
int pass_on (const Tag &, Arg &) const
 tell the scheduler on which process to run the step (distCnC)
partitioner_type partitioner () const
 return a partitioner for range-based features, such as parallel_for

Static Public Attributes

static const bool check_deps_in_ranges = check_deps


Detailed Description

template<typename Tag, typename Arg, bool check_deps = true, typename Partitioner = default_partitioner<>>
struct CnC::default_tuner< Tag, Arg, check_deps, Partitioner >

Default (NOP) implementations of the tuner interface.

Also defines the interface a user-provided tuner must satisfy. Derive your tuner from this class if you do not want to define the entire interface.

#include <cnc/default_tuner.h>

Definition at line 48 of file default_tuner.h.


Member Function Documentation

int priority ( const Tag &  ,
Arg &   
) const [inline]

Allows defnintion of priorites to individual steps (which are identified by the tag).

Returns:
the default implementation always return 1.
Parameters:
tag the tag which identifies the step to be executed
arg the argument as passed to context< Derived >::prescribed (usually the context)

Definition at line 54 of file default_tuner.h.

00055         {
00056             return 1;
00057         }

void depends ( const Tag &  ,
Arg &  ,
T &   
) const [inline]

Allows declaration of data dependencies (to items) of given step (identified by the tag).

When a step-instance is prescribed through a corresponding tag_collection::put, this method will be called. You can declare dependencies to items by calling dC.depends( item_collection, dependent_item_tag ) for every item the step is going to 'get' in its execute mthod. The actual step execution will be delayed until all dependencies can be satisfied. The default implementation does nothing (NOP). Your own implementation must accept dC by reference (T&).

Parameters:
tag the tag which identifies the step to be executed.
arg the argument as passed to context< Derived >::prescribed (usually the context)
dC opaque object (must be by reference!) providing method depends to declare item dependencies

Definition at line 76 of file default_tuner.h.

00077         {
00078         }

bool preschedule (  )  const [inline]

returns whether the step should be pre-scheduled

Pre-scheduling provides an alternative method for detecting data dependencies.

The step instance will be run immediately when prescribed by a tag_collection::put. All items that are not yet available when accessed by the non-blocking get method will automatically be treated as dependent items. The pre-run will end at context::flush_gets() if any items are unavailable. The step execution will be delayed until all detected dependencies can be satisfied.

Definition at line 92 of file default_tuner.h.

00093         {
00094             return false;
00095         }

int pass_on ( const Tag &  ,
Arg &   
) const [inline]

tell the scheduler on which process to run the step (distCnC)

Returns:
process id where the step will be executed, or PASS_ON_ROUND_ROBIN, or PASS_ON_LOCAL

Definition at line 98 of file default_tuner.h.

00099         {
00100             return PASS_ON_ROUND_ROBIN;
00101         }

partitioner_type partitioner (  )  const [inline]

return a partitioner for range-based features, such as parallel_for

See also:
default_partitioner for the expected signature of partitioners overwrite partitioner() if it doesn't come with default-constructor or if the default constructor is insufficient.

Definition at line 110 of file default_tuner.h.

00111         {
00112             return partitioner_type();
00113         }


Member Data Documentation

const bool check_deps_in_ranges = check_deps [static]

true if steps launched through ranges consume items or need global locking, false otherwise. Avoiding checks for dependencies and global locks saves overhead and will perform better (e.g. for parallel_for). Safe execution (with checks) is the default (check_deps template argument).

Definition at line 118 of file default_tuner.h.


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

Generated on Tue Aug 31 15:30:28 2010 for CnC by  doxygen 1.5.6