MPQC  3.0.0-alpha
sc::DistArray4 Class Referenceabstract

DistArray4 contains a set of one or more distributed dense 4-index arrays. More...

#include <math/distarray4/distarray4.h>

Inheritance diagram for sc::DistArray4:
sc::SavableState sc::DescribedClass sc::RefCount sc::DistArray4_MemoryGrp sc::DistArray4_MPIIOFile sc::DistArray4_Node0File sc::DistArray4_MPIIOFile_Ind

Public Types

typedef unsigned int tbint_type
 Types of two-body operators that DistArray4 understands.
 

Public Member Functions

 DistArray4 (int num_te_types, int ni, int nj, int nx, int ny, DistArray4Storage storage=DistArray4Storage_XY)
 
 DistArray4 (StateIn &)
 
void save_data_state (StateOut &)
 Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR initializes them. More...
 
virtual Ref< DistArray4clone (const DistArray4Dimensions &dim=DistArray4Dimensions::default_dim())=0
 how to clone. More...
 
int num_te_types () const
 The number of types of integrals that are being handled together.
 
int ni () const
 Rank of index space i.
 
int nj () const
 Rank of index space j.
 
int nx () const
 Rank of index space x.
 
int ny () const
 Rank of index space y.
 
const DistArray4Storage & storage () const
 physical storage of the integrals. The default storage is XY. Storage is not mutable.
 
size_t blocksize () const
 Size of each block of the integrals of one type, in double words.
 
size_t blksize () const
 
virtual void activate ()
 call this before operations on this object can begin
 
virtual void deactivate ()
 call this after operations on this object are finished. May destroy data (see data_persistent()).
 
virtual bool data_persistent () const =0
 if this returns false, call to deactivate may destroy data
 
virtual const double * retrieve_pair_block (int i, int j, tbint_type oper_type, double *buf=0) const =0
 Retrieves an ij block of integrals. More...
 
virtual void retrieve_pair_subblock (int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, double *buf) const =0
 Retrieves a rectangular subblock of ij block of integrals. More...
 
virtual void release_pair_block (int i, int j, tbint_type oper_type) const =0
 Releases the buffer that holds ij block of integrals. If it was allocated by DistArray4, it will be freed.
 
virtual void store_pair_block (int i, int j, tbint_type oper_type, const double *ints)=0
 Stores an ij pair block of integrals. More...
 
virtual void store_pair_subblock (int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, const double *ints)=0
 Stores an rectangular subblock of ij block of integrals. More...
 
int ij_index (int i, int j) const
 
virtual bool is_avail (int i, int j) const =0
 Can this block be accessed via retrieve_pair_block from this task?
 
virtual bool is_local (int i, int j) const =0
 Is this block stored locally? If true, this implies that it can be retrieved efficiently (compare to is_avail).
 
virtual bool has_access (int proc) const =0
 Does this task have access to all blocks?
 
int tasks_with_access (std::vector< int > &twa_map) const
 Returns the total number of tasks with access to integrals. More...
 
const Ref< MessageGrp > & msg () const
 
bool active () const
 
- Public Member Functions inherited from sc::SavableState
SavableStateoperator= (const SavableState &)
 
void save_state (StateOut &)
 Save the state of the object as specified by the StateOut object. More...
 
void save_object_state (StateOut &)
 This can be used for saving state when the exact type of the object is known for both the save and the restore. More...
 
virtual void save_vbase_state (StateOut &)
 Save the virtual bases for the object. More...
 
- Public Member Functions inherited from sc::DescribedClass
 DescribedClass (const DescribedClass &)
 
DescribedClassoperator= (const DescribedClass &)
 
ClassDescclass_desc () const MPQC__NOEXCEPT
 This returns the unique pointer to the ClassDesc corresponding to the given type_info object. More...
 
const char * class_name () const
 Return the name of the object's exact type.
 
int class_version () const
 Return the version of the class.
 
virtual void print (std::ostream &=ExEnv::out0()) const
 Print the object.
 
Ref< DescribedClassref ()
 Return this object wrapped up in a Ref smart pointer. More...
 
- Public Member Functions inherited from sc::RefCount
size_t identifier () const
 Return the unique identifier for this object that can be compared for different objects of different types. More...
 
int lock_ptr () const
 Lock this object.
 
int unlock_ptr () const
 Unlock this object.
 
void use_locks (bool inVal)
 start and stop using locks on this object
 
refcount_t nreference () const
 Return the reference count.
 
refcount_t reference ()
 Increment the reference count and return the new count.
 
refcount_t dereference ()
 Decrement the reference count and return the new count.
 
int managed () const
 
void unmanage ()
 Turn off the reference counting mechanism for this object. More...
 

Static Public Attributes

static const unsigned int max_num_te_types = 14
 

Protected Member Functions

size_t nxy () const
 
int ntasks () const
 total number of tasks
 
int me () const
 rank of this task
 
int classdebug () const
 return debug level for this class
 
- Protected Member Functions inherited from sc::SavableState
 SavableState (const SavableState &)
 
 SavableState (StateIn &)
 Each derived class StateIn CTOR handles the restore corresponding to calling save_object_state, save_vbase_state, and save_data_state listed above. More...
 
- Protected Member Functions inherited from sc::RefCount
 RefCount (const RefCount &)
 
RefCountoperator= (const RefCount &)
 

Additional Inherited Members

- Static Public Member Functions inherited from sc::SavableState
static void save_state (SavableState *s, StateOut &)
 
