#include <cluster/ClusterManager.h>
Collaboration diagram for cluster::ClusterManager:

Public Member Functions | |
| void | addPlugin (ClusterPlugin *new_manager) |
| Adds a new plugin to the ClusterManager. | |
| void | removePlugin (ClusterPlugin *old_manager) |
| Removes a plugin from the ClusterManager. | |
| ClusterPlugin * | getPluginByGUID (const vpr::GUID &plugin_guid) |
| Return the ClusterPlugin with the given GUID. | |
| void | sendRequests () |
| Send each ClusterPlugin's requests. | |
| void | preDraw () |
| Synchronize plugins directly before the kernel calls the draw() method. | |
| void | postPostFrame () |
| Synchronize plugins directly after the kernel calls the postFrame() method. | |
| void | createBarrier () |
| Cycle through ClusterPlugins until one of them can achieve swaplock. | |
| void | recoverFromLostNode (gadget::Node *lost_node) |
| Cause the cluster to recover when a connection to a ClusterNode is lost. | |
| ClusterNetwork * | getNetwork () |
| Return the representation of the network which this cluster is running on. | |
| bool | recognizeRemoteDeviceConfig (jccl::ConfigElementPtr element) |
| Return true if ConfigElement is a remote device. | |
| bool | recognizeClusterManagerConfig (jccl::ConfigElementPtr element) |
| Return true if Configelement is a ClusterManager element. | |
| bool | configAdd (jccl::ConfigElementPtr element) |
| Adds the pending element to the configuration. | |
| bool | configRemove (jccl::ConfigElementPtr element) |
| Remove the pending element from the current configuration. | |
| bool | configCanHandle (jccl::ConfigElementPtr element) |
| Checks if this handler can process element. | |
| jccl::ConfigElementPtr | getConfigElementPointer (const std::string &name) |
| Get a pointer to the ConfigElement with the given name. | |
| bool | isClusterActive () |
| Return true if we are running on a cluster. | |
| bool | isClusterReady () |
| Return true if all dependancies have been satisfied. | |
| bool | pluginsReady () |
| Return true if all plugins have their dependancies satisfied. | |
| void | setClusterReady (const bool ready) |
| Change the ready state of the ClusterManager. | |
| vpr::Uint64 | preDrawCallCount () |
| Return the number of times that preDraw() has been called. | |
| vpr::Uint64 | postPostFrameCallCount () |
| Return the number of times that postPostFrame() has been called. | |
Protected Member Functions | |
| ClusterManager () | |
| Constructor is hidden, so no direct instantiation is allowed. | |
| virtual | ~ClusterManager () |
| ClusterManager (const ClusterManager &cm) | |
| Constructor is hidden, so no copying is allowed. | |
| void | operator= (const ClusterManager &) |
Friends | |
| GADGET_API(std::ostream | getNodes ()&) operator<<(std std::vector< std::string > |
| Get a list of hostnames for all ClusterNodes. | |
Definition at line 63 of file ClusterManager.h.
| cluster::ClusterManager::ClusterManager | ( | ) | [protected] |
Constructor is hidden, so no direct instantiation is allowed.
Definition at line 157 of file ClusterManager.cpp.
00158 : mClusterActive( false ) 00159 , mClusterReady( false ) 00160 , mPreDrawCallCount(0) 00161 , mPostPostFrameCallCount(0) 00162 { 00163 mClusterNetwork = new ClusterNetwork(); 00164 jccl::ConfigManager::instance()->addConfigElementHandler( mClusterNetwork ); 00165 jccl::DependencyManager::instance()->registerChecker( new ClusterDepChecker() ); 00166 }
| cluster::ClusterManager::~ClusterManager | ( | ) | [protected, virtual] |
| cluster::ClusterManager::ClusterManager | ( | const ClusterManager & | cm | ) | [inline, protected] |
| void cluster::ClusterManager::operator= | ( | const ClusterManager & | ) | [inline, protected] |
| void cluster::ClusterManager::addPlugin | ( | ClusterPlugin * | new_manager | ) |
Adds a new plugin to the ClusterManager.
Definition at line 243 of file ClusterManager.cpp.
References gadget::AbstractNetworkManager::addHandler(), and gadgetDBG_RIM().
00244 { 00245 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00246 if ( !doesPluginExist(new_plugin) ) 00247 { 00248 mPlugins.push_back( new_plugin ); 00249 std::pair<vpr::GUID, ClusterPlugin*> p = 00250 std::make_pair( new_plugin->getHandlerGUID(), new_plugin ); 00251 mPluginMap.insert( p ); 00252 00253 // We should do this here, but since we do not add the manager until 00254 // its configAdd currently you can see the problem 00255 jccl::ConfigManager::instance()->addConfigElementHandler( new_plugin ); 00256 mClusterNetwork->addHandler( new_plugin ); 00257 //We can still unregister it when removed below though 00258 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_LVL ) 00259 << clrOutBOLD( clrCYAN, "[ClusterManager] " ) 00260 << "Adding Plugin: " << new_plugin->getPluginName() 00261 << std::endl << vprDEBUG_FLUSH; 00262 } 00263 }
| void cluster::ClusterManager::removePlugin | ( | ClusterPlugin * | old_manager | ) |
Removes a plugin from the ClusterManager.
Definition at line 279 of file ClusterManager.cpp.
References gadgetDBG_RIM(), gadget::PacketHandler::getHandlerGUID(), and cluster::ClusterPlugin::getPluginName().
00280 { 00281 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00282 00283 mPluginMap.erase( old_plugin->getHandlerGUID() ); 00284 00285 std::list<ClusterPlugin*>::iterator found 00286 = std::find(mPlugins.begin(), mPlugins.end(), old_plugin); 00287 00288 if (mPlugins.end() != found) 00289 { 00290 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_LVL ) 00291 << clrOutBOLD( clrCYAN, "[ClusterManager] " ) 00292 << "Removing Plugin: " << old_plugin->getPluginName() 00293 << std::endl << vprDEBUG_FLUSH; 00294 mPlugins.erase(found); 00295 jccl::ConfigManager::instance()->removeConfigElementHandler(*found); 00296 } 00297 }
| ClusterPlugin * cluster::ClusterManager::getPluginByGUID | ( | const vpr::GUID & | plugin_guid | ) |
Return the ClusterPlugin with the given GUID.
Definition at line 265 of file ClusterManager.cpp.
00266 { 00267 std::map<vpr::GUID, ClusterPlugin*>::const_iterator i = 00268 mPluginMap.find( plugin_guid ); 00269 if( i != mPluginMap.end() ) 00270 { 00271 return ( (*i).second ); 00272 } 00273 return NULL; 00274 }
| void cluster::ClusterManager::sendRequests | ( | ) |
Send each ClusterPlugin's requests.
Definition at line 313 of file ClusterManager.cpp.
References gadgetDBG_NET_MGR().
00314 { 00315 // Idea is to not create frame lock if we do not need to 00316 bool updateNeeded = false; 00317 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00318 00319 vprDEBUG( gadgetDBG_NET_MGR, vprDBG_HVERB_LVL ) 00320 << clrOutBOLD( clrCYAN,"[ClusterManager]" ) 00321 << " sendRequests" << std::endl << vprDEBUG_FLUSH; 00322 00323 for ( std::list<ClusterPlugin*>::iterator i = mPlugins.begin(); 00324 i != mPlugins.end(); 00325 ++i ) 00326 { 00327 (*i)->sendRequests(); 00328 updateNeeded = true; 00329 } 00330 00331 // Only send end blocks if we really need to. 00332 if ( updateNeeded ) 00333 { 00334 sendEndBlocksAndSignalUpdate(1); 00335 } 00336 }
| void cluster::ClusterManager::preDraw | ( | ) |
Synchronize plugins directly before the kernel calls the draw() method.
Definition at line 338 of file ClusterManager.cpp.
References gadgetDBG_NET_MGR().
00339 { 00340 // Idea is to not create frame lock if we do not need to 00341 bool updateNeeded = false; 00342 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00343 00344 vprDEBUG( gadgetDBG_NET_MGR, vprDBG_HVERB_LVL ) 00345 << clrOutBOLD( clrCYAN,"[ClusterManager]" ) 00346 << " preDraw" << std::endl << vprDEBUG_FLUSH; 00347 00348 for ( std::list<ClusterPlugin*>::iterator i = mPlugins.begin(); 00349 i != mPlugins.end(); 00350 ++i ) 00351 { 00352 (*i)->preDraw(); 00353 updateNeeded = true; 00354 } 00355 if ( updateNeeded ) 00356 { 00357 mPreDrawCallCount++; 00358 sendEndBlocksAndSignalUpdate(2); 00359 } 00360 }
| void cluster::ClusterManager::postPostFrame | ( | ) |
Synchronize plugins directly after the kernel calls the postFrame() method.
Definition at line 362 of file ClusterManager.cpp.
References gadgetDBG_NET_MGR().
00363 { 00364 // -If not running 00365 // -If all plugins ready 00366 // - isClusterReady 00367 00368 00369 // Idea is to not create frame lock if we do not need to 00370 bool updateNeeded = false; 00371 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00372 00373 vprDEBUG( gadgetDBG_NET_MGR, vprDBG_HVERB_LVL ) 00374 << clrOutBOLD( clrCYAN,"[ClusterManager]" ) 00375 << " postPostFrame" << std::endl << vprDEBUG_FLUSH; 00376 00377 for ( std::list<ClusterPlugin*>::iterator i = mPlugins.begin(); 00378 i != mPlugins.end(); 00379 ++i ) 00380 { 00381 (*i)->postPostFrame(); 00382 updateNeeded = true; 00383 } 00384 if ( updateNeeded ) 00385 { 00386 mPostPostFrameCallCount++; 00387 sendEndBlocksAndSignalUpdate(3); 00388 } 00389 }
| void cluster::ClusterManager::createBarrier | ( | ) |
Cycle through ClusterPlugins until one of them can achieve swaplock.
Definition at line 391 of file ClusterManager.cpp.
00392 { 00393 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00394 00395 for ( std::list<ClusterPlugin*>::iterator i = mPlugins.begin(); 00396 i != mPlugins.end(); 00397 ++i ) 00398 { 00399 //if ((*i)->isActive()) 00400 //{ // As soon as we find a plug-in that creates 00401 // a barrier, we can continue. Maybe not since 00402 // this will not match up on different machines 00403 if ( (*i)->createBarrier() ) 00404 { 00405 return; 00406 } 00407 //} 00408 } 00409 }
| void cluster::ClusterManager::recoverFromLostNode | ( | gadget::Node * | lost_node | ) |
Cause the cluster to recover when a connection to a ClusterNode is lost.
Definition at line 228 of file ClusterManager.cpp.
00229 { 00230 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00231 00232 for ( std::list<ClusterPlugin*>::iterator i = mPlugins.begin(); 00233 i != mPlugins.end(); 00234 ++i ) 00235 { 00236 (*i)->recoverFromLostNode( lost_node ); 00237 } 00238 }
| ClusterNetwork* cluster::ClusterManager::getNetwork | ( | ) | [inline] |
Return the representation of the network which this cluster is running on.
Definition at line 149 of file ClusterManager.h.
| bool cluster::ClusterManager::recognizeRemoteDeviceConfig | ( | jccl::ConfigElementPtr | element | ) |
Return true if ConfigElement is a remote device.
Definition at line 465 of file ClusterManager.cpp.
References getConfigElementPointer(), and gadget::AbstractNetworkManager::isLocalHost().
00466 { 00467 std::string tp("input_parent"); 00468 if ( element->getConfigDefinition()->isParent("input_device") && 00469 element->getNum("device_host") > 0 ) 00470 { 00471 std::string device_host = 00472 element->getProperty<std::string>( "device_host" ); 00473 //std::cout << "Checking: " << element->getName() << std::endl; 00474 if ( !device_host.empty() ) 00475 { 00476 // THIS IS A HACK: find a better way to do this 00477 jccl::ConfigElementPtr device_host_ptr = 00478 getConfigElementPointer( device_host ); 00479 if ( device_host_ptr.get() != NULL ) 00480 { 00481 std::string host_name = 00482 device_host_ptr->getProperty<std::string>( "host_name" ); 00483 if ( !cluster::ClusterNetwork::isLocalHost( host_name ) ) 00484 { 00485 return true; 00486 }// Device is on the local machine 00487 }// Could not find the deviceHost in the configuration 00488 }// Device is not a remote device since there is no name in the deviceHost field 00489 }// Else it is not a device, or does not have a deviceHost property 00490 return false; 00491 }
| bool cluster::ClusterManager::recognizeClusterManagerConfig | ( | jccl::ConfigElementPtr | element | ) |
Return true if Configelement is a ClusterManager element.
Definition at line 493 of file ClusterManager.cpp.
Referenced by configAdd(), configCanHandle(), and configRemove().
| bool cluster::ClusterManager::configAdd | ( | jccl::ConfigElementPtr | element | ) |
Adds the pending element to the configuration.
Definition at line 502 of file ClusterManager.cpp.
References configCanHandle(), gadgetDBG_INPUT_MGR(), gadgetDBG_RIM(), getConfigElementPointer(), gadget::AbstractNetworkManager::isLocalHost(), and recognizeClusterManagerConfig().
00503 { 00504 vpr::DebugOutputGuard dbg_output( gadgetDBG_RIM, vprDBG_STATE_LVL, 00505 std::string( "Cluster Manager: Adding config element.\n" ), 00506 std::string( "...done adding element.\n" ) ); 00507 00508 vprASSERT(configCanHandle(element)); 00509 vprASSERT(recognizeClusterManagerConfig(element)); 00510 00511 bool ret_val = false; // Flag to return success 00512 00513 { 00514 vprDEBUG( gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL) 00515 << clrOutBOLD(clrCYAN,"[ClusterManager] ") 00516 << "Configure the Cluster: " << element->getName() 00517 << std::endl << vprDEBUG_FLUSH; 00518 00519 // Get a list of cluster nodes to use for this cluster. 00520 int num_nodes = element->getNum( std::string( "cluster_node" ) ); 00521 00522 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_STATUS_LVL ) 00523 << clrOutBOLD( clrCYAN, "[ClusterManager] " ) 00524 << "configAdd() Number of nodes: " << num_nodes 00525 << std::endl << vprDEBUG_FLUSH; 00526 00527 for ( int i = 0 ; i < num_nodes ; ++i ) 00528 { 00529 std::string new_node = 00530 element->getProperty<std::string>( "cluster_node" , i ); 00531 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_STATUS_LVL ) 00532 << clrOutBOLD( clrCYAN, "[ClusterManager] " ) 00533 << "configAdd() New Node Name: " << new_node 00534 << std::endl << vprDEBUG_FLUSH; 00535 00536 jccl::ConfigElementPtr new_node_element = 00537 getConfigElementPointer( new_node ); 00538 std::string new_node_hostname = 00539 new_node_element->getProperty<std::string>( "host_name" ); 00540 00541 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_STATUS_LVL ) 00542 << clrOutBOLD( clrCYAN, "[ClusterManager] " ) 00543 << "configAdd() New Node Hostname: " << new_node_hostname 00544 << std::endl << vprDEBUG_FLUSH; 00545 00546 if ( !cluster::ClusterNetwork::isLocalHost( new_node_hostname ) ) 00547 { 00548 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_STATUS_LVL ) 00549 << clrOutBOLD( clrCYAN, "[ClusterManager] " ) 00550 << "configAdd() Added Node since it is non-local" 00551 << std::endl << vprDEBUG_FLUSH; 00552 00553 vpr::Guard<vpr::Mutex> guard( mNodesLock ); 00554 mNodes.push_back( new_node_hostname ); 00555 } 00556 } 00557 00558 00559 // Load the plugins. 00560 00561 vpr::DebugOutputGuard dbg_output( gadgetDBG_RIM, vprDBG_STATE_LVL, 00562 std::string( "Handling cluster_manager element:\n" ), 00563 std::string( "-- end state -- \n" ) ); 00564 00565 // Keep this up to date with the version of the element definition we're 00566 // expecting to handle. 00567 const unsigned int cur_version(2); 00568 00569 // If the element version is less than cur_version, we will not try to 00570 // proceed. Instead, we'll print an error message and return false so 00571 // that the Config Manager knows this element wasn't consumed. 00572 if ( element->getVersion() < cur_version ) 00573 { 00574 vprDEBUG( gadgetDBG_RIM, vprDBG_CRITICAL_LVL ) 00575 << clrOutBOLD( clrRED, "ERROR" ) 00576 << " [gadget::ClusterManager::configAdd()]: Element named '" 00577 << element->getName() << "'" << std::endl << vprDEBUG_FLUSH; 00578 vprDEBUG_NEXT( gadgetDBG_RIM, vprDBG_CRITICAL_LVL ) 00579 << "is version " << element->getVersion() 00580 << ", but we require at least version " << cur_version 00581 << std::endl << vprDEBUG_FLUSH; 00582 vprDEBUG_NEXT( gadgetDBG_RIM, vprDBG_CRITICAL_LVL ) 00583 << "Ignoring this element and moving on." << std::endl 00584 << vprDEBUG_FLUSH; 00585 00586 ret_val = false; 00587 } 00588 // We got the right version of the config element and can proceed. 00589 else 00590 { 00591 const std::string plugin_path_prop_name( "plugin_path" ); 00592 const int path_count( element->getNum( plugin_path_prop_name ) ); 00593 std::vector<fs::path> search_path( path_count ); 00594 00595 for ( unsigned int i = 0; i < search_path.size(); ++i ) 00596 { 00597 std::string temp_str = 00598 vpr::replaceEnvVars( element->getProperty<std::string>( plugin_path_prop_name, i ) ); 00599 00600 try 00601 { 00602 search_path[i] = fs::path( temp_str, fs::native ); 00603 } 00604 catch( fs::filesystem_error& fsEx ) 00605 { 00606 vprDEBUG( vprDBG_ERROR, vprDBG_CRITICAL_LVL ) 00607 << clrOutNORM( clrRED, "ERROR:" ) 00608 << "[cluster::ClusterManager::configAdd()] File system " 00609 << "exception caught while converting" 00610 << std::endl << vprDEBUG_FLUSH; 00611 vprDEBUG_NEXT( vprDBG_ERROR, vprDBG_CRITICAL_LVL ) 00612 << "'" << temp_str << "'" 00613 << std::endl << vprDEBUG_FLUSH; 00614 vprDEBUG_NEXT( vprDBG_ERROR, vprDBG_CRITICAL_LVL ) 00615 << "to a Boost.Filesystem path." 00616 << std::endl << vprDEBUG_FLUSH; 00617 vprDEBUG_NEXT( vprDBG_ERROR, vprDBG_CRITICAL_LVL ) 00618 << fsEx.what() << std::endl << vprDEBUG_FLUSH; 00619 } 00620 } 00621 00622 // Append a default plug-in search path to search_path. 00623 const std::string gadget_base_dir( "GADGET_BASE_DIR" ); 00624 const std::string vj_base_dir( "VJ_BASE_DIR" ); 00625 std::string base_dir; 00626 00627 // Try get to the value of $GADGET_BASE_DIR first. If that fails, 00628 // fall back on $VJ_BASE_DIR. 00629 if ( !vpr::System::getenv( gadget_base_dir, base_dir ).success() ) 00630 { 00631 if ( !vpr::System::getenv( vj_base_dir, base_dir ).success() ) 00632 { 00633 // If neither $GADGET_BASE_DIR nor $VJ_BASE_DIR is set, then 00634 // we can append a default driver search path. 00635 base_dir = VJ_ROOT_DIR; 00636 } 00637 } 00638 00639 #if defined(VPR_OS_IRIX) && defined(_ABIN32) 00640 const std::string bit_suffix("32"); 00641 #elif defined(VPR_OS_IRIX) && defined(_ABI64) || \ 00642 defined(VPR_OS_Linux) && defined(__x86_64__) 00643 const std::string bit_suffix("64"); 00644 #else 00645 const std::string bit_suffix(""); 00646 #endif 00647 00648 fs::path default_search_dir = 00649 fs::path(base_dir, fs::native) / 00650 (std::string("lib") + bit_suffix) / 00651 std::string("gadgeteer") / std::string("plugins"); 00652 00653 vprDEBUG( gadgetDBG_RIM, vprDBG_VERB_LVL ) 00654 << "[cluster::ClusterManager::configAdd()] Appending " 00655 << "default search path '" 00656 << default_search_dir.native_directory_string() << "'\n" 00657 << vprDEBUG_FLUSH; 00658 00659 search_path.push_back( default_search_dir ); 00660 00661 // --- Load cluster plugin dsos -- // 00662 // - Load individual plugins 00663 const std::string plugin_prop_name( "plugin" ); 00664 const std::string get_version_func( "getGadgeteerVersion" ); 00665 const std::string plugin_init_func( "initPlugin" ); 00666 00667 int plugin_count = element->getNum( plugin_prop_name ); 00668 std::string plugin_dso_name; 00669 00670 for ( int i = 0; i < plugin_count; ++i ) 00671 { 00672 plugin_dso_name = 00673 element->getProperty<std::string>(plugin_prop_name, i); 00674 00675 if ( !plugin_dso_name.empty() ) 00676 { 00677 vprDEBUG( gadgetDBG_RIM, vprDBG_STATE_LVL ) 00678 << "[cluster::ClusterManager::configAdd()] Loading " 00679 << "plugin DSO '" << plugin_dso_name << "'" 00680 << std::endl << vprDEBUG_FLUSH; 00681 00682 vpr::LibraryPtr dso = 00683 vpr::LibraryLoader::findDSO(plugin_dso_name, search_path); 00684 00685 if ( dso.get() != NULL ) 00686 { 00687 vpr::ReturnStatus version_status; 00688 VersionCheckCallable version_functor; 00689 version_status = 00690 vpr::LibraryLoader::callEntryPoint(dso, 00691 get_version_func, 00692 version_functor); 00693 00694 if ( ! version_status.success() ) 00695 { 00696 vprDEBUG(gadgetDBG_RIM, vprDBG_CRITICAL_LVL) 00697 << clrOutBOLD(clrRED, "ERROR") 00698 << ": Version mismatch while loading cluster plug-in DSO '" 00699 << plugin_dso_name << "'\n" << vprDEBUG_FLUSH; 00700 vprDEBUG_NEXT(gadgetDBG_RIM, vprDBG_CRITICAL_LVL) 00701 << "This plug-in will not be usable.\n" 00702 << vprDEBUG_FLUSH; 00703 } 00704 else 00705 { 00706 vpr::ReturnStatus load_status; 00707 PluginInitCallable init_functor(this); 00708 load_status = 00709 vpr::LibraryLoader::callEntryPoint(dso, 00710 plugin_init_func, 00711 init_functor); 00712 00713 if ( load_status.success() ) 00714 { 00715 mLoadedPlugins.push_back(dso); 00716 } 00717 } 00718 } 00719 else 00720 { 00721 vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL) 00722 << clrOutBOLD(clrRED, "ERROR") 00723 << ": Failed to find cluster plug-in DSO '" 00724 << plugin_dso_name << "'\n" << vprDEBUG_FLUSH; 00725 } 00726 } 00727 } 00728 00729 ret_val = true; 00730 } 00731 00732 // Dump the status 00733 { 00734 vpr::DebugOutputGuard dbg_output( gadgetDBG_RIM, vprDBG_CONFIG_LVL, 00735 std::string( "New Cluster Manager state:\n" ), 00736 std::string( "-- end state -- \n" ) ); 00737 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_LVL ) 00738 << (*this) << std::endl << vprDEBUG_FLUSH; 00739 } 00740 } 00741 00742 vpr::Guard<vpr::Mutex> guard( mClusterActiveLock ); 00743 mClusterActive = true; 00744 00745 return ret_val; // Return the success flag if we added at all 00746 }
| bool cluster::ClusterManager::configRemove | ( | jccl::ConfigElementPtr | element | ) |
Remove the pending element from the current configuration.
Definition at line 753 of file ClusterManager.cpp.
References gadgetDBG_RIM(), and recognizeClusterManagerConfig().
00754 { 00755 if ( recognizeClusterManagerConfig( element ) ) 00756 { 00757 vprDEBUG( gadgetDBG_RIM,vprDBG_CONFIG_LVL ) 00758 << "[ClusterManager] Shutdown the Cluster: " << element->getName() 00759 << std::endl << vprDEBUG_FLUSH; 00760 return( true ); 00761 } 00762 else 00763 { 00764 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_LVL ) 00765 << "[ClusterManager::configRemove()] ERROR: Something is " 00766 << "seriously wrong, we should never get here." << std::endl 00767 << vprDEBUG_FLUSH; 00768 return( false ); 00769 } 00770 }
| bool cluster::ClusterManager::configCanHandle | ( | jccl::ConfigElementPtr | element | ) |
Checks if this handler can process element.
Definition at line 778 of file ClusterManager.cpp.
References recognizeClusterManagerConfig().
Referenced by configAdd().
00779 { 00780 return(recognizeClusterManagerConfig( element )); 00781 }
| jccl::ConfigElementPtr cluster::ClusterManager::getConfigElementPointer | ( | const std::string & | name | ) |
Get a pointer to the ConfigElement with the given name.
Definition at line 789 of file ClusterManager.cpp.
Referenced by configAdd(), and recognizeRemoteDeviceConfig().
00790 { 00791 jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance(); 00792 //cfg_mgr->lockPending(); 00793 //cfg_mgr->unlockPending(); 00794 for ( std::list<jccl::ConfigManager::PendingElement>::iterator i = cfg_mgr->getPendingBegin(); 00795 i != cfg_mgr->getPendingEnd() ; ++i ) 00796 { 00797 if ( (*i).mElement->getName() == name ) 00798 { 00799 return( (*i).mElement ); 00800 } 00801 } 00802 cfg_mgr->lockActive(); 00803 jccl::ConfigElementPtr temp = cfg_mgr->getActiveConfig()->get( name ); 00804 cfg_mgr->unlockActive(); 00805 return( temp ); 00806 }
| bool cluster::ClusterManager::isClusterActive | ( | ) | [inline] |
Return true if we are running on a cluster.
Definition at line 207 of file ClusterManager.h.
00208 { 00209 vpr::Guard<vpr::Mutex> guard( mClusterActiveLock ); 00210 return mClusterActive; 00211 }
| bool cluster::ClusterManager::isClusterReady | ( | ) |
Return true if all dependancies have been satisfied.
Definition at line 171 of file ClusterManager.cpp.
References gadgetDBG_RIM(), and pluginsReady().
00172 { 00173 // -If the cluster is active and not ready 00174 // -If a StartBarrier jccl::ConfigElement does not exist 00175 // -Warn the user and set cluster ready 00176 // -Get new value of mClusterReady from asking all plugins 00177 // -Return the new mClusterReady 00178 00179 vpr::Guard<vpr::Mutex> ready_guard( mClusterReadyLock ); 00180 vpr::Guard<vpr::Mutex> active_guard( mClusterActiveLock ); 00181 00182 if ( mClusterActive && !mClusterReady ) 00183 { 00184 if ( !jccl::ConfigManager::instance()->hasElementType( "start_barrier_plugin" ) ) 00185 { 00186 vprDEBUG(gadgetDBG_RIM, vprDBG_WARNING_LVL) 00187 << clrOutBOLD(clrCYAN, "NOTE:") << std::endl << vprDEBUG_FLUSH; 00188 vprDEBUG_NEXT(gadgetDBG_RIM, vprDBG_WARNING_LVL) 00189 << "The start_barrier_plugin config element does not exist.\n" 00190 << vprDEBUG_FLUSH; 00191 vprDEBUG_NEXT(gadgetDBG_RIM, vprDBG_WARNING_LVL) 00192 << "If your application depends on each node starting at the " 00193 << "same time,\n" << vprDEBUG_FLUSH; 00194 vprDEBUG_NEXT(gadgetDBG_RIM, vprDBG_WARNING_LVL) 00195 << "then you should load and configure the Start Barrier " 00196 << "Plug-in.\n" << vprDEBUG_FLUSH; 00197 00198 mClusterReady = true; 00199 } 00200 } 00201 // Lock it here so that we can avoid confusion in pluginsReady() 00202 vpr::Guard<vpr::Mutex> guard( mPluginsLock ); 00203 return( mClusterReady && pluginsReady() ); 00204 }
| bool cluster::ClusterManager::pluginsReady | ( | ) |
Return true if all plugins have their dependancies satisfied.
Definition at line 206 of file ClusterManager.cpp.
Referenced by isClusterReady().
00207 { 00208 // Plugins are already locked since we only call this method from 00209 // isClusterReady which is only called by 00210 // StartBarrierPlugin::postPostFrame which has already locked the list 00211 // of plugins. 00212 00213 //vpr::Guard<vpr::Mutex> guard(mPluginsLock); 00214 00215 for ( std::list<ClusterPlugin*>::iterator i = mPlugins.begin(); 00216 i != mPlugins.end(); 00217 ++i ) 00218 { 00219 if ( !(*i)->isPluginReady() ) 00220 { 00221 return false; 00222 } 00223 } 00224 00225 return true; 00226 }
| void cluster::ClusterManager::setClusterReady | ( | const bool | ready | ) | [inline] |
Change the ready state of the ClusterManager.
Definition at line 226 of file ClusterManager.h.
References gadgetDBG_RIM().
00227 { 00228 vpr::Guard<vpr::Mutex> guard( mClusterReadyLock ); 00229 00230 vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_LVL ) 00231 << clrOutBOLD( clrCYAN, "[ClusterManager]" ) 00232 << " Cluster is ready." << std::endl << vprDEBUG_FLUSH; 00233 00234 mClusterReady = ready; 00235 }
| vpr::Uint64 cluster::ClusterManager::preDrawCallCount | ( | ) | [inline] |
Return the number of times that preDraw() has been called.
Definition at line 255 of file ClusterManager.h.
| vpr::Uint64 cluster::ClusterManager::postPostFrameCallCount | ( | ) | [inline] |
Return the number of times that postPostFrame() has been called.
Definition at line 263 of file ClusterManager.h.
| GADGET_API ( std::ostream getNodes | ( | ) | [friend] |
1.5.1