par::cntrl Namespace Reference

Everything that is needed to control parXXL, in particular different flavours of emulated shared variables. More...


Namespaces

namespace  infra
 The required functions that any implementation of a communication infrastructure must provide.
namespace  mpi
namespace  svm
 This namespace concerns the implementation of the shared virtual memory layer.

Classes

struct  _format
class  communicator
class  communicator< void >
struct  error
 A simple class to organize the catch of errors. More...
class  info
 Access to the basic information of this parXXL run. More...
class  matrix
 This implements an generic interface to share (small) information amoung the parXXL processes. More...
class  proc_data
 Per parXXL process local data. More...
class  serialize
class  serialize_common
 Implements the serialization feature of the thread implementation. More...
struct  state_marker
 Not to be used directly. More...
class  str
 A shared string variable between the parXXL processes. More...
class  strvec
 A strvec of size par::cntrl::info::np(), one value per parXXL process. More...
class  tag_state
class  thread
class  uhash
class  unserialize
class  variable
 A shared variable between the parXXL processes. More...
class  vector
 A vector of size par::cntrl::info::np(), one value per parXXL process. More...

Typedefs

typedef void * envelopep
typedef proc_dataproc_data_p
typedef short proc_t
 The type used by parXXL for identifying parXXL processes.

Enumerations

enum  rounds { anyround = -1, finalUL = 0, initial }

Functions

void abort (char const *format,...) throw (par::cntrl::error)
 Abort a parXXL execution and return some error indication according to format, similar to printf.
template<class mtype >
int all_to_all (mtype const *smess, mtype *rmess)
template<class mtype >
int all_to_all (mtype const *smess, mtype *rmess, off_t n)
template<class stype , class rtype >
int all_to_allv (stype *smess, rtype *rmess)
template<class stype , class rtype >
int all_to_allv (stype *smess, rtype *rmess, int msgtag, bool syncRecv, bool syncSend)
 All-to-all communication of arbitrary size between all parXXL processes.
size_t binomial (sys::seed_t &seed, size_t holding, size_t nlen)
 Draw a random sample of global size nlen.
void clear_round (void)
void clear_send (void)
template<>
mem::chunk< void > & createShared (mem::chunk< void > &ch, mem::allocation loc, off_t len)
template<typename T >
mem::chunk< T > createShared (mem::allocation loc, off_t len)
template<typename T >
mem::chunk< T > & createShared (mem::chunk< T > &ch, mem::allocation loc, off_t len)
 Create a new object for par::mem::chunk ch that is allocated with type loc (usually par::mem::inSegment).
template<typename T , typename mT >
int cross (mT *&buf, off_t const *cnts, mT *recvbuf)
template<typename T , typename mT >
int cross (mT *&buf, off_t const *cnts, mT *recvbuf, int const msgtag)
 Initialize a cross over of tables of chunks.
template<>
int cross< void, par::mem::chunk< void > > (par::mem::chunk< void > *&buf, off_t const *cnts, par::mem::chunk< void > *recvbuf)
template<>
int cross< void, par::mem::chunk< void > > (par::mem::chunk< void > *&buf, off_t const *cnts, par::mem::chunk< void > *recvbuf, int const msgtag)
void exit (int arg=0)
 Exits parXXL for the calling process.
int finalize (void)
void force_next_round (void)
 Promote this parXXL process to the next superstep.
cpp::format format (sys::str &f, FILE *=NULL)
 Same as par::sys::format.
template<class mtype >
int gather (par::cntrl::proc_t &w, mtype *mess)
template<class mtype >
int gather (par::cntrl::proc_t &w, mtype *mess, off_t n)
template<class mtype >
int gather (par::cntrl::proc_t &w, mtype *mess, off_t n, int msgtag)
 Send a message from every process to process w.
size_t generate_session (void)
par::cntrl::proc_dataget_context (void)
int get_cookie (void)
 Get a `cookie' that identifies the group of the calling parXXL process.
par::cntrl::proc_data_p get_local (void)
FILE * get_out (void)
 Get the FILE* where all naratif output of parXXL goes to.
int get_round (void)
 Get the superstep of the calling parXXL process.
int get_tag (void)
mem::chunk< void > * getRecvs (proc_data const *ldata)
mem::chunk< void > * getRecvs (void)
mem::chunk< void > * getSends (void)
mem::chunk< void > * getSends (proc_data const *ldata)
template void grow (mem::stack< cpp::edge< 9 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 8 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 7 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 6 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 5 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 4 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 3 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 2 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template void grow (mem::stack< cpp::edge< 1 > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
template<unsigned dim>
void grow (mem::stack< cpp::edge< dim > > &E, size_t nlen, off_t vbeg, size_t vlen, bool withloops, sys::seed_t &seed)
 Randomly grow an existing set of edges E on all parXXL processes.
size_t hypergeom (sys::seed_t &seed, size_t holding, size_t nlen)
 Draw a random sample of global size nlen.
template<typename gT , typename lT >
void hypermat (size_t c, gT const C[], size_t u, gT const U[], lT res[], gT offsets[], sys::seed_t &seed)
template<typename T , typename mT >
int incross (mT *sbuf, mT *rbuf)
template<typename T , typename mT >
int incross (mT *sbuf, mT *rbuf, int const msgtag, bool syncRecv, bool syncSend)
 Perform the real cross over between two tables of chunks.
template<>
int incross< void, par::mem::chunk< void > > (par::mem::chunk< void > *sbuf, par::mem::chunk< void > *rbuf, int const msgtag, bool syncRecv, bool syncSend)
bool ingroup (proc_t proc)
void init_opt (void)
 Each parXXL process runs this.
bool initialized (void)
 Test whether we are connected or not.
sys::str linehead (void)
template<class mtype >
int listen (mtype *mess, off_t n)
template<class mtype >
int listen (mtype *mess, off_t n, int mstag)
 Receive message mess from somebody.
template<>
int listen< void > (void *mess, off_t n, int msgtag)
bool lock_double (FILE *stream)
 Lock stream on FILE* and on file descriptor level.
int main (void)
int main (int argc)
int main (int argc, char **argv)
int main (int argc, char **argv, char **env)
par::cntrl::proc_t mynum (proc_data &here)
par::cntrl::proc_t mynum (void)
par::cntrl::proc_t mynum (proc_data_p ldata)
 The id of this particular parXXL process.
par::cntrl::proc_t np (proc_data &here)
par::cntrl::proc_t np (void)
par::cntrl::proc_t np (proc_data_p ldata)
 The number of parXXL processes in this parXXL run.
template<class T >
int one_to_allv (par::cntrl::proc_t who, T *mess, off_t n)
template<class T >
int one_to_allv (par::cntrl::proc_t who, T *mess, off_t n, int msgtag, bool syncRecv, bool syncSend)
 Send n par::mem::chunk from who to everyboy else.
void pop_state (void)
 Revert the split into subgroups effective from the last call to par::cntrl::push_state.
template<class T >
void prefixSum (T *target, T const &val)
 Compute the processwise prefix sum of the values val on all processors and store the results in target.
bool probe (void)
void process_opt (void)
 Each cntrl::thread runs this to get its part.
void push_state (unsigned salt)
 Divide the actual group of the calling parXXL process into subgroups.
void readrc (char const *evar=0, char const *defname=0)
 Read an rc file to define the environment of the parXXL processes.
template<class mtype >
int receive (par::cntrl::proc_t whom, mtype *mess)
template<class mtype >
int receive (par::cntrl::proc_t whom, mtype *mess, off_t n)
template<class mtype >
int receive (par::cntrl::proc_t whom, mtype *mess, off_t n, int msgtag)
 Receive message mess from whom.
template<>
int receive< void > (par::cntrl::proc_t whom, void *mess, off_t n, int msgtag)
template<typename T >
size_t removeDuplicates (mem::chunk< T > &E)
 Remove duplicates in E, a sorted array of T.
int report (void) DEPRECATED_ATTR
int report (char const *format,...) DEPRECATED_ATTR
 Provide the user with some output similar to printf.
int report (FILE *os, char const *format,...) DEPRECATED_ATTR
int report (bool temporary, FILE *os, char const *format,...)
int report_temp (char const *format,...)
 Similar to report but output is considered being temporary.
template<class T >
void scalarSum (T &target, T const &val)
 Compute the sum of the values val on all processors and store the results in target.
bool scan_opt (int c, par::sys::str &arg)
 Scan an individal option during option processing and store the results temporarily for par::cntrl::process_opt().
template<class mtype >
int scatter (par::cntrl::proc_t &w, mtype *mess)
template<class mtype >
int scatter (par::cntrl::proc_t &w, mtype *mess, off_t n)
template<class mtype >
int scatter (par::cntrl::proc_t &w, mtype *mess, off_t n, int msgtag, bool syncRecv)
template<class mtype >
int scatter_gather (mtype const *smess, mtype *rmess)
template<class mtype >
int scatter_gather (mtype const *smess, mtype *rmess, off_t n)
template<class mtype >
int scatter_gather (mtype const *smess, mtype *rmess, off_t n, int msgtag, bool syncRecv)
 Send an n sized message from each process to each other process.
template<class mtype >
int send (par::cntrl::proc_t const whom, mtype const *mess)
template<class mtype >
int send (par::cntrl::proc_t const whom, mtype const *mess, off_t const n)
template<class mtype >
int send (par::cntrl::proc_t const whom, mtype const *mess, off_t const n, int msgtag)
 Send message mess to whom.
template<>
int send< void > (par::cntrl::proc_t const whom, void const *mess, off_t const n, int msgtag)
size_t session (proc_data &here)
size_t session (void)
size_t session (proc_data_p ldata)
 The id of this parXXL session.
void set_out (FILE *of=NULL)
 Redirect all naratif output of parXXL to file of.
void static_destruction (void *)
void static_initialization (void *, void const *)
int sync (void)
void throw_error (char const *st, int er=0)((noreturn)) throw (error)
int trace (char const *fname, int line)
int trace (char const *fname, int line, char const *format,...)
int trace (char const *fname, int line, FILE *os, char const *format,...) FPRINTF_ATTR2
 Similar to report but also provides possibility to give the function name and the line number.
template<class stype , class rtype >
int transfer (stype *smess, rtype &tmess, bool syncRecv, bool syncSend)
 Transfer data of arbitrary size between all parXXL processes.
template<class stype , class rtype >
int transfer (stype *smess, rtype *rmess, bool syncRecv, bool syncSend)
 Transfer data of arbitrary size between all parXXL processes.
template<class stype , class rtype >
int transfer (stype *smess, rtype *rmess, rtype &tmess, bool syncRecv, bool syncSend)
 Transfer data of arbitrary size between all parXXL processes.
template<typename T , class mT >
int uncross (mT *&buf)
template<typename T , class mT >
int uncross (mT *&buf, int const msgtag)
template<>
int uncross< void, par::mem::chunk< void > > (par::mem::chunk< void > *&buf, int const msgtag)
void usage ()
 print some usage information for the current context.
bool valid (long const proc)
bool valid (ulong const proc)
bool valid (int const proc)
 Still may cause other problems.
bool valid (unsigned const proc)

Variables

par::sys::opt common_opt
bool envVerbose
proc_t const everybody = -3
proc_t const nobody = -1
 The constant nobody has a special significance for par::cntrl::send.
FILE * stdnull = NULL
 A file pointer that is connected to /dev/null for read and write.
par::sys::once_t trigger


Detailed Description

Everything that is needed to control parXXL, in particular different flavours of emulated shared variables.

These classes should be used with care since they are not indended to to work very efficiently. Setting an instance of such a class will always introduce a communication. So in general it will terminate the current superstep.


Typedef Documentation

Definition at line 33 of file par_cntrl_proc_data.h.

typedef short par::cntrl::proc_t

The type used by parXXL for identifying parXXL processes.

Definition at line 41 of file par_cntrl_types.h.


Enumeration Type Documentation

Enumerator:
anyround 
finalUL 
initial 

Definition at line 48 of file par_cntrl_types.h.


Function Documentation

template<class mtype >
int par::cntrl::all_to_all ( mtype const *  smess,
mtype *  rmess 
) [inline]

Definition at line 424 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::all_to_all ( mtype const *  smess,
mtype *  rmess,
off_t  n 
) [inline]

Definition at line 431 of file par_cntrl_comm.h.

size_t par::cntrl::binomial ( sys::seed_t seed,
size_t  holding,
size_t  nlen 
)

Draw a random sample of global size nlen.

This simulates drawing of nlen elements out of a distrubuted set. Each processor is considered to hold holding elements of the global set. The return value tells how many elements should be drawn from there locally.

This concerns sampling with replacement. For sampling without replacement see binomial(sys::seed_t&, size_t, size_t). In particular, this means that an element might well be drawn several times and even that nlen might be larger than the total amount of elements available.

Definition at line 58 of file par_cntrl_hypermat.cc.

template<>
mem::chunk< void > & par::cntrl::createShared ( mem::chunk< void > &  ch,
mem::allocation  loc,
off_t  len 
) [inline]

Definition at line 1041 of file par_cntrl_comm.h.

template<typename T >
mem::chunk< T > par::cntrl::createShared ( mem::allocation  loc,
off_t  len 
) [inline]

Definition at line 1057 of file par_cntrl_comm.h.

template<typename T >
mem::chunk< T > & par::cntrl::createShared ( mem::chunk< T > &  ch,
mem::allocation  loc,
off_t  len 
) [inline]

Create a new object for par::mem::chunk ch that is allocated with type loc (usually par::mem::inSegment).

The object will be

  • temporary,
  • invisible and
  • shared between the parXXL processes as widely as possible:
  • it will be deleted as soon as it will have no refferences,
  • when coming back from this call it will be impossible to link to the object `by name'
  • all processes that may (e.g all processes on the same machine for segments) will refer to the same object.

