Commit 908863cd authored by Michael Bareford's avatar Michael Bareford

Fixed bug such that size of allFirstDataDecomps is set from within CreateDataSets.

parent 0329a32f
...@@ -196,7 +196,7 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename, ...@@ -196,7 +196,7 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename,
homoYIDs(nFields), homoZIDs(nFields); homoYIDs(nFields), homoZIDs(nFields);
std::vector<std::vector<unsigned int> > numModesPerDirVar(nFields); std::vector<std::vector<unsigned int> > numModesPerDirVar(nFields);
std::vector<std::string> numModesPerDirUni(nFields); std::vector<std::string> numModesPerDirUni(nFields);
int homDim = -1; int homDim = -1;
int varOrder = 0; int varOrder = 0;
for (std::size_t f = 0; f < nFields; ++f) for (std::size_t f = 0; f < nFields; ++f)
...@@ -385,7 +385,7 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename, ...@@ -385,7 +385,7 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename,
std::vector<int> sizeMap2, offsetMap2; std::vector<int> sizeMap2, offsetMap2;
std::vector<int> vnFields(1, nFields); std::vector<int> vnFields(1, nFields);
std::vector<int> allnFields = m_comm->Gather(rkFormatter, vnFields); std::vector<int> allnFields = m_comm->Gather(rkFormatter, vnFields);
if (rkFormatter == rk) if (rkFormatter == rk)
{ {
sizeMap.resize(nranks, 0); sizeMap.resize(nranks, 0);
...@@ -417,13 +417,12 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename, ...@@ -417,13 +417,12 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename,
} }
std::vector<uint64_t> allFieldCounts = m_comm->Gatherv(rkFormatter, fieldCounts, sizeMap2, offsetMap2); std::vector<uint64_t> allFieldCounts = m_comm->Gatherv(rkFormatter, fieldCounts, sizeMap2, offsetMap2);
std::vector<uint64_t> allFirstDataDecomps; std::vector<uint64_t> allFirstDataDecomps;
if (rkFormatter == rk) if (rkFormatter == rk)
{ {
std::vector<uint64_t> allDataDecomps(DATA_DECOMP_SIZE*nTotFields); std::vector<uint64_t> allDataDecomps(DATA_DECOMP_SIZE*nTotFields);
allFirstDataDecomps.resize(DATA_DECOMP_SIZE*nranks);
nWritten += CreateDataSets(outFilename, rkFormatter, nTotFields, nWritten += CreateDataSets(outFilename, rkFormatter, nTotFields,
allFieldHashes, allFieldCounts, allFieldDecomps, allFieldHashes, allFieldCounts, allFieldDecomps,
allFirstDataDecomps, allDataDecomps, allFirstDataDecomps, allDataDecomps,
...@@ -460,13 +459,13 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename, ...@@ -460,13 +459,13 @@ uint64_t FieldIOHdf5::v_Write(const std::string &outFilename,
// Scatter those field hashes that indicate which the field definitions that each process writes to file. // Scatter those field hashes that indicate which the field definitions that each process writes to file.
std::vector<uint64_t> writeFieldHashes = m_comm->Scatterv(rkFormatter, allFieldHashes, sizeMap, offsetMap, nFields); std::vector<uint64_t> writeFieldHashes = m_comm->Scatterv(rkFormatter, allFieldHashes, sizeMap, offsetMap, nFields);
// Write field definitions to checkpoint file. // Write field definitions to checkpoint file.
nWritten += WriteFieldAttributes(outFilename, nFields, varOrder, writeFieldHashes, fieldDefs, nWritten += WriteFieldAttributes(outFilename, nFields, varOrder, writeFieldHashes, fieldDefs,
fieldNames, shapeStrings, homoLengths, numModesPerDirUni); fieldNames, shapeStrings, homoLengths, numModesPerDirUni);
firstDataDecomps = m_comm->Scatter(rkFormatter, allFirstDataDecomps, DATA_DECOMP_SIZE); firstDataDecomps = m_comm->Scatter(rkFormatter, allFirstDataDecomps, DATA_DECOMP_SIZE);
} // end of <if (reformatting)> clause } // end of <if (reformatting)> clause
nWritten = WriteData(outFilename, nFields, totalFieldCounts, nWritten = WriteData(outFilename, nFields, totalFieldCounts,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment