Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

cluster::ClusterManager Class Reference

#include <ClusterManager.h>

List of all members.

Public Methods

 ClusterManager ()
virtual ~ClusterManager ()
void recoverFromLostNode (ClusterNode *lost_node)
void handlePacket (Packet *packet, ClusterNode *node)
void addPlugin (ClusterPlugin *new_manager)
 Adds a new plugin to the ClusterManager. More...

void removePlugin (ClusterPlugin *old_manager)
 Removes a plugin from the ClusterManager. More...

bool doesPluginExist (ClusterPlugin *old_manager)
 Checks if a plugin exists in the ClusterManager. More...

void sendRequests ()
void preDraw ()
void postPostFrame ()
void createBarrier ()
bool recognizeRemoteDeviceConfig (jccl::ConfigElementPtr element)
bool recognizeClusterManagerConfig (jccl::ConfigElementPtr element)
bool configAdd (jccl::ConfigElementPtr element)
 Adds the pending element to the configuration. More...

bool configRemove (jccl::ConfigElementPtr element)
 Remove the pending element from the current configuration. More...

bool configCanHandle (jccl::ConfigElementPtr element)
 Checks if this handler can process element. More...

ClusterPlugingetPluginByGUID (const vpr::GUID &plugin_guid)
jccl::ConfigElementPtr getConfigElementPointer (std::string &name)
bool isClusterActive ()
bool isClusterReady ()
bool pluginsReady ()
void setClusterReady (const bool ready)
friend GADGET_API (std::ostream &) operator<<(std


Constructor & Destructor Documentation

cluster::ClusterManager::ClusterManager  
 

Definition at line 112 of file ClusterManager.cpp.

00112                                   : mClusterActive(false), mClusterReady(false)
00113    {
00114       jccl::ConfigManager::instance()->addConfigElementHandler(ClusterNetwork::instance());
00115       jccl::DependencyManager::instance()->registerChecker(new ClusterDepChecker());
00116    }

cluster::ClusterManager::~ClusterManager   [virtual]
 

Definition at line 118 of file ClusterManager.cpp.

00119    {;}


Member Function Documentation

void cluster::ClusterManager::recoverFromLostNode ClusterNode   lost_node
 

Definition at line 170 of file ClusterManager.cpp.

00171    {
00172       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00173 
00174       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00175            i != mPlugins.end() ; i++)
00176       {
00177          (*i)->recoverFromLostNode(lost_node);
00178       }
00179    }

void cluster::ClusterManager::handlePacket Packet   packet,
ClusterNode   node
 

Definition at line 181 of file ClusterManager.cpp.

References gadgetDBG_RIM, and getPluginByGUID.

00182    {
00183       // If the ClusterManager should handle this packet, then do so.
00184       if (packet->getPacketType() == Header::RIM_END_BLOCK)
00185       {
00186          // -Set New State
00187          if (node == NULL)
00188          {
00189             return;
00190          }
00191 
00192          node->setUpdated(true);
00193          return;
00194       }
00195       else if (packet->getPacketType() == Header::RIM_CONNECTION_REQ ||
00196                packet->getPacketType() == Header::RIM_CONNECTION_ACK)
00197       {
00198          ClusterNetwork::instance()->handlePacket(packet, node);
00199       }
00200 
00201       vpr::GUID plugin_guid = packet->getPluginId();
00202 
00203       ClusterPlugin* temp_plugin = getPluginByGUID(plugin_guid);
00204 
00205       if (NULL != temp_plugin)
00206       {
00207          temp_plugin->handlePacket(packet, node);
00208       }
00209       else
00210       {
00211          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00212             << "Plugin " << plugin_guid.toString() << " does not exist to handle this packet"
00213             << std::endl << vprDEBUG_FLUSH;
00214       }
00215    }

void cluster::ClusterManager::addPlugin ClusterPlugin   new_plugin
 

Adds a new plugin to the ClusterManager.

Definition at line 220 of file ClusterManager.cpp.

References doesPluginExist, and gadgetDBG_RIM.

00221    {
00222       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00223       if (!doesPluginExist(new_plugin))
00224       {
00225          mPlugins.push_back(new_plugin);
00226          std::pair<vpr::GUID, ClusterPlugin*> p = std::make_pair(new_plugin->getPluginGUID(), new_plugin);
00227          mPluginMap.insert(p);
00228 
00229          // We should do this here, but since we do not add the manager until its configAdd
00230          // currently you can see the problem
00231          jccl::ConfigManager::instance()->addConfigElementHandler(new_plugin);
00232          //We can still unregister it when removed below though
00233          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00234             << "Adding Plugin: " << new_plugin->getPluginName() <<std::endl << vprDEBUG_FLUSH;
00235       }
00236    }

void cluster::ClusterManager::removePlugin ClusterPlugin   old_plugin
 

Removes a plugin from the ClusterManager.

Definition at line 251 of file ClusterManager.cpp.

References gadgetDBG_RIM.

00252    {
00253       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00254 
00255       mPluginMap.erase(old_plugin->getPluginGUID());
00256 
00257       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00258            i != mPlugins.end() ; i++)
00259       {
00260          if ((*i) == old_plugin)
00261          {
00262             vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00263             << "Removing Plugin: " << old_plugin->getPluginName() <<std::endl << vprDEBUG_FLUSH;
00264             mPlugins.erase(i);
00265             jccl::ConfigManager::instance()->removeConfigElementHandler(*i);
00266             return;
00267          }
00268       }
00269    }

bool cluster::ClusterManager::doesPluginExist ClusterPlugin   old_manager
 

Checks if a plugin exists in the ClusterManager.

Definition at line 274 of file ClusterManager.cpp.

Referenced by addPlugin.

00275    {
00276       vprASSERT(mPluginsLock.test() == 1 && "mManagers Lock must be aquired before calling ClusterManager::doesManagerExist()");
00277 
00278       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00279            i != mPlugins.end() ; i++)
00280       {
00281          if ((*i) == old_manager)
00282          {
00283             return(true);
00284          }
00285       }
00286       return(false);
00287    }

void cluster::ClusterManager::sendRequests  
 

Definition at line 289 of file ClusterManager.cpp.

00290    {
00291       // Idea is to not create frame lock if we do not need to
00292       bool updateNeeded = false;
00293       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00294 
00295 //      vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00296 //         << "Send Requests\n" << vprDEBUG_FLUSH;
00297 
00298       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00299            i != mPlugins.end() ; i++)
00300       {
00301          (*i)->sendRequests();
00302          updateNeeded = true;
00303       }
00304       if (updateNeeded)
00305       {
00306          sendEndBlocksAndSignalUpdate(1);
00307       }
00308    }

void cluster::ClusterManager::preDraw  
 

Definition at line 310 of file ClusterManager.cpp.

00311    {
00312       // Idea is to not create frame lock if we do not need to
00313       bool updateNeeded = false;
00314       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00315 
00316 //      vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00317 //         << "PreDraw\n" << vprDEBUG_FLUSH;
00318 
00319       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00320            i != mPlugins.end() ; i++)
00321       {
00322          (*i)->preDraw();
00323          updateNeeded = true;
00324       }
00325       if (updateNeeded)
00326       {
00327          sendEndBlocksAndSignalUpdate(2);
00328       }
00329    }

void cluster::ClusterManager::postPostFrame  
 

Definition at line 331 of file ClusterManager.cpp.

00332    {
00333       // -If not running
00334       //   -If all plugins ready
00335       //     - isClusterReady
00336 
00337 
00338       // Idea is to not create frame lock if we do not need to
00339       bool updateNeeded = false;
00340       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00341 
00342 //      vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00343 //         << "postPostFrame\n" << vprDEBUG_FLUSH;
00344 
00345       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00346            i != mPlugins.end() ; i++)
00347       {
00348          (*i)->postPostFrame();
00349          updateNeeded = true;
00350       }
00351       if (updateNeeded)
00352       {
00353 //         vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00354 //            << "Before End\n" << vprDEBUG_FLUSH;
00355          sendEndBlocksAndSignalUpdate(3);
00356 //         vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00357 //            << "After End\n" << vprDEBUG_FLUSH;
00358       }
00359    }

void cluster::ClusterManager::createBarrier  
 

Definition at line 360 of file ClusterManager.cpp.

