open sch ALPS Project: scheduler/scheduler.h

ALPS Project: scheduler library

Header file scheduler/scheduler.h

This header contains the base class for the factory to create user objects and the function to start the simulation.

Synopsis

namespace alps {
namespace scheduler {

class Factory
{
public:
  virtual Task* make_task(const ProcessList& where ,const boost::filesystem::path& file) const=0;
  virtual Worker* make_worker(const osiris::ProcessList& where,const palm::Parameters& parms,int node) const=0;
};

template <class WORKER, class TASK=Task>
class SimpleFactory : public Factory
{
public:
  virtual Task* make_task(const ProcessList& where ,const boost::filesystem::path& file) const;
  virtual Worker* make_worker(const osiris::ProcessList& where,const palm::Parameters& parms,int node) const;
};

int start(int argc, char** argv ,const Factory&);

}
}

The Factory class

is a factory to create user Worker objects and their controlling Task objects. This is currently used to implement the Monte Carlo factory classes but will be made more general in the next release. Both of the functions need to be overloaded by the user of the library.

The SimpleFactory template can be used for factories that just create a single type of simulation, which might be the most common case. They expect a constructor with the same signature as the function.

virtual Worker* make_worker(const osiris::ProcessList& where,const palm::Parameters& parms,int node) const;
creates a new user object derived from Worker on the nodes given by the argument where and with the parameters given by parms. The last argument node will be used in a future release to support multi-node workers spread over more than one node. The argument (which is alway 0 at the moment) will be the index into the ProcessList for which the object should be constructed. The parameters object parms can be used to distinguish bewteen different types of simulations in a program that does more than one type of simulations.

The SimpleFactory class

just forwards the arguments to make_task and make_worker to the constructors of the objects specified as template parameters. More documentation and interface changes will follow as we generalize the scheduler library to simulations other than Monte Carlo simulations.

Functions

int start(int argc, char** argv, const Factory& user_factory);
runs the simulation(s). argc and argv are the parameters passed to program by the operating system (see the section about running a simulation). The user_factory object will be used to create and load the Worker objects of the simulations. It should be an object of a class derived from Factory.

copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)