Definition at line 1049 of file par_cntrl_comm.h.

par::cpp::format par::cntrl::format ( sys::str &  f,
FILE *  F = NULL 
)

Same as par::sys::format.

In addition, this prefixes the format string with information about the state of the par::cntrl machinery.

Definition at line 23 of file par_cntrl_print.cc.

template<class mtype >
int par::cntrl::gather ( par::cntrl::proc_t w,
mtype *  mess 
) [inline]

Definition at line 319 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::gather ( par::cntrl::proc_t w,
mtype *  mess,
off_t  n 
) [inline]

Definition at line 311 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::gather ( par::cntrl::proc_t w,
mtype *  mess,
off_t  n,
int  msgtag 
) [inline]

Send a message from every process to process w.

On each process mess is supposed to point to an array of cnrtl::np() parts of size n.

Postcondition:
Send and receive synchronization is done inside this routine.
See also:
par::cntrl::infra::gather for the implementation specific details.

Definition at line 326 of file par_cntrl_comm.h.

size_t par::cntrl::generate_session ( void   ) 

par::cntrl::proc_data & par::cntrl::get_context ( void   ) 

Definition at line 191 of file par_cntrl_thread.cc.

par::cntrl::proc_data_p par::cntrl::get_local ( void   )  [inline]

Definition at line 195 of file par_cntrl_proc_data.h.