00361    {
00362       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00363 
00364       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00365            i != mPlugins.end() ; i++)
00366       {
00367          //if ((*i)->isActive())
00368          //{  // As soon as we find a plug-in that creates
00369             // a barrier, we can continue. Maybe not since
00370             // this will not match up on different machines
00371             if((*i)->createBarrier())
00372             {
00373                return;
00374             }
00375          //}
00376       }
00377    }

bool cluster::ClusterManager::recognizeRemoteDeviceConfig jccl::ConfigElementPtr    element
 

Definition at line 422 of file ClusterManager.cpp.

References getConfigElementPointer.

00423    {
00424      if ( gadget::DeviceFactory::instance()->recognizeDevice(element) &&  element->getNum("device_host") > 0 )
00425      {
00426         std::string device_host = element->getProperty<std::string>("device_host");
00427         //std::cout << "Checking: " << element->getName() << std::endl;
00428         if ( !device_host.empty() )
00429         {
00430            // THIS IS A HACK: find a better way to do this
00431            jccl::ConfigElementPtr device_host_ptr = getConfigElementPointer(device_host);
00432            if (device_host_ptr.get() != NULL)
00433            {
00434               std::string host_name = device_host_ptr->getProperty<std::string>("host_name");
00435               if (!ClusterNetwork::isLocalHost(host_name))
00436               {
00437                  return true;
00438               }// Device is on the local machine
00439            }// Could not find the deviceHost in the configuration
00440         }// Device is not a remote device since there is no name in the deviceHost field
00441      }// Else it is not a device, or does not have a deviceHost property
00442      return false;
00443    }

bool cluster::ClusterManager::recognizeClusterManagerConfig jccl::ConfigElementPtr    element
 

Definition at line 445 of file ClusterManager.cpp.

Referenced by configAdd, configCanHandle, and configRemove.

00446    {
00447      return(element->getID() == ClusterManager::getElementType());
00448    }

bool cluster::ClusterManager::configAdd jccl::ConfigElementPtr    element
 

Adds the pending element to the configuration.

Precondition:
configCanHandle(element) == true.
Returns:
true iff element was successfully added to configuration.

Definition at line 454 of file ClusterManager.cpp.

References configCanHandle, gadgetDBG_RIM, getConfigElementPointer, and recognizeClusterManagerConfig.

