LAMA
|
#include <StorageIO.hpp>
Public Types | |
typedef T | ValueType |
This is the type of the matrix values. | |
Static Public Member Functions | |
static void | writeCSRToFile (const PartitionId size, const PartitionId rank, const LAMAArray< IndexType > &csrIA, const IndexType numColumns, const LAMAArray< IndexType > &csrJA, const LAMAArray< ValueType > &csrValues, const std::string &fileName, const File::FileType &fileType, const File::DataType &dataType, const File::IndexDataType indexDataTypeIA, const File::IndexDataType indexDataTypeJA) |
General version of writing CSR storage to a file. | |
static void | writeCSRToFormattedFile (const LAMAArray< IndexType > &csrIA, const LAMAArray< IndexType > &csrJA, const LAMAArray< ValueType > &csrValues, const std::string &fileName) |
static void | writeCSRToBinaryFile (const LAMAArray< IndexType > &csrIA, const LAMAArray< IndexType > &csrJA, const LAMAArray< ValueType > &csrValues, const std::string &fileName, const long indexDataTypeSizeIA, const long indexDataTypeSizeJA, const long dataTypeSize) |
static void | writeCSRToXDRFile (const LAMAArray< IndexType > &csrIA, const LAMAArray< IndexType > &csrJA, const LAMAArray< ValueType > &csrValues, const std::string &fileName, const long indexDataTypeSizeIA, const long indexDataTypeSizeJA, const long dataTypeSize) |
static void | writeCSRToMMFile (const LAMAArray< IndexType > &csrIA, const IndexType numColumns, const LAMAArray< IndexType > &csrJA, const LAMAArray< ValueType > &csrValues, const std::string &fileName, const File::DataType &dataType) |
static void | readCSRFromFile (LAMAArray< IndexType > &csrIA, IndexType &numColumns, LAMAArray< IndexType > &csrJA, LAMAArray< ValueType > &csrValues, const std::string &fileName) |
static void | readCSRFromFormattedFile (LAMAArray< IndexType > &csrIA, LAMAArray< IndexType > &csrJA, LAMAArray< ValueType > &csrValues, const std::string &fileName, const IndexType numRows) |
static void | readCSRFromBinaryFile (LAMAArray< IndexType > &csrIA, LAMAArray< IndexType > &csrJA, LAMAArray< ValueType > &csrValues, const std::string &fileName, const IndexType numRows) |
Reading storage data from a binary file. | |
static void | readCSRFromXDRFile (LAMAArray< IndexType > &csrIA, LAMAArray< IndexType > &csrJA, LAMAArray< ValueType > &csrValues, const std::string &fileName, const IndexType numRows) |
static void | readCSRFromMMFile (LAMAArray< IndexType > &csrIA, IndexType &numColumns, LAMAArray< IndexType > &csrJA, LAMAArray< ValueType > &csrValues, const std::string &fileName) |
static size_t | getDataTypeSize (const File::DataType dataType) |
static void | writeCSRHeader (const IndexType numRows, const IndexType numValues, const File::FileType &fileType, const std::string &fileName, const PartitionId size, const PartitionId rank) |
This method writes a header file for a CSR storage. | |
static void | readCSRHeader (IndexType &numRows, IndexType &numColumns, IndexType &numValues, PartitionId &size, PartitionId &rank, File::FileType &fileType, const std::string &fileName) |
static size_t | getIndexDataTypeSize (const File::IndexDataType indexDataType) |
Protected Member Functions | |
LAMA_LOG_DECL_STATIC_LOGGER (logger) | |
logger for Storage IO |
typedef T lama::StorageIO< T >::ValueType |
This is the type of the matrix values.
size_t lama::StorageIO< ValueType >::getDataTypeSize | ( | const File::DataType | dataType | ) | [static] |
size_t lama::_StorageIO::getIndexDataTypeSize | ( | const File::IndexDataType | indexDataType | ) | [static, inherited] |
References lama::File::INT, LAMA_THROWEXCEPTION, and lama::File::LONG.
lama::_StorageIO::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [protected, inherited] |
logger for Storage IO
void lama::StorageIO< ValueType >::readCSRFromBinaryFile | ( | LAMAArray< IndexType > & | csrIA, |
LAMAArray< IndexType > & | csrJA, | ||
LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName, | ||
const IndexType | numRows | ||
) | [static] |
Reading storage data from a binary file.
Be careful: no implicit conversions are supported here, so the binary file must contain data of exact the same type as needed.
References lama::WriteAccess< T >::get(), and lama::readBinaryData().
void lama::StorageIO< ValueType >::readCSRFromFile | ( | LAMAArray< IndexType > & | csrIA, |
IndexType & | numColumns, | ||
LAMAArray< IndexType > & | csrJA, | ||
LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName | ||
) | [static] |
References lama::File::BINARY, lama::File::FORMATTED, LAMA_THROWEXCEPTION, and lama::File::XDR.
void lama::StorageIO< ValueType >::readCSRFromFormattedFile | ( | LAMAArray< IndexType > & | csrIA, |
LAMAArray< IndexType > & | csrJA, | ||
LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName, | ||
const IndexType | numRows | ||
) | [static] |
References LAMA_THROWEXCEPTION.
void lama::StorageIO< ValueType >::readCSRFromMMFile | ( | LAMAArray< IndexType > & | csrIA, |
IndexType & | numColumns, | ||
LAMAArray< IndexType > & | csrJA, | ||
LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName | ||
) | [static] |
References lama::WriteAccess< T >::get(), getErrorString(), lama::MatrixValue< ValueType >::i, lama::MatrixValue< ValueType >::j, LAMA_THROWEXCEPTION, mm_is_complex, mm_is_matrix, mm_is_pattern, mm_is_skew, mm_is_sparse, mm_is_symmetric, mm_read_banner(), mm_read_mtx_crd_size(), lama::OpenMPCSRUtils::sortRowElements(), and lama::MatrixValue< ValueType >::v.
void lama::StorageIO< ValueType >::readCSRFromXDRFile | ( | LAMAArray< IndexType > & | csrIA, |
LAMAArray< IndexType > & | csrJA, | ||
LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName, | ||
const IndexType | numRows | ||
) | [static] |
References lama::WriteAccess< T >::get(), LAMA_ASSERT_EQUAL_ERROR, LAMA_THROWEXCEPTION, and lama::readData().
void lama::_StorageIO::readCSRHeader | ( | IndexType & | numRows, |
IndexType & | numColumns, | ||
IndexType & | numValues, | ||
PartitionId & | size, | ||
PartitionId & | rank, | ||
File::FileType & | fileType, | ||
const std::string & | fileName | ||
) | [static, inherited] |
void lama::_StorageIO::writeCSRHeader | ( | const IndexType | numRows, |
const IndexType | numValues, | ||
const File::FileType & | fileType, | ||
const std::string & | fileName, | ||
const PartitionId | size, | ||
const PartitionId | rank | ||
) | [static, inherited] |
This method writes a header file for a CSR storage.
[in] | numRows | is number of rows of the storage |
[in] | numValues | is number of values of the storage |
[in] | fileType | specifies the type of representation (e.g. binary) |
[in] | filename | is the name of the header file to write |
[in] | size | stands for number of partitions, is CSR storage is part of a distributed matrix |
[in] | rank | stands for the rank of the partition. |
Note: for distributed CSR matrices each partition has its own header file. #row and #non-zero values are the values for each local part.
References lama::File::BINARY, lama::File::FORMATTED, LAMA_THROWEXCEPTION, lama::_StorageIO::mIversion, VERSION_ID, and lama::File::XDR.
void lama::StorageIO< ValueType >::writeCSRToBinaryFile | ( | const LAMAArray< IndexType > & | csrIA, |
const LAMAArray< IndexType > & | csrJA, | ||
const LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName, | ||
const long | indexDataTypeSizeIA, | ||
const long | indexDataTypeSizeJA, | ||
const long | dataTypeSize | ||
) | [static] |
References lama::ReadAccess< T >::get(), LAMA_THROWEXCEPTION, and lama::_LAMAArray::size().
void lama::StorageIO< ValueType >::writeCSRToFile | ( | const PartitionId | size, |
const PartitionId | rank, | ||
const LAMAArray< IndexType > & | csrIA, | ||
const IndexType | numColumns, | ||
const LAMAArray< IndexType > & | csrJA, | ||
const LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName, | ||
const File::FileType & | fileType, | ||
const File::DataType & | dataType, | ||
const File::IndexDataType | indexDataTypeIA, | ||
const File::IndexDataType | indexDataTypeJA | ||
) | [static] |
General version of writing CSR storage to a file.
[in] | size,rank | header information in case of distributed matrices |
[in] | csrIA,csrJA,csrValues | are the CSR arrays |
[in] | numColumns | number of (global) columns |
[in] | fileName | name of output file |
[in] | fileType | type of file |
[in] | dataType | specifies precision of real values |
[in] | indexDataTypeIA | specifies precision of IA array |
[in] | indexDataTypeJA | specifies precision of JA array |
References lama::File::BINARY, lama::File::FORMATTED, LAMA_THROWEXCEPTION, lama::File::MATRIX_MARKET, lama::_LAMAArray::size(), and lama::File::XDR.
void lama::StorageIO< ValueType >::writeCSRToFormattedFile | ( | const LAMAArray< IndexType > & | csrIA, |
const LAMAArray< IndexType > & | csrJA, | ||
const LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName | ||
) | [static] |
References lama::_LAMAArray::size().
void lama::StorageIO< ValueType >::writeCSRToMMFile | ( | const LAMAArray< IndexType > & | csrIA, |
const IndexType | numColumns, | ||
const LAMAArray< IndexType > & | csrJA, | ||
const LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName, | ||
const File::DataType & | dataType | ||
) | [static] |
References lama::File::COMPLEX, lama::File::DOUBLE, lama::File::FLOAT, lama::File::INTEGER, lama::File::INTERNAL, LAMA_THROWEXCEPTION, mm_initialize_typecode, mm_set_complex, mm_set_integer, mm_set_matrix, mm_set_pattern, mm_set_real, mm_set_sparse, mm_write_banner(), mm_write_mtx_crd_size(), lama::File::PATTERN, and lama::_LAMAArray::size().
void lama::StorageIO< ValueType >::writeCSRToXDRFile | ( | const LAMAArray< IndexType > & | csrIA, |
const LAMAArray< IndexType > & | csrJA, | ||
const LAMAArray< ValueType > & | csrValues, | ||
const std::string & | fileName, | ||
const long | indexDataTypeSizeIA, | ||
const long | indexDataTypeSizeJA, | ||
const long | dataTypeSize | ||
) | [static] |
References lama::ReadAccess< T >::get(), lama::_LAMAArray::size(), and lama::XDRFileStream::write().