Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
Dynamic scheduler

Data Structures

class  CTF::TensorOperationBase
 Provides a untemplated base class for tensor operations. More...
 
class  CTF::TensorOperation
 A tensor operation, containing all the data (op, lhs, rhs) required to run it. Also provides methods to get a list of inputs and outputs, as well as successor and dependency information used in scheduling. More...
 
class  CTF::ScheduleBase
 
struct  CTF::ScheduleTimer
 
class  CTF::Schedule
 

Enumerations

enum  CTF::TensorOperationTypes {
  CTF::TENSOR_OP_NONE, CTF::TENSOR_OP_SET, CTF::TENSOR_OP_SUM, CTF::TENSOR_OP_SUBTRACT,
  CTF::TENSOR_OP_MULTIPLY
}
 

Functions

virtual CTF::TensorOperationBase::~TensorOperationBase ()
 
 CTF::TensorOperation::TensorOperation (TensorOperationTypes op, Idx_Tensor *lhs, const CTF_int::Term *rhs)
 Constructor, create the tensor operation lhs op= rhs. More...
 
void CTF::TensorOperation::get_outputs (std::set< Idx_Tensor *, CTF_int::tensor_name_less > *outputs_set) const
 appends the tensors this writes to to the input set More...
 
void CTF::TensorOperation::get_inputs (std::set< Idx_Tensor *, CTF_int::tensor_name_less > *inputs_set) const
 appends the tensors this depends on (reads from, including the output if a previous value is required) to the input set More...
 
void CTF::TensorOperation::execute (std::map< CTF_int::tensor *, CTF_int::tensor * > *remap=NULL)
 runs this operation, but does NOT handle dependency scheduling optionally takes a remapping of tensors More...
 
double CTF::TensorOperation::estimate_time ()
 provides an estimated runtime cost More...
 
bool CTF::TensorOperation::is_dummy ()
 
const char * CTF::TensorOperation::name ()
 
virtual void CTF::ScheduleBase::add_operation (TensorOperationBase *op)=0
 
 CTF::ScheduleTimer::ScheduleTimer ()
 
void CTF::ScheduleTimer::operator+= (ScheduleTimer const &B)
 
 CTF::Schedule::Schedule (World *world=NULL)
 Constructor, optionally specifying a world to restrict processor allocations to. More...
 
void CTF::Schedule::record ()
 Starts recording all tensor operations to this schedule (instead of executing them immediately) More...
 
ScheduleTimer CTF::Schedule::execute ()
 Executes the schedule and implicitly terminates recording. More...
 
ScheduleTimer CTF::Schedule::partition_and_execute ()
 Executes a slide of the ready_queue, partitioning it among the processors in the grid. More...
 
void CTF::Schedule::schedule_op_successors (TensorOperation *op)
 Call when a tensor op finishes, this adds newly enabled ops to the ready queue. More...
 
void CTF::Schedule::add_operation_typed (TensorOperation *op)
 Adds a tensor operation to this schedule. THIS IS CALL ORDER DEPENDENT - operations will appear to execute sequentially in the order they were added. More...
 
void CTF::Schedule::add_operation (TensorOperationBase *op)
 
void CTF::Schedule::set_max_partitions (int in_partitions)
 

Variables

int CTF::TensorOperation::dependency_count
 
std::vector< TensorOperation * > CTF::TensorOperation::successors
 
std::vector< TensorOperation * > CTF::TensorOperation::reads
 
int CTF::TensorOperation::dependency_left
 
TensorOperationTypes CTF::TensorOperation::op
 
Idx_Tensor * CTF::TensorOperation::lhs
 
const CTF_int::TermCTF::TensorOperation::rhs
 
double CTF::TensorOperation::cached_estimated_cost
 
ScheduleBaseCTF::global_schedule
 
double CTF::ScheduleTimer::comm_down_time
 
double CTF::ScheduleTimer::exec_time
 
double CTF::ScheduleTimer::imbalance_wall_time
 
double CTF::ScheduleTimer::imbalance_acuum_time
 
double CTF::ScheduleTimer::comm_up_time
 
double CTF::ScheduleTimer::total_time
 
