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

#include <aiohandler.h>

Public Member Functions

 AIOHandler (std::shared_ptr< PSIO > psio)
 AIO_Handlers are constructed around a synchronous PSIO object. More...
 
 ~AIOHandler ()
 Destructor. More...
 
void synchronize ()
 When called, synchronize will not return until all requested data has been read or written. More...
 
unsigned long int read (unsigned int unit, const char *key, char *buffer, ULI size, psio_address start, psio_address *end)
 Asynchronous read, same as PSIO::read, but nonblocking. More...
 
unsigned long int write (unsigned int unit, const char *key, char *buffer, ULI size, psio_address start, psio_address *end)
 Asynchronous write, same as PSIO::write, but nonblocking. More...
 
unsigned long int read_entry (unsigned int unit, const char *key, char *buffer, ULI size)
 Asynchronous read_entry, same as PSIO::read_entry, but nonblocking. More...
 
unsigned long int write_entry (unsigned int unit, const char *key, char *buffer, ULI size)
 Asynchronous read_entry, same as PSIO::write_entry, but nonblocking. More...
 
unsigned long read_discont (unsigned int unit, const char *key, double **matrix, ULI row_length, ULI col_length, ULI col_skip, psio_address start)
 
unsigned long write_discont (unsigned int unit, const char *key, double **matrix, ULI row_length, ULI col_length, ULI col_skip, psio_address start)
 Same as read_discont, but for writing. More...
 
unsigned long zero_disk (unsigned int unit, const char *key, ULI rows, ULI cols)
 
unsigned long write_iwl (unsigned int unit, const char *key, size_t nints, int lastbuf, char *labels, char *values, size_t labsize, size_t valsize, size_t *address)
 
void call_aio ()
 Generic function bound to thread internally. More...
 
void wait_for_job (unsigned long int jobid)
 

Private Attributes

std::queue< unsigned int > job_
 What is the job type? More...
 
std::deque< unsigned long int > jobID_
 Unique job ID to check for job completion. Should NEVER be 0. More...
 
std::queue< unsigned int > unit_
 Unit number argument. More...
 
std::queue< const char * > key_
 Entry Key (80-char) argument. More...
 
std::queue< char * > buffer_
 Memory buffer argument. More...
 
std::queue< ULIsize_
 Size argument. More...
 
std::queue< psio_addressstart_
 Start address argument. More...
 
std::queue< psio_address * > end_
 End address pointer argument. More...
 
std::queue< double ** > matrix_
 Matrix pointer for discontinuous I/O. More...
 
std::queue< ULIrow_length_
 Size argument for discontinuous I/O. More...
 
std::queue< ULIcol_length_
 Size argument for discontinuous I/O. More...
 
std::queue< ULIcol_skip_
 Size argument for discontinuous I/O. More...
 
std::queue< int > nints_
 For IWL: number of ints in the buffer. More...
 
std::queue< int > lastbuf_
 For IWL: is this the last buffer ? More...
 
std::queue< size_t * > address_
 For IWL: pointer to current position in file. More...
 
std::shared_ptr< PSIOpsio_
 PSIO object this AIO_Handler is built on. More...
 
std::shared_ptr< std::thread > thread_
 Thread this AIO_Handler is currently running on. More...
 
std::mutex * locked_
 Lock variable. More...
 
unsigned long int uniqueID_
 Latest unique job ID. More...
 
std::condition_variable condition_
 condition variable to wait for a specific job to finish More...
 

Constructor & Destructor Documentation

psi::AIOHandler::AIOHandler ( std::shared_ptr< PSIO psio)

AIO_Handlers are constructed around a synchronous PSIO object.

psi::AIOHandler::~AIOHandler ( )

Destructor.

Member Function Documentation

void psi::AIOHandler::call_aio ( )

Generic function bound to thread internally.

unsigned long int psi::AIOHandler::read ( unsigned int  unit,
const char *  key,
char *  buffer,
ULI  size,
psio_address  start,
psio_address end 
)

Asynchronous read, same as PSIO::read, but nonblocking.

unsigned long psi::AIOHandler::read_discont ( unsigned int  unit,
const char *  key,
double **  matrix,
ULI  row_length,
ULI  col_length,
ULI  col_skip,
psio_address  start 
)

