Psi4
Public Member Functions | Private Member Functions | Private Attributes | List of all members
psi::pk::PKWrkrReord Class Reference

#include <PK_workers.h>

Inheritance diagram for psi::pk::PKWrkrReord:
psi::pk::PKWorker

Public Member Functions

 PKWrkrReord (std::shared_ptr< BasisSet > primary, SharedSieve sieve, std::shared_ptr< AIOHandler > AIO, int target_file, size_t buffer_size, unsigned int nbuffer)
 Constructor. More...
 
 ~PKWrkrReord ()
 Destructor. More...
 
virtual void allocate_wK (size_t buf_size, unsigned int buf_per_thread)
 
virtual void fill_values (double val, size_t i, size_t j, size_t k, size_t l)
 Filling integral values in relevant buffer. More...
 
virtual void fill_values_wK (double val, size_t i, size_t j, size_t k, size_t l)
 Filling wK integrals in relevant buffer. More...
 
virtual void write (std::vector< size_t > min_ind, std::vector< size_t > max_ind, size_t pk_pairs)
 Writing values in the appropriate PK file entry. More...
 
virtual void write_wK (std::vector< size_t > min_ind, std::vector< size_t > max_ind, size_t pk_pairs)
 Writing wK values in the appropriate PK file entry. More...
 
- Public Member Functions inherited from psi::pk::PKWorker
 PKWorker (std::shared_ptr< BasisSet > primary, SharedSieve sieve, std::shared_ptr< AIOHandler > AIO, int target_file, size_t buf_size)
 Constructor for PKWorker. More...
 
virtual ~PKWorker ()
 Destructor for PKWorker, does nothing. More...
 
std::shared_ptr< AIOHandlerAIO () const
 Accessor functions. More...
 
size_t nbuf () const
 
size_t buf_size () const
 
size_t max_idx () const
 
size_t offset () const
 
int target_file () const
 
unsigned int bufidx () const
 
unsigned int P () const
 
unsigned int Q () const
 
unsigned int R () const
 
unsigned int S () const
 
bool do_wK () const
 
void set_do_wK (bool tmp)
 Set do_wK. More...
 
void first_quartet (size_t i)
 Set up the first shell quartet to be computed. More...
 
bool more_work ()
 Is there a shell quartet left to compute ? More...
 
void next_quartet ()
 Get the next shell quartet for the current worker. More...
 
virtual void allocate_wK (std::shared_ptr< std::vector< size_t >> pos, int wKfile)
 For IWL, we need different arguments. More...
 
virtual void finalize_ints (size_t pk_pairs)
 For in-core: only finalize the integral array. More...
 
virtual void finalize_ints_wK (size_t pk_pairs)
 For in-core: only finalize the wK integral array. More...
 
virtual bool pop_value (unsigned int bufid, double &val, size_t &i, size_t &j, size_t &k, size_t &l)
 Functions specific to disk pre-sorting of integrals. More...
 
virtual bool pop_value_wK (unsigned int bufid, double &val, size_t &i, size_t &j, size_t &k, size_t &l)
 Functions specific to disk pre-sorting of integrals. More...
 
virtual void insert_value (unsigned int bufid, double val, size_t i, size_t j, size_t k, size_t l)
 
virtual void insert_value_wK (unsigned int bufid, double val, size_t i, size_t j, size_t k, size_t l)
 
virtual void flush ()
 Flush a buffer to disk. More...
 
virtual void flush_wK ()
 

Private Member Functions

virtual void initialize_task ()
 

Private Attributes

std::vector< std::vector< char * > > labels_J_
 TOC entry labels. More...
 
std::vector< std::vector< char * > > labels_K_
 
std::vector< std::vector< char * > > labels_wK_
 
std::vector< std::vector
< size_t > > 
jobID_J_
 Job IDs. More...
 
std::vector< std::vector
< size_t > > 
jobID_K_
 
std::vector< std::vector
< size_t > > 
jobID_wK_
 
std::vector< double * > J_bufs_
 The internal buffers themselves. More...
 
std::vector< double * > K_bufs_
 
std::vector< double * > wK_bufs_
 
psio_address dummy_
 Dummy psio_address for storage of write return value. More...
 