World * CTF::Schedule::world
 
std::deque< TensorOperation * > CTF::Schedule::root_tasks
 
std::deque< TensorOperation * > CTF::Schedule::steps_original
 
std::map< CTF_int::tensor *, TensorOperation * > CTF::Schedule::latest_write
 
std::deque< TensorOperation * > CTF::Schedule::ready_tasks
 
int CTF::Schedule::partitions
 

Detailed Description

Enumeration Type Documentation

Enumerator
TENSOR_OP_NONE 
TENSOR_OP_SET 
TENSOR_OP_SUM 
TENSOR_OP_SUBTRACT 
TENSOR_OP_MULTIPLY 

Definition at line 13 of file schedule.h.

Function Documentation

virtual void CTF::ScheduleBase::add_operation ( TensorOperationBase op)
pure virtual
void CTF::Schedule::add_operation ( TensorOperationBase op)
virtual

Implements CTF::ScheduleBase.

Definition at line 327 of file schedule.cxx.

References CTF::Schedule::add_operation_typed().

void CTF::Schedule::add_operation_typed ( TensorOperation op)

Adds a tensor operation to this schedule. THIS IS CALL ORDER DEPENDENT - operations will appear to execute sequentially in the order they were added.

Definition at line 279 of file schedule.cxx.

References CTF::TensorOperation::dependency_count, CTF::TensorOperation::get_inputs(), CTF::TensorOperation::get_outputs(), CTF::Schedule::latest_write, CTF::TensorOperation::reads, CTF::Schedule::root_tasks, CTF::Schedule::steps_original, CTF::TensorOperation::successors, and CTF::TENSOR_OP_NONE.

Referenced by CTF::Schedule::add_operation().

double CTF::TensorOperation::estimate_time ( )

provides an estimated runtime cost

Definition at line 390 of file schedule.cxx.

Referenced by CTF::tensor_op_cost_greater().

void CTF::TensorOperation::execute ( std::map< CTF_int::tensor *, CTF_int::tensor * > *  remap = NULL)

runs this operation, but does NOT handle dependency scheduling optionally takes a remapping of tensors

Definition at line 333 of file schedule.cxx.

References CTF::Idx_Tensor::clone(), CTF_int::Term::clone(), CTF::TENSOR_OP_MULTIPLY, CTF::TENSOR_OP_NONE, CTF::TENSOR_OP_SET, CTF::TENSOR_OP_SUBTRACT, and CTF::TENSOR_OP_SUM.

void CTF::TensorOperation::get_inputs ( std::set< Idx_Tensor *, CTF_int::tensor_name_less > *  inputs_set) const

appends the tensors this depends on (reads from, including the output if a previous value is required) to the input set

Definition at line 372 of file schedule.cxx.

References CTF::TENSOR_OP_MULTIPLY, CTF::TENSOR_OP_SET, CTF::TENSOR_OP_SUBTRACT, and CTF::TENSOR_OP_SUM.

Referenced by CTF::Schedule::add_operation_typed().

void CTF::TensorOperation::get_outputs ( std::set< Idx_Tensor *, CTF_int::tensor_name_less > *  outputs_set) const

appends the tensors this writes to to the input set

Definition at line 366 of file schedule.cxx.

Referenced by CTF::Schedule::add_operation_typed().

bool CTF::TensorOperation::is_dummy ( )
inline

Definition at line 70 of file schedule.h.

References CTF::TENSOR_OP_NONE.

const char* CTF::TensorOperation::name ( )
inline

Debugging Helpers

Definition at line 91 of file schedule.h.

void CTF::Schedule::record ( )

Starts recording all tensor operations to this schedule (instead of executing them immediately)

Definition at line 10 of file schedule.cxx.

CTF::Schedule::Schedule ( World world = NULL)
inline

Constructor, optionally specifying a world to restrict processor allocations to.

Definition at line 144 of file schedule.h.

void CTF::Schedule::schedule_op_successors ( TensorOperation op)
inline

Call when a tensor op finishes, this adds newly enabled ops to the ready queue.

Definition at line 14 of file schedule.cxx.