00455    {
00456       vpr::DebugOutputGuard dbg_output(gadgetDBG_RIM, vprDBG_STATE_LVL,
00457                               std::string("Cluster Manager: Adding config element.\n"),
00458                               std::string("...done adding element.\n"));
00459 
00460       vprASSERT(configCanHandle(element));
00461 
00462       bool ret_val = false;      // Flag to return success
00463 
00464       if (recognizeClusterManagerConfig(element))
00465       {
00466          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00467             << "Configure the Cluster: " << element->getName()
00468             << "\n" << vprDEBUG_FLUSH;
00469 
00470          // Get a list of cluster nodes to use for this cluster.
00471          int num_nodes = element->getNum(std::string("cluster_node"));
00472          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL) << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00473             << "configAdd() Number of nodes: " << num_nodes
00474             << "\n" << vprDEBUG_FLUSH;
00475          for (int i = 0 ; i < num_nodes ; i++)
00476          {
00477             std::string new_node = element->getProperty<std::string>(std::string("cluster_node"), i);
00478             vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
00479                << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00480                << "configAdd() New Node Name: " << new_node << "\n"
00481                << vprDEBUG_FLUSH;
00482             jccl::ConfigElementPtr new_node_element = getConfigElementPointer(new_node);
00483             std::string new_node_hostname = new_node_element->getProperty<std::string>(std::string("host_name"));
00484             vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
00485                << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00486                << "configAdd() New Node Hostname: " << new_node_hostname
00487                << "\n" << vprDEBUG_FLUSH;
00488 
00489             if (!ClusterNetwork::isLocalHost(new_node_hostname))
00490             {
00491                vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
00492                   << clrOutBOLD(clrCYAN,"[ClusterManager] ")
00493                   << "configAdd() Added Node since it is non-local\n"
00494                   << vprDEBUG_FLUSH;
00495 
00496                vpr::Guard<vpr::Mutex> guard(mClusterNodesLock);
00497                mClusterNodes.push_back(new_node_hostname);
00498             }
00499          }
00500 
00501 
00502          // Load the plugins.
00503 
00504          vpr::DebugOutputGuard dbg_output(gadgetDBG_RIM, vprDBG_STATE_LVL,
00505                                           std::string("Handling cluster_manager element:\n"),
00506                                           std::string("-- end state -- \n"));
00507 
00508          // Keep this up to date with the version of the element definition we're
00509          // expecting to handle.
00510          const unsigned int cur_version(2);
00511 
00512          // If the element version is less than cur_version, we will not try to
00513          // proceed.  Instead, we'll print an error message and return false so
00514          // that the Config Manager knows this element wasn't consumed.
00515          if ( element->getVersion() < cur_version )
00516          {
00517             vprDEBUG(gadgetDBG_RIM, vprDBG_CRITICAL_LVL)
00518                << clrOutBOLD(clrRED, "ERROR")
00519                << " [gadget::ClusterManager::configAdd()]: Element named '"
00520                << element->getName() << "'" << std::endl << vprDEBUG_FLUSH;
00521             vprDEBUG_NEXT(gadgetDBG_RIM, vprDBG_CRITICAL_LVL)
00522                << "is version " << element->getVersion()
00523                << ", but we require at least version " << cur_version
00524                << std::endl << vprDEBUG_FLUSH;
00525             vprDEBUG_NEXT(gadgetDBG_RIM, vprDBG_CRITICAL_LVL)
00526                << "Ignoring this element and moving on." << std::endl
00527                << vprDEBUG_FLUSH;
00528             ret_val = false;
00529          }
00530          // We got the right version of the config element and can proceed.
00531          else
00532          {
00533             const std::string plugin_path_prop_name("plugin_path");
00534             const int path_count(element->getNum(plugin_path_prop_name));
00535             std::vector<fs::path> search_path(path_count);
00536 
00537             for ( unsigned int i = 0; i < search_path.size(); ++i )
00538             {
00539                std::string temp_str =
00540                   vpr::replaceEnvVars(element->getProperty<std::string>(plugin_path_prop_name, i));
00541 
00542                try
00543                {
00544                   search_path[i] = fs::path(temp_str, fs::native);
00545                }
00546                catch(fs::filesystem_error& fsEx)
00547                {
00548                   vprDEBUG(vprDBG_ERROR, vprDBG_CRITICAL_LVL)
00549                      << clrOutNORM(clrRED, "ERROR:")
00550                      << "[cluster::ClusterManager::configAdd()] File system "
00551                      << "exception caught while converting\n"
00552                      << vprDEBUG_FLUSH;
00553                   vprDEBUG_NEXT(vprDBG_ERROR, vprDBG_CRITICAL_LVL)
00554                      << "'" << temp_str << "'\n" << vprDEBUG_FLUSH;
00555                   vprDEBUG_NEXT(vprDBG_ERROR, vprDBG_CRITICAL_LVL)
00556                      << "to a Boost.Filesystem path.\n" << vprDEBUG_FLUSH;
00557                   vprDEBUG_NEXT(vprDBG_ERROR, vprDBG_CRITICAL_LVL)
00558                      << fsEx.what() << std::endl << vprDEBUG_FLUSH;
00559                }
00560             }
00561 
00562             // Append a default driver search path to search_path.
00563             const std::string gadget_base_dir("GADGET_BASE_DIR");
00564             const std::string vj_base_dir("VJ_BASE_DIR");
00565             std::string base_dir;
00566             bool append_default(true);
00567 
00568             // Try get to the value of $GADGET_BASE_DIR first.  If that fails,
00569             // fall back on $VJ_BASE_DIR.
00570             if ( ! vpr::System::getenv(gadget_base_dir, base_dir).success() )
00571             {
00572                if ( ! vpr::System::getenv(vj_base_dir, base_dir).success() )
00573                {
00574                   // If neither $GADGET_BASE_DIR nor $VJ_BASE_DIR is set, then
00575                   // we cannot append a default driver search path.
00576                   append_default = false;
00577                }
00578             }
00579 
00580             if ( append_default )
00581             {
00582 #if defined(VPR_OS_IRIX) && defined(_ABIN32)
00583                const std::string bit_suffix("32");
00584 #elif defined(VPR_OS_IRIX) && defined(_ABI64)
00585                const std::string bit_suffix("64");
00586 #else
00587                const std::string bit_suffix("");
00588 #endif
00589 
00590                fs::path default_search_dir =
00591                   fs::path(base_dir, fs::native) /
00592                      (std::string("lib") + bit_suffix) /
00593                      std::string("gadgeteer") / std::string("plugins");
00594 
00595                vprDEBUG(gadgetDBG_RIM, vprDBG_VERB_LVL)
00596                   << "[cluster::ClusterManager::configAdd()] Appending "
00597                   << "default search path '"
00598                   << default_search_dir.native_directory_string() << "'\n"
00599                   << vprDEBUG_FLUSH;
00600 
00601                search_path.push_back(default_search_dir);
00602             }
00603 
00604             // --- Load cluster plugin dsos -- //
00605             // - Load individual plugins
00606             const std::string plugin_prop_name("plugin");
00607             const std::string plugin_init_func("initPlugin");
00608             int plugin_count = element->getNum(plugin_prop_name);
00609             std::string plugin_dso;
00610 
00611             for ( int i = 0; i < plugin_count; ++i )
00612             {
00613                plugin_dso = element->getProperty<std::string>(plugin_prop_name, i);
00614 
00615                if ( ! plugin_dso.empty() )
00616                {
00617                   vprDEBUG(gadgetDBG_RIM, vprDBG_STATE_LVL)
00618                      << "[cluster::ClusterManager::configAdd()] Loading "
00619                      << "plugin DSO '" << plugin_dso << "'\n"
00620                      << vprDEBUG_FLUSH;
00621 
00622                   Callable functor(this);
00623                   mPluginLoader.findAndInitDSO(plugin_dso, search_path,
00624                                                plugin_init_func, functor);
00625                }
00626             }
00627 
00628             ret_val = true;
00629          }
00630 
00631          // Dump the status
00632          {
00633             vpr::DebugOutputGuard dbg_output(gadgetDBG_RIM, vprDBG_CONFIG_LVL,
00634                                     std::string("New Cluster Manager state:\n"),
00635                                     std::string("-- end state -- \n"));
00636             vprDEBUG(gadgetDBG_RIM, vprDBG_CONFIG_LVL) << (*this) << vprDEBUG_FLUSH;
00637          }
00638       }
00639       
00640       vpr::Guard<vpr::Mutex> guard(mClusterActiveLock);
00641       mClusterActive = true;
00642          
00643       return ret_val;         // Return the success flag if we added at all
00644     }

