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...
 
size_t read (size_t unit, const char *key, char *buffer, size_t size, psio_address start, psio_address *end)
 Asynchronous read, same as PSIO::read, but nonblocking. More...
 
size_t write (size_t unit, const char *key, char *buffer, size_t size, psio_address start, psio_address *end)
 Asynchronous write, same as PSIO::write, but nonblocking. More...
 
size_t read_entry (size_t unit, const char *key, char *buffer, size_t size)
 Asynchronous read_entry, same as PSIO::read_entry, but nonblocking. More...
 
size_t write_entry (size_t unit, const char *key, char *buffer, size_t size)
 Asynchronous read_entry, same as PSIO::write_entry, but nonblocking. More...
 
size_t read_discont (size_t unit, const char *key, double **matrix, size_t row_length, size_t col_length, size_t col_skip, psio_address start)
 
size_t write_discont (size_t unit, const char *key, double **matrix, size_t row_length, size_t col_length, size_t col_skip, psio_address start)
 Same as read_discont, but for writing. More...
 
size_t zero_disk (size_t unit, const char *key, size_t rows, size_t cols)
 
size_t write_iwl (size_t 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 (size_t jobid)
 

Private Attributes

std::queue< size_t > job_
 What is the job type? More...
 
std::deque< size_t > jobID_
 Unique job ID to check for job completion. Should NEVER be 0. More...
 
std::queue< size_t > 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< size_t > size_
 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< size_t > row_length_
 Size argument for discontinuous I/O. More...
 
std::queue< size_t > col_length_
 Size argument for discontinuous I/O. More...
 
std::queue< size_t > col_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...
 
size_t 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.

size_t psi::AIOHandler::read ( size_t  unit,
const char *  key,
char *  buffer,
size_t  size,
psio_address  start,
psio_address end 
)

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

size_t psi::AIOHandler::read_discont ( size_t  unit,
const char *  key,
double **  matrix,
size_t  row_length,
size_t  col_length,
size_t  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.

size_t psi::AIOHandler::read_entry ( size_t  unit,
const char *  key,
char *  buffer,
size_t  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 ( size_t  jobid)

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

size_t psi::AIOHandler::write ( size_t  unit,
const char *  key,
char *  buffer,
size_t  size,
psio_address  start,
psio_address end 
)

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

size_t psi::AIOHandler::write_discont ( size_t  unit,
const char *  key,
double **  matrix,
size_t  row_length,
size_t  col_length,
size_t  col_skip,
psio_address  start 
)

Same as read_discont, but for writing.

size_t psi::AIOHandler::write_entry ( size_t  unit,
const char *  key,
char *  buffer,
size_t  size 
)

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

size_t psi::AIOHandler::write_iwl ( size_t  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

size_t psi::AIOHandler::zero_disk ( size_t  unit,
const char *  key,
size_t  rows,
size_t  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<size_t> psi::AIOHandler::col_length_
private

Size argument for discontinuous I/O.

std::queue<size_t> 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<size_t> psi::AIOHandler::job_
private

What is the job type?

std::deque<size_t> 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<size_t> psi::AIOHandler::row_length_
private

Size argument for discontinuous I/O.

std::queue<size_t> 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.

size_t psi::AIOHandler::uniqueID_
private

Latest unique job ID.

std::queue<size_t> psi::AIOHandler::unit_
private

Unit number argument.


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