static SavableStaterestore_state (StateIn &si)
 Restores objects saved with save_state. More...
 
static SavableStatekey_restore_state (StateIn &si, const char *keyword)
 Like restore_state, but keyword is used to override values while restoring.
 
static SavableStatedir_restore_state (StateIn &si, const char *objectname, const char *keyword=0)
 

Detailed Description

DistArray4 contains a set of one or more distributed dense 4-index arrays.

These 4-index quantities are typically AO or MO integrals. Since integrals are typically computed in sets – for example, R12 methods require integrals of operators 1/r12, r12, [t1,r12], and [t2,r12] at the same time – several sets of integrals are held together. The data can then be described as (ijxy)^O where i, j, x, and, y are indices with ranges [0,ni), [0,nj), etc. and O labels the operator type and ranges from 0 to num_te_types. The data is stored and accessed as follows: each ij block is a set of num_te_types base-0 contiguous 2-dimensional array with dimensions nx and ny. How blocks are stored and accessed is determined in the derived class. It is also possible to have the physical storage to be xy or yx.

See also
DistArray4::storage()

Public interface of DistArray4 is designed to accomodate the needs of the TwoBodyMOIntsTransform objects. Parallel AO->MO integral transforms are performed in single or multiple passes. In the latter case all (jxy)^O integrals are produces for a particular subrange of i. These integrals are contained in a MemoryGrp object. The contents of the MemoryGrp object is "stored" in accumulator using store_memorygrp(Ref<MemoryGrp>& mem, int ni), where ni is the size of the subrange of i produced in this pass. After all batches have been stored, the content of DistArray4 needs to be "committed" using commit. After that blocks of MO integrals can be accessed using retrieve_pair_block.

Member Function Documentation

◆ clone()

virtual Ref<DistArray4> sc::DistArray4::clone ( const DistArray4Dimensions dim = DistArray4Dimensions::default_dim())
pure virtual

how to clone.

optional dim allows to obtain an object of the same type but different size. the default is to obtain an object of the same size.

Implemented in sc::DistArray4_MPIIOFile_Ind, sc::DistArray4_Node0File, and sc::DistArray4_MemoryGrp.

Referenced by sc::SingleReference_R12Intermediates< T >::ijxy().

◆ retrieve_pair_block()

virtual const double* sc::DistArray4::retrieve_pair_block ( int  i,
int  j,
tbint_type  oper_type,
double *  buf = 0 
) const
pure virtual

Retrieves an ij block of integrals.

Note that it comes stored according to storage(). No locking is performed.

Parameters
bufspecifies the buffer in which to write the data (if not provided, will allocate dynamically). this buffer will be used by subsequent retrieve_pair_block() requests until release_pair_block() is called.

Implemented in sc::DistArray4_MPIIOFile_Ind, sc::DistArray4_Node0File, and sc::DistArray4_MemoryGrp.

Referenced by sc::SingleReference_R12Intermediates< T >::ijxy().

◆ retrieve_pair_subblock()

virtual void sc::DistArray4::retrieve_pair_subblock ( int  i,
int  j,
tbint_type  oper_type,
int  xstart,
int  xfence,
int  ystart,
int  yfence,
double *  buf 
) const
pure virtual

Retrieves a rectangular subblock of ij block of integrals.

See also
retrieve_pair_block()

Implemented in sc::DistArray4_MPIIOFile_Ind, sc::DistArray4_Node0File, and sc::DistArray4_MemoryGrp.

◆ save_data_state()

void sc::DistArray4::save_data_state ( StateOut )
virtual

Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR initializes them.

This must be implemented by the derived class if the class has data.

Reimplemented from sc::SavableState.

Reimplemented in sc::DistArray4_MPIIOFile_Ind, sc::DistArray4_MPIIOFile, sc::DistArray4_Node0File, and sc::DistArray4_MemoryGrp.

◆ store_pair_block()

virtual void sc::DistArray4::store_pair_block ( int  i,
int  j,
tbint_type  oper_type,
const double *  ints 
)
pure virtual

Stores an ij pair block of integrals.

It is assumed to be stored according to storage(). It does not have to be "local", i.e. is_local(i,j) can be false, but:

  • nonlocal writes may require additional copies and/or communication.
  • and currently fail for some implementations :-( Locking is performed, hence should be thread safe

Implemented in sc::DistArray4_MPIIOFile_Ind, sc::DistArray4_Node0File, and sc::DistArray4_MemoryGrp.

◆ store_pair_subblock()

virtual void sc::DistArray4::store_pair_subblock ( int  i,
int  j,
tbint_type  oper_type,
int  xstart,
int  xfence,
int  ystart,
int  yfence,
const double *  ints 
)
pure virtual

Stores an rectangular subblock of ij block of integrals.

Most efficient if the block is contiguous, i.e. yfence - ystart = ny().

See also
store_pair_block()

Implemented in sc::DistArray4_MPIIOFile_Ind, sc::DistArray4_Node0File, and sc::DistArray4_MemoryGrp.

◆ tasks_with_access()

int sc::DistArray4::tasks_with_access ( std::vector< int > &  twa_map) const

Returns the total number of tasks with access to integrals.

If task i has access to the integrals, then twa_map[i] is its index among the tasks with access, -1 otherwise.

Referenced by sc::SingleReference_R12Intermediates< T >::ij_xy(), and sc::SingleReference_R12Intermediates< T >::ijxy().


The documentation for this class was generated from the following file:

Generated at Sun Jan 26 2020 23:24:04 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.