bool cluster::ClusterManager::configRemove jccl::ConfigElementPtr    element
 

Remove the pending element from the current configuration.

Precondition:
configCanHandle(element) == true.
Returns:
true iff the element (and any objects it represented) were successfully removed.

Definition at line 652 of file ClusterManager.cpp.

References gadgetDBG_RIM, and recognizeClusterManagerConfig.

00653    {
00654       if (recognizeClusterManagerConfig(element))
00655       {
00656          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00657             << "[ClusterManager] Shutdown the Cluster: " << element->getName()
00658             << "\n" << vprDEBUG_FLUSH;
00659          return(true);
00660       }
00661       else
00662       {
00663          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00664             << "[ClusterManager::configRemove] ERROR, Something is seriously wrong, we should never get here\n"
00665             << vprDEBUG_FLUSH;
00666          return(false);
00667       }
00668    }

bool cluster::ClusterManager::configCanHandle jccl::ConfigElementPtr    element
 

Checks if this handler can process element.

Typically, an implementation of handler will check the element's description name/token to decide if it knows how to deal with it.

Returns:
true iff this handler can process element.

Definition at line 676 of file ClusterManager.cpp.

References recognizeClusterManagerConfig.

Referenced by configAdd.

00677    {
00678       if (recognizeClusterManagerConfig(element))
00679       {
00680          return true;
00681       }
00682 
00683 /*
00684       for ( std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00685             i != mPlugins.end();
00686             ++i )
00687       {
00688          if ((*i)->configCanHandle(element))
00689          {
00690             return true;
00691          }
00692       }
00693 */
00694       return false;
00695    }

ClusterPlugin * cluster::ClusterManager::getPluginByGUID const vpr::GUID &    plugin_guid
 

Definition at line 238 of file ClusterManager.cpp.

Referenced by handlePacket.

