Added new reading routines (engine state,
4d double, 4d int); fixed error in RestartInfo output; added the maximum length of the engine state string into sim_constants.h
This commit is contained in:
+18
-8
@@ -5,6 +5,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
#include "simulation/errors.h"
|
||||
#include "constants/sim_constants.h"
|
||||
|
||||
#include "simulation/mpi_communication.h"
|
||||
|
||||
@@ -412,6 +413,10 @@ void Hdf5Writer::write(const std::string& data, std::string path) {
|
||||
H5Fclose(file);
|
||||
}
|
||||
|
||||
// maybe split into a function that writes a string in parallel and one that writes an
|
||||
// int in parallel. Would be a bit more effort but it would be more consistent with the
|
||||
// way the rest of the writer functions work
|
||||
|
||||
// writes a string-representation of an random numbers engine (right now assumed mt19973)
|
||||
// written output: input string padded with 0 at the end to achieve a fixed length
|
||||
// and the size of the input string
|
||||
@@ -424,10 +429,10 @@ void Hdf5Writer::writeRNG(const std::string& data, std::string path_base) {
|
||||
* restarted), length of the max size uncertain, relatively large storage space usage (>6370 bytes/cpu/output)
|
||||
* (comparision: HAWK: size of file ~ 3.4MB/sync, RestartInfo Size (estimate) ~ 81MB/sync (12800 procs))
|
||||
*
|
||||
* Second option: wrapper for the engine and count the times its been used and store that number.
|
||||
* Also has an issue with restarts on a different platform (since engine implementation is platform dependent).
|
||||
* Signigicantly lower storage space usage. Restoring the engine state would easy in implementation
|
||||
* (potentially a bit more expensive in execution time: discard() function).
|
||||
* Second option: wrapper for the engine and count the times its been used and store that number.
|
||||
* Also has an issue with restarts on a different platform (since engine implementation is platform dependent).
|
||||
* Signigicantly lower storage space usage. Restoring the engine state would easy in implementation
|
||||
* (potentially a bit more expensive in execution time: discard() function).
|
||||
*/
|
||||
|
||||
MPI_Info info;
|
||||
@@ -452,15 +457,15 @@ void Hdf5Writer::writeRNG(const std::string& data, std::string path_base) {
|
||||
|
||||
size_t stateStringSize = out.size();
|
||||
|
||||
if(stateStringSize > stateStringSizeMax_) {
|
||||
ERROR("Max Size (" + std::to_string(stateStringSizeMax_) + ") too small. String size: " + std::to_string(stateStringSize));
|
||||
if(stateStringSize > SimConstants::engine_string_length_max) {
|
||||
ERROR("Max Size (" + std::to_string(SimConstants::engine_string_length_max) + ") too small. String size: " + std::to_string(stateStringSize));
|
||||
}
|
||||
|
||||
out.insert(out.end(), (stateStringSizeMax_ - stateStringSize), '0');
|
||||
out.insert(out.end(), (SimConstants::engine_string_length_max - stateStringSize), '0');
|
||||
|
||||
// apperently it's not possible to use 'H5T_VARIABLE' with the MPI-I/O file driver
|
||||
// (since it doesn't allow for variable size objects to be created, see: https://davis.lbl.gov/Manuals/HDF5-1.8.7/TechNotes/VLTypes.html)
|
||||
hid_t dtype = H5Tcreate(H5T_STRING, stateStringSizeMax_);
|
||||
hid_t dtype = H5Tcreate(H5T_STRING, SimConstants::engine_string_length_max);
|
||||
|
||||
// store old error stack info
|
||||
H5E_auto2_t oldfunc;
|
||||
@@ -510,6 +515,11 @@ void Hdf5Writer::writeRNG(const std::string& data, std::string path_base) {
|
||||
H5Pclose(fapl);
|
||||
}
|
||||
|
||||
// Debug utility
|
||||
std::string Hdf5Writer::AbsoluteFileName() const {
|
||||
return absolute_filename_;
|
||||
}
|
||||
|
||||
// testing function for the parallel output
|
||||
|
||||
// void Hdf5Writer::writeRNG(std::string path_base) {
|
||||
|
||||
Reference in New Issue
Block a user