int par::cntrl::get_tag ( void   ) 

template void par::cntrl::grow ( mem::stack< cpp::edge< 9 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 8 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 7 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 6 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 5 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 4 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 3 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 2 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template void par::cntrl::grow ( mem::stack< cpp::edge< 1 > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
)

template<unsigned dim>
void par::cntrl::grow ( mem::stack< cpp::edge< dim > > &  E,
size_t  nlen,
off_t  vbeg,
size_t  vlen,
bool  withloops,
sys::seed_t &  seed 
) [inline]

Randomly grow an existing set of edges E on all parXXL processes.

Randomly grow an existing set of edges E.

This is a semi-local par::cntrl wrapper of par::mem::grow. Here, nlen is the total amount of edges that should be added to all the edges of all processes. The share that processes will create individually is distributed with a hypergeometric distribution that simulates the choice of the new edges out of the old ones.

Must be called conjointly on all processors. It only exchanges control information between the processes, ie information in O(np), no edge data.

withloops true also adds one self-loop per new vertex. With the current implementation the add of the self-loop is always on process 0. This is a strong bias, so use with care.

Definition at line 27 of file par_cntrl_edge.cc.

size_t par::cntrl::hypergeom ( sys::seed_t seed,
size_t  holding,
size_t  nlen 
)

Draw a random sample of global size nlen.

This simulates drawing of nlen elements out of a distrubuted set. Each processor is considered to hold holding elements of the global set. The return value tells how many elements should be drawn from there locally.

This concerns sampling without replacement. For sampling with replacement see binomial(sys::seed_t&, size_t, size_t).

Definition at line 32 of file par_cntrl_hypermat.cc.

template<typename gT , typename lT >
void par::cntrl::hypermat ( size_t  c,
gT const   C[],
size_t  u,
gT const   U[],
lT  res[],
gT  offsets[],
sys::seed_t seed 
) [inline]

Parameters:
c amount of source buckets
C vector of length c, size of the source buckets
u amount of target buckets
U vector of length u, size of the target buckets
res the result matrix for this processor of size c times u
offsets the offsets of the target buckets for this processor

Definition at line 104 of file par_cntrl_hypermat.cc.

void par::cntrl::init_opt ( void   ) 

Each parXXL process runs this.

Definition at line 195 of file par_cntrl_opt.cc.

bool par::cntrl::lock_double ( FILE *  stream  ) 

Lock stream on FILE* and on file descriptor level.

The first type of lock ensures that two threads will not work on the stream concurrently, e.g in reopening it. The second type of lock ensures that even two different processe that act on the same file will be able to collaborate properly.

Returns:
true the both locks have been achieved. If one of the locks can not be achieved the other is also freed and false is returned.

Definition at line 212 of file par_cntrl_opt.cc.

template<class T >
void par::cntrl::prefixSum ( T *  target,
T const &  val 
) [inline]

Compute the processwise prefix sum of the values val on all processors and store the results in target.

target is supposed to have at least par::cntrl::np() + 1 elements.

Definition at line 234 of file par_cntrl_vector.h.

void par::cntrl::process_opt ( void   ) 

Each cntrl::thread runs this to get its part.

Definition at line 124 of file par_cntrl_opt.cc.

template<typename T >
size_t par::cntrl::removeDuplicates ( mem::chunk< T > &  E  )  [inline]

Remove duplicates in E, a sorted array of T.

Returns:
Exact count of number of elements that are remaining
Removes all repetitions of items from the list by comparing adjacent items in the sorted list. Last item of every process except that of process np-1, is sent as a message to the next process for comparision with its first edge. The local chunks on each process are trunkated this observed count.

Definition at line 194 of file par_cntrl_vector.h.

template<class T >
void par::cntrl::scalarSum ( T &  target,
T const &  val 
) [inline]

Compute the sum of the values val on all processors and store the results in target.

Definition at line 243 of file par_cntrl_vector.h.

bool par::cntrl::scan_opt ( int  c,
par::sys::str arg 
)

Scan an individal option during option processing and store the results temporarily for par::cntrl::process_opt().

Definition at line 82 of file par_cntrl_opt.cc.

template<class mtype >
int par::cntrl::scatter ( par::cntrl::proc_t w,
mtype *  mess 
) [inline]

Definition at line 263 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::scatter ( par::cntrl::proc_t w,
mtype *  mess,
off_t  n 
) [inline]

Definition at line 255 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::scatter ( par::cntrl::proc_t w,
mtype *  mess,
off_t  n,
int  msgtag,
bool  syncRecv 
) [inline]

Definition at line 270 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::scatter_gather ( mtype const *  smess,
mtype *  rmess 
) [inline]

Definition at line 380 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::scatter_gather ( mtype const *  smess,
mtype *  rmess,
off_t  n 
) [inline]

Definition at line 372 of file par_cntrl_comm.h.

template<class mtype >
int par::cntrl::scatter_gather ( mtype const *  smess,
mtype *  rmess,
off_t  n,
int  msgtag,
bool  syncRecv 
) [inline]

Send an n sized message from each process to each other process.

smess and rmess point to arrays of par::cntrl::np() times n elements.

Parameters:
syncRecv Controls whether or not a call to par::cntrl::clear_round() is forced inside the routine.
par::cntrl::clear_send() is always called inside the routine.

See also:
par::cntrl::infra::scatter_gather for the implementation specific details.

Definition at line 387 of file par_cntrl_comm.h.

void par::cntrl::static_destruction ( void *   ) 

void par::cntrl::static_initialization ( void *  ,
void const *   
)

void par::cntrl::throw_error ( char const *  st,
int  er = 0 
) throw (error)

Definition at line 51 of file par_cntrl_error.cc.


Variable Documentation

Definition at line 23 of file par_cntrl_readrc.cc.

Definition at line 46 of file par_cntrl_types.h.

The constant nobody has a special significance for par::cntrl::send.

Definition at line 45 of file par_cntrl_types.h.


Generated on Tue Oct 13 22:04:06 2009 for parXXL by  doxygen 1.5.8