00239    {
00240       std::map<vpr::GUID, ClusterPlugin*>::const_iterator i = mPluginMap.find(plugin_guid);
00241       if(i != mPluginMap.end())
00242       {
00243          return ((*i).second);
00244       }
00245       return NULL;
00246    }

jccl::ConfigElementPtr cluster::ClusterManager::getConfigElementPointer std::string &    name
 

Definition at line 703 of file ClusterManager.cpp.

Referenced by configAdd, and recognizeRemoteDeviceConfig.

00704    {
00705       jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance();
00706       //cfg_mgr->lockPending();
00707       //cfg_mgr->unlockPending();
00708       for (std::list<jccl::ConfigManager::PendingElement>::iterator i = cfg_mgr->getPendingBegin();
00709            i != cfg_mgr->getPendingEnd() ; ++i)
00710       {
00711          if ((*i).mElement->getName() == name)
00712          {
00713             return((*i).mElement);
00714          }
00715       }
00716       cfg_mgr->lockActive();
00717       jccl::ConfigElementPtr temp = cfg_mgr->getActiveConfig()->get(name);
00718       cfg_mgr->unlockActive();
00719       return(temp);
00720    }

bool cluster::ClusterManager::isClusterActive   [inline]
 

Definition at line 134 of file ClusterManager.h.

00135    {
00136       vpr::Guard<vpr::Mutex> guard(mClusterActiveLock);
00137       return mClusterActive;
00138    }

bool cluster::ClusterManager::isClusterReady  
 

Definition at line 121 of file ClusterManager.cpp.

References gadgetDBG_RIM, and pluginsReady.

00122    {
00123       // -If the cluster is active and not ready
00124       //   -If a StartBarrier jccl::ConfigElement does not exist
00125       //    -Warn the user and set cluster ready
00126       //   -Get new value of mClusterReady from asking all plugins
00127       // -Return the new mClusterReady
00128 
00129       vpr::Guard<vpr::Mutex> ready_guard(mClusterReadyLock);
00130       vpr::Guard<vpr::Mutex> active_guard(mClusterActiveLock);
00131 
00132       if (mClusterActive && !mClusterReady)
00133       {
00134          if ( ! jccl::ConfigManager::instance()->hasElementType("start_barrier_plugin") )
00135          {
00136             vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00137             << clrOutBOLD(clrRED, "StartBarrier config element does not exist. ")
00138             << clrOutBOLD(clrRED, "If your application depends on each node starting at the same ")
00139             << clrOutBOLD(clrRED, "time you should add a StartBarrierPlugin configuration element.")
00140             << std::endl << vprDEBUG_FLUSH;
00141 
00142             std::cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX DONE - ERROR XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << std::endl;
00143 
00144             mClusterReady = true;
00145          }
00146       }
00147       // Lock it here so that we can avoid confusion in pluginsReady()
00148       vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00149       return(mClusterReady && pluginsReady());
00150    }

bool cluster::ClusterManager::pluginsReady  
 

Definition at line 152 of file ClusterManager.cpp.

Referenced by isClusterReady.

00153    {
00154       // Plugins are already locked since we only call this method from
00155       // isClusterReady which is only called by StartBarrierPlugin::postPostFrame
00156       // which has already locked the list of plugins.
00157 
00158       //vpr::Guard<vpr::Mutex> guard(mPluginsLock);
00159 
00160       for (std::list<ClusterPlugin*>::iterator i = mPlugins.begin();
00161            i != mPlugins.end() ; i++)
00162       {
00163          if (!(*i)->isPluginReady())
00164             return false;
00165       }
00166 
00167       return true;
00168    }

void cluster::ClusterManager::setClusterReady const bool    ready [inline]
 

Definition at line 144 of file ClusterManager.h.

00145    {
00146       vpr::Guard<vpr::Mutex> guard(mClusterReadyLock);
00147       std::cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX DONE - Set XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << std::endl;
00148       mClusterReady = ready;
00149    }

cluster::ClusterManager::GADGET_API std::ostream &    [inline]
 

Definition at line 152 of file ClusterManager.h.

00155    {
00156       vpr::Guard<vpr::Mutex> guard(mClusterNodesLock);
00157       return mClusterNodes;
00158    }


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:43 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002