Asynchronous read for reading discontinuous disk space into a continuous chunk of memory, i.e.

[***] [-—***--—] [***] [-—***--—] [***] [-—***--—] [***] <<– [-—***--—] [***] [-—***--—] [***] [-—***--—] [***] [-—***--—]

The buffer has dimensions row_length by col_length. The disk space has dimensions row_length by col_length + col_skip.

These functions are not necessary for psio, but for aio they are.

unsigned long psi::AIOHandler::read_entry ( unsigned int  unit,
const char *  key,
char *  buffer,
ULI  size 
)

Asynchronous read_entry, same as PSIO::read_entry, but nonblocking.

void psi::AIOHandler::synchronize ( )

When called, synchronize will not return until all requested data has been read or written.

void psi::AIOHandler::wait_for_job ( unsigned long int  jobid)

Function that checks if a job has been completed using the JobID. The function only returns when the job is completed.

unsigned long psi::AIOHandler::write ( unsigned int  unit,
const char *  key,
char *  buffer,
ULI  size,
psio_address  start,
psio_address end 
)

Asynchronous write, same as PSIO::write, but nonblocking.

unsigned long psi::AIOHandler::write_discont ( unsigned int  unit,
const char *  key,
double **  matrix,
ULI  row_length,
ULI  col_length,
ULI  col_skip,
psio_address  start 
)

Same as read_discont, but for writing.

unsigned long psi::AIOHandler::write_entry ( unsigned int  unit,
const char *  key,
char *  buffer,
ULI  size 
)

Asynchronous read_entry, same as PSIO::write_entry, but nonblocking.

unsigned long psi::AIOHandler::write_iwl ( unsigned int  unit,
const char *  key,
size_t  nints,
int  lastbuf,
char *  labels,
char *  values,
size_t  labsize,
size_t  valsize,
size_t *  address 
)

Write IWL Write an IWL buffer, thus containing IWL_INTS_PER_BUF integrals, 4 labels per integral, plus one integer indicating whether it is the last buffer and one integer counting the number of integrals in the current buffer

unsigned long psi::AIOHandler::zero_disk ( unsigned int  unit,
const char *  key,
ULI  rows,
ULI  cols 
)

Zero disk Fills a double precision disk entry with zeros Total fill size is rows*cols*sizeof(double) Buffer memory of cols*sizeof(double) is used

Member Data Documentation

std::queue<size_t*> psi::AIOHandler::address_
private

For IWL: pointer to current position in file.

std::queue<char*> psi::AIOHandler::buffer_
private

Memory buffer argument.

std::queue<ULI> psi::AIOHandler::col_length_
private

Size argument for discontinuous I/O.

std::queue<ULI> psi::AIOHandler::col_skip_
private

Size argument for discontinuous I/O.

std::condition_variable psi::AIOHandler::condition_
private

condition variable to wait for a specific job to finish

std::queue<psio_address*> psi::AIOHandler::end_
private

End address pointer argument.

std::queue<unsigned int> psi::AIOHandler::job_
private

What is the job type?

std::deque<unsigned long int> psi::AIOHandler::jobID_
private

Unique job ID to check for job completion. Should NEVER be 0.

std::queue<const char*> psi::AIOHandler::key_
private

Entry Key (80-char) argument.

std::queue<int> psi::AIOHandler::lastbuf_
private

For IWL: is this the last buffer ?

std::mutex* psi::AIOHandler::locked_
private

Lock variable.

std::queue<double**> psi::AIOHandler::matrix_
private

Matrix pointer for discontinuous I/O.

std::queue<int> psi::AIOHandler::nints_
private

For IWL: number of ints in the buffer.

std::shared_ptr<PSIO> psi::AIOHandler::psio_
private

PSIO object this AIO_Handler is built on.

std::queue<ULI> psi::AIOHandler::row_length_
private

Size argument for discontinuous I/O.

std::queue<ULI> psi::AIOHandler::size_
private

Size argument.

std::queue<psio_address> psi::AIOHandler::start_
private

Start address argument.

std::shared_ptr<std::thread> psi::AIOHandler::thread_
private

Thread this AIO_Handler is currently running on.

unsigned long int psi::AIOHandler::uniqueID_
private

Latest unique job ID.

std::queue<unsigned int> psi::AIOHandler::unit_
private

Unit number argument.


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