References CTF::TensorOperation::dependency_left, ctf.core::it, CTF::Schedule::ready_tasks, and CTF::TensorOperation::successors.

Referenced by CTF::Schedule::execute(), and CTF::Schedule::partition_and_execute().

CTF::ScheduleTimer::ScheduleTimer ( )
inline

Definition at line 119 of file schedule.h.

void CTF::Schedule::set_max_partitions ( int  in_partitions)
inline

Testing functionality

Definition at line 181 of file schedule.h.

CTF::TensorOperation::TensorOperation ( TensorOperationTypes  op,
Idx_Tensor lhs,
const CTF_int::Term rhs 
)
inline

Constructor, create the tensor operation lhs op= rhs.

Definition at line 39 of file schedule.h.

virtual CTF::TensorOperationBase::~TensorOperationBase ( )
inlinevirtual

Definition at line 25 of file schedule.h.

Variable Documentation

double CTF::TensorOperation::cached_estimated_cost
protected

Definition at line 100 of file schedule.h.

double CTF::ScheduleTimer::comm_down_time
double CTF::ScheduleTimer::comm_up_time
int CTF::TensorOperation::dependency_count

Schedule Recording Variables

Definition at line 78 of file schedule.h.

Referenced by CTF::Schedule::add_operation_typed().

int CTF::TensorOperation::dependency_left

Schedule Execution Variables

Definition at line 86 of file schedule.h.

Referenced by CTF::Schedule::schedule_op_successors().

double CTF::ScheduleTimer::exec_time
double CTF::ScheduleTimer::imbalance_acuum_time
double CTF::ScheduleTimer::imbalance_wall_time
std::map<CTF_int::tensor*, TensorOperation*> CTF::Schedule::latest_write
protected

Definition at line 223 of file schedule.h.

Referenced by CTF::Schedule::add_operation_typed().

Idx_Tensor* CTF::TensorOperation::lhs
protected

Definition at line 97 of file schedule.h.

TensorOperationTypes CTF::TensorOperation::op
protected

Definition at line 96 of file schedule.h.

int CTF::Schedule::partitions
protected

Testing variables

Definition at line 234 of file schedule.h.

Referenced by CTF::Schedule::partition_and_execute().

std::vector<TensorOperation* > CTF::TensorOperation::reads

Definition at line 81 of file schedule.h.

Referenced by CTF::Schedule::add_operation_typed().

std::deque<TensorOperation*> CTF::Schedule::ready_tasks
protected
const CTF_int::Term* CTF::TensorOperation::rhs
protected

Definition at line 98 of file schedule.h.

std::deque<TensorOperation*> CTF::Schedule::root_tasks
protected

Internal scheduling operation overview: DAG Structure: Each task maintains: dependency_count: the number of dependencies that the task has dependency_left: the number of dependencies left before this task can execute successors: a vector of tasks which has this as a dependency On completing a task, it decrements the dependency_left of all successors. Once the count reaches zero, the task is added to the ready queue and can be scheduled for execution. To allow one schedule to be executed many times, dependency_count is only modified by recording tasks, and is copied to dependency_left when the schedule starts executing.

DAG Construction: A map from tensors pointers to operations is maintained, which contains the latest operation that writes to a tensor. When a new operation is added, it checks this map for all dependencies. If a dependency has no entry yet, then it is considered satisfied. Otherwise, it depends on the current entry - and the latest write operation adds this task as a successor. Then, the latest_write for this operation is updated. Schedule Recording Variables

Definition at line 217 of file schedule.h.

Referenced by CTF::Schedule::add_operation_typed(), and CTF::Schedule::execute().

std::deque<TensorOperation*> CTF::Schedule::steps_original
protected

Definition at line 220 of file schedule.h.

Referenced by CTF::Schedule::add_operation_typed(), and CTF::Schedule::execute().

std::vector<TensorOperation* > CTF::TensorOperation::successors
double CTF::ScheduleTimer::total_time
World* CTF::Schedule::world
protected

Definition at line 186 of file schedule.h.

Referenced by CTF::Schedule::execute(), and CTF::Schedule::partition_and_execute().