/*=====================================================================*/ void GData::set_partition(GPartitioner *P) { partitioner = P; assert(P); child_cnt = P->y * P->x; children = new GData*[child_cnt]; assert(P->y); assert(P->x); int m = M/P->y; int n = N/P->x; for(int i=0; i<child_cnt; i++) { int px = i/P->y; int py = i%P->y; ostringstream os; os << name << "_" << setw(2) << setfill('0') << py << "_" << setw(2) << setfill('0') << px; string ch_name = os.str(); LOG_INFO(LOG_MLEVEL,"Child data :%s of %dx%d at blk(%d,%d) is being created.\n",ch_name.c_str(),m,n,py,px); children[i] = new GData(m,n,ch_name,this,i); } Dispatcher *dis = get_dispatcher(); if ( dis != nullptr) dis->data_partitioned(this); GPartitioner *next_p=partitioner->get_next(); if ( next_p != nullptr) for(int i=0; i<child_cnt; i++) { LOG_INFO(LOG_MLEVEL,"Cascade partition to %s with %dx%d\n",children[i]->get_name().c_str(),next_p->y,next_p->x); children[i]->set_partition(next_p); } }
GTask &udot_t(GData &A,GData &B, GData &r,GTask *parent ) { Args *args = new Args; Axs axs; packArgs( args,A , B , r ); packAxs ( axs ,In, In , Out); GTask *t=get_dispatcher()->submit_task(&_udot,args,axs,parent); return *t; }
GTask &utrsm_t(GData &A,GData &B, GTask *parent ) { Args *args = new Args; Axs axs; packArgs( args,A ,B ); packAxs ( axs ,In,InOut); GTask *t=get_dispatcher()->submit_task(utrsm_name,args,axs,parent); return *t; }
void system::create_one_off_timer( timer::time_point when, const std::function<void(void)> &e ) { precondition( e, "Invalid function for one off timer" ); auto t = create_timer(); t->elapsed = std::bind( &system::dispatch_oneoff_timer, this, t, e ); t->reset_one_off( when ); t->activate( true ); get_dispatcher()->add_waitable( t ); }
/*=====================================================================*/ GData::GData(int i,int j,string n):M(i),N(j),name(n) { handle = new GHandle; if( all_data == nullptr) all_data = new std::vector<GData *>; key = all_data->size(); all_data->push_back(this); memory = nullptr; content = nullptr; child_cnt = 0; child_idx=0; parent = nullptr; children= nullptr; partitioner=nullptr; guest = nullptr; level = 0; Dispatcher *dis=get_dispatcher(); if (dis != nullptr) dis->data_created(this); }
void system::dispatch_oneoff_timer( const std::shared_ptr<timer> &t, const std::function<void(void)> &e ) { e(); get_dispatcher()->remove_waitable( t ); }
unified_dot::unified_dot():GOperation() { name = udot_name; get_dispatcher()->register_operation(this,name); }
void push_set_transformer( transformer_sptr transform ) { get_dispatcher( ).post( boost::bind( &this_type::set_transformer_impl, this, transform, this->shared_from_this( ) )); }
unified_trsm::unified_trsm() { name = utrsm_name; get_dispatcher()->register_operation(this,name); }