28 static void get_coords(
int coord[],
int node,
int linear)
31 for(
int i=0; i <
Nd; ++i)
72 for(
int mu=0; mu <
Nd; mu++) {
73 block_sizes[mu] = proc_size[mu]/io_geom[mu];
78 if( proc_size[mu] % io_geom[mu] != 0 ) block_sizes[mu]++;
87 for(
int mu=0; mu <
Nd; mu++) {
89 io_node_coords[mu] = node_coords[mu] / block_sizes[mu];
90 io_node_coords[mu] *= block_sizes[mu];
109 const std::string& path,
111 {
open(xml,path,serpar);}
114 const std::string& path,
121 for(
int m=0; m <
Nd; ++m)
154 if ((qio_in =
QIO_open_read(xml_c, path.c_str(), &layout, &fs, &iflag)) == NULL)
158 QDPIO::cerr <<
"QDPFileReader: failed to open file " << path << std::endl;
167 std::istringstream ss;
229 QDPIO::cerr <<
"Failed to read the Record Info" << std::endl;
233 std::istringstream ss;
257 QDPIO::cerr <<
"Failed to read the Record Info" << std::endl;
262 std::string from_disk;
266 from_disk.size()*
sizeof(
char),
268 (
void *)&(from_disk[0]));
281 std::istringstream ss;
297 const std::string& path,
302 open(xml,path,qdp_volfmt,qdp_serpar,qdp_mode, std::string());
306 const std::string& path,
310 const std::string& data_LFN)
312 open(xml,path,qdp_volfmt,qdp_serpar,qdp_mode, data_LFN);
317 const std::string& path,
321 open(file_xml,path,qdp_volfmt,qdp_serpar,
QDPIO_OPEN, std::string());
325 const std::string& path,
328 const std::string& data_LFN)
336 const std::string& path,
345 const std::string& path,
348 const std::string& data_LFN)
354 const std::string& path,
358 const std::string& data_LFN)
364 for(
int m=0; m <
Nd; ++m)
384 QDPIO::cerr <<
"QDPFileWriter - error in creating QIO string" << std::endl;
415 QDPIO::cerr <<
"Unknown value for qdp_volfmt " << qdp_volfmt << std::endl;
437 QDPIO::cerr <<
"Unknown value for qdp_mode " << qdp_mode << std::endl;
453 if( data_LFN.length() == 0 ) {
466 &fs, &oflag)) == NULL )
470 QDPIO::cerr <<
"QDPFileWriter: failed to open file " << path << std::endl;
530 std::string ss = s1.
str();
531 char *typestr=(
char *)
"char";
532 char *signtype=(
char *)
"U";
538 sizeof(
char), ss.size());
545 QDPIO::cerr <<
"QDPFileWriter::write - error in creating XML string" << std::endl;
555 ss.size()*
sizeof(
char),
559 QDPIO::cerr <<
"QDPFileWriter: error in write" << std::endl;
Binary buffer input class.
void open(const std::string &s)
Construct from a string.
Binary buffer output class.
std::string str() const
Return entire buffer as a string.
bool bad() const
Query whether an unrecoverable error has occurred.
void close()
Closes the last file opened.
void open(XMLReader &xml, const std::string &path, QDP_serialparallel_t qdp_serpar)
Opens a file for reading.
~QDPFileReader()
Closes the last file opened.
bool is_open()
Queries whether a file is open.
void read(XMLReader &xml)
Reads a record header only.
bool eof() const
Query whether the end-of-file has been reached.
void clear(QDP_iostate_t state=QDPIO_goodbit)
Sets a new value for the IO status, ignoring the existing value.
QDPFileReader()
Partial constructor.
bool bad() const
Query whether an unrecoverable error has occurred.
QDPFileWriter()
Partial constructor.
~QDPFileWriter()
Closes the last file opened.
void write(XMLBufferWriter &xml, const QDPType< T, C > &s1)
Write a QDP object.
void clear(QDP_iostate_t state=QDPIO_goodbit)
Sets a new value for the control state ignoring the existing value.
void close()
Closes the last file opened.
void open(XMLBufferWriter &xml, const std::string &path, QDP_volfmt_t qdp_volfmt, QDP_serialparallel_t qdp_serpar)
Opens a file for writing and writes the file metadata.
bool is_open()
Queries whether a file is open.
Writes XML metadata to a buffer.
std::string str() const
Return entire buffer as a string.
void open(const std::string &filename)
Opens and reads an XML file.
Container for a multi-dimensional 1D array.
void QDPOScalarFactoryPut(char *buf, size_t linear, int count, void *arg)
Function for moving data.
QDP_serialparallel_t
File access mode.
bool is_open(QDPFileReader &qsw)
Is a QDPFileReader open.
void close(QDPFileReader &qsw)
Close a QDPFileReader.
QDP_filemode_t
File open mode.
void QDPOScalarFactoryGet(char *buf, size_t linear, int count, void *arg)
Function for moving data.
QDP_iostate_t
QDPIO state.
int nodeNumber()
Returns the node number of this node.
const multi1d< int > & logicalSize()
Returns the logical size of this machine.
int linearSiteIndex(int site)
The linearized site index for the corresponding lexicographic site.
int sitesOnNode()
Subgrid lattice volume.
multi1d< int > siteCoords(int node, int index) QDP_CONST
Reconstruct the lattice coordinate from the node and site number.
int getNodeNumberFrom(const multi1d< int > &node_coord)
Returns the node number given some logical node coordinate.
int numNodes()
Returns the number of nodes.
const multi1d< int > & lattSize()
Virtual grid (problem grid) lattice size.
bool isIOGridDefined(void) QDP_CONST
check if I/O grid is defined
int numIONodeGrid(void) QDP_CONST
number of I/O nodes
multi1d< int > getLogicalCoordFrom(int node)
Returns the logical node coordinates given some node number.
int vol()
Total lattice volume.
bool primaryNode()
Returns whether this is the primary node.
const multi1d< int > & getIONodeGrid() QDP_CONST
Get the I/O Node grid.
StandardOutputStream cout
StandardOutputStream cerr
Yet another random number generator.
static void get_coords(int coord[], int node, int linear)
int io_node(int node)
io_node(node) returns the I/O node for node 'node'
static int get_node_number(const int coord[])
int io_node_multifile(int node)
io_node for multifile...
static int get_node_index(const int coord[])
void QDP_abort(int status)
Panic button.
static int get_sites_on_node(int node)
int master_io_node(void)
Master IO node is always IO node 0.
Primary include file for QDP.
int QIO_read_record_data(QIO_Reader *in, void(*put)(char *buf, size_t index, int count, void *arg), size_t datum_size, int word_size, void *arg)
QIO_Writer * QIO_open_write(QIO_String *xml_file, const char *filename, int volfmt, QIO_Layout *layout, QIO_Filesystem *fs, QIO_Oflag *oflag)
QIO_Reader * QIO_open_read(QIO_String *xml_file, const char *filename, QIO_Layout *layout, QIO_Filesystem *fs, QIO_Iflag *iflag)
int QIO_close_write(QIO_Writer *out)
int QIO_write(QIO_Writer *out, QIO_RecordInfo *record_info, QIO_String *xml_record, void(*get)(char *buf, size_t index, int count, void *arg), size_t datum_size, int word_size, void *arg)
int QIO_close_read(QIO_Reader *in)
int QIO_read_record_info(QIO_Reader *in, QIO_RecordInfo *record_info, QIO_String *xml_record)
void QIO_string_set(QIO_String *qs, const char *const string)
char * QIO_string_ptr(QIO_String *qs)
QIO_String * QIO_string_create(void)
void QIO_string_destroy(QIO_String *qs)
int QIO_get_datacount(QIO_RecordInfo *record_info)
QIO_RecordInfo * QIO_create_record_info(int recordtype, int lower[], int upper[], int n, char *datatype, char *precision, int colors, int spins, int typesize, int datacount)
void QIO_destroy_record_info(QIO_RecordInfo *record_info)
DML_master_io_node_t master_io_node
void(* get_coords)(int coords[], int node, int index)
int(* node_number)(const int coords[])
int(* num_sites)(int node)
int(* node_index)(const int coords[])