unsigned int buf_
 Internal buffer index. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from psi::pk::PKWorker
static char * get_label_J (const int batch)
 Get TOC labels for J or K. More...
 
static char * get_label_K (const int batch)
 
static char * get_label_wK (const int batch)
 
- Protected Member Functions inherited from psi::pk::PKWorker
void set_nbuf (unsigned int tmp)
 Setter function for nbuf_. More...
 
void set_bufsize (size_t len)
 Setting the buffer size, changes for wK. More...
 
void set_max_idx (size_t tmp)
 Setter function for max_idx. More...
 

Detailed Description

class PKWrkReord: This worker class is associated with the Reorder algorithm, which computes integrals in the order needed to write them directly to the PK supermatrix. The worker provides the shells needed for a given interval of canonical indices ijkl, which are stored in a single buffer. Once the buffer is full, it gets written in the appropriate entries of the PK file. All integrals needed for a buffer are computed by a single thread to avoid using atomic operations on a big buffer. We thus need enough buffers for good load balancing. More buffers also means more integrals recomputed, though. We may want to improve on this aspect.

Constructor & Destructor Documentation

psi::pk::PKWrkrReord::PKWrkrReord ( std::shared_ptr< BasisSet primary,
SharedSieve  sieve,
std::shared_ptr< AIOHandler AIO,
int  target_file,
size_t  buffer_size,
unsigned int  nbuffer 
)

Constructor.

psi::pk::PKWrkrReord::~PKWrkrReord ( )

Destructor.

Member Function Documentation

void psi::pk::PKWrkrReord::allocate_wK ( size_t  buf_size,
unsigned int  buf_per_thread 
)
virtual

Reallocating memory for wK We make sure the deallocated buffers have been written to disk

Reimplemented from psi::pk::PKWorker.

void psi::pk::PKWrkrReord::fill_values ( double  val,
size_t  i,
size_t  j,
size_t  k,
size_t  l 
)
virtual

Filling integral values in relevant buffer.

Implements psi::pk::PKWorker.

void psi::pk::PKWrkrReord::fill_values_wK ( double  val,
size_t  i,
size_t  j,
size_t  k,
size_t  l 
)
virtual

Filling wK integrals in relevant buffer.

Implements psi::pk::PKWorker.

void psi::pk::PKWrkrReord::initialize_task ( )
privatevirtual

Get max ijkl index included in current buffer Overloaded by specific derived classes

Implements psi::pk::PKWorker.

void psi::pk::PKWrkrReord::write ( std::vector< size_t >  min_ind,
std::vector< size_t >  max_ind,
size_t  pk_pairs 
)
virtual

Writing values in the appropriate PK file entry.

Implements psi::pk::PKWorker.

void psi::pk::PKWrkrReord::write_wK ( std::vector< size_t >  min_ind,
std::vector< size_t >  max_ind,
size_t  pk_pairs 
)
virtual

Writing wK values in the appropriate PK file entry.

Reimplemented from psi::pk::PKWorker.

Member Data Documentation

unsigned int psi::pk::PKWrkrReord::buf_
private

Internal buffer index.

psio_address psi::pk::PKWrkrReord::dummy_
private

Dummy psio_address for storage of write return value.

std::vector< double* > psi::pk::PKWrkrReord::J_bufs_
private

The internal buffers themselves.

std::vector< std::vector<size_t> > psi::pk::PKWrkrReord::jobID_J_
private

Job IDs.

std::vector< std::vector<size_t> > psi::pk::PKWrkrReord::jobID_K_
private
std::vector< std::vector<size_t> > psi::pk::PKWrkrReord::jobID_wK_
private
std::vector< double* > psi::pk::PKWrkrReord::K_bufs_
private
std::vector< std::vector<char*> > psi::pk::PKWrkrReord::labels_J_
private

TOC entry labels.

This class can have a variable number of internal buffers, thus we need to have a vector of all relevant quantities. In addition, each buffer can write to more than one PK entries

std::vector< std::vector<char*> > psi::pk::PKWrkrReord::labels_K_
private
std::vector< std::vector<char*> > psi::pk::PKWrkrReord::labels_wK_
private
std::vector< double* > psi::pk::PKWrkrReord::wK_bufs_
private

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