PaCO++
0.05
|
00001 #include "CommunicationScheduling.h" 00002 00003 paco_comScheduling::paco_comScheduling() {} 00004 00005 paco_comScheduling::~paco_comScheduling() {} 00006 00007 paco_comSchedule* 00008 paco_comScheduling::getSchedule(long id) 00009 { 00010 _schedule_info_map_t::iterator it = _schedule_info_map.find(id); 00011 if (it != _schedule_info_map.end()) 00012 { 00013 return it->second; 00014 } 00015 else 00016 return NULL; 00017 } 00018 00019 void 00020 paco_comScheduling::setSchedule(long id, paco_comSchedule* cs) 00021 { 00022 // _schedule_info_map[id] = cs; 00023 } 00024 00025 void 00026 paco_comScheduling::clearScheduleId(long id) throw (InvalidArgument) 00027 { 00028 if (id<0) 00029 throw new InvalidArgument("clearScheduleMemeoryId expects an id >0"); 00030 00031 #ifdef DEBUG_INTERNAL 00032 std::cerr <<"[INFO] clearing schedule memory Id "<<id<<endl; 00033 #endif 00034 00035 _schedule_info_map_t::iterator it = _schedule_info_map.find(id); 00036 if (it != _schedule_info_map.end()) 00037 { 00038 delete _schedule_info_map[id]; 00039 _schedule_info_map.erase(it); 00040 } 00041 } 00042 00043 void 00044 paco_comScheduling::clearAllSchedules() 00045 { 00046 #ifdef DEBUG_INTERNAL 00047 std::cerr <<"[INFO] clearing all schedule memories\n"; 00048 #endif 00049 for(_schedule_info_map_t::iterator it = _schedule_info_map.begin(); it!= _schedule_info_map.end(); it++) 00050 { 00051 delete it->second; 00052 } 00053 _schedule_info_map.clear(); 00054 } 00055 00056 00057 void 00058 paco_comScheduling::propageComMatrix(PaCO_operation* op, unsigned **comMatrix) 00059 { 00060 std::cerr << "[Debug] doing all-2-all communication, #phases: " << op->mytopo.total << endl; 00061 int size_temp_vector = sizeof(unsigned) * op->serveur_topo_aller.total;; 00062 for (unsigned i = 0; i < op->mytopo.total; i++) 00063 { 00064 std::cerr << "[Debug] all-2-all phase: "<<i<<" sz:"<<size_temp_vector<< endl; 00065 op->my_com->paco_bcast((void*) comMatrix[i], size_temp_vector, i); 00066 } 00067 } 00068 00069 void 00070 paco_comScheduling::displayStatus() 00071 { 00072 cerr << this << " ctopo: "<<_client_topo<<" - "<<_client_topo->total<< " stopo: "<<_server_topo<<" - "<<_server_topo->total << " map: "<< _schedule_info_map.size() << endl; 00073 }