Created
November 22, 2021 22:53
-
-
Save houjun/f46de9cea2c1b955d187dbc06df94a83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Src/Extern/HDF5/AMReX_PlotFileUtilHDF5.cpp b/Src/Extern/HDF5/AMReX_PlotFileUtilHDF5.cpp | |
index 7573b195c..90af31464 100644 | |
--- a/Src/Extern/HDF5/AMReX_PlotFileUtilHDF5.cpp | |
+++ b/Src/Extern/HDF5/AMReX_PlotFileUtilHDF5.cpp | |
@@ -588,7 +588,7 @@ void WriteMultiLevelPlotfileHDF5SingleDset (const std::string& plotfilename, | |
#endif | |
if(centerdataset < 0) { std::cout << "Create center dataset failed! ret = " << centerdataset << std::endl; break;} | |
- Vector<unsigned long long> offsets(sortedGrids.size() + 1); | |
+ Vector<unsigned long long> offsets(sortedGrids.size() + 1, 0); | |
unsigned long long currentOffset(0L); | |
for(int b(0); b < sortedGrids.size(); ++b) { | |
offsets[b] = currentOffset; | |
@@ -596,21 +596,23 @@ void WriteMultiLevelPlotfileHDF5SingleDset (const std::string& plotfilename, | |
} | |
offsets[sortedGrids.size()] = currentOffset; | |
- Vector<unsigned long long> procOffsets(nProcs); | |
- int posCount(0); | |
- Vector<unsigned long long> procBufferSize(nProcs); | |
+ Vector<unsigned long long> procOffsets(nProcs, 0); | |
+ Vector<unsigned long long> procBufferSize(nProcs, 0); | |
unsigned long long totalOffset(0); | |
for(auto it = gridMap.begin(); it != gridMap.end(); ++it) { | |
int proc = it->first; | |
Vector<Box> &boxesAtProc = it->second; | |
- /* BL_ASSERT(posCount == proc); */ | |
- procOffsets[posCount] = totalOffset; | |
- ++posCount; | |
+ procOffsets[proc] = totalOffset; | |
procBufferSize[proc] = 0L; | |
for(int b(0); b < boxesAtProc.size(); ++b) { | |
procBufferSize[proc] += boxesAtProc[b].numPts() * ncomp; | |
} | |
totalOffset += procBufferSize[proc]; | |
+ | |
+ /* if (level == 2) { */ | |
+ /* fprintf(stderr, "Rank %d: level %d, proc %d, offset %ld, size %ld, all size %ld\n", */ | |
+ /* myProc, level, proc, procOffsets[proc], procBufferSize[proc], totalOffset); */ | |
+ /* } */ | |
} | |
if(ParallelDescriptor::IOProcessor()) { | |
@@ -658,7 +660,12 @@ void WriteMultiLevelPlotfileHDF5SingleDset (const std::string& plotfilename, | |
hid_t dataspace = H5Screate_simple(1, hs_allprocsize, NULL); | |
hid_t memdataspace = H5Screate_simple(1, hs_procsize, NULL); | |
- H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, ch_offset, NULL, hs_procsize, NULL); | |
+ /* fprintf(stderr, "Rank %d: level %d, offset %ld, size %ld, all size %ld\n", myProc, level, ch_offset[0], hs_procsize[0], hs_allprocsize[0]); */ | |
+ | |
+ if (hs_procsize[0] == 0) | |
+ H5Sselect_none(dataspace); | |
+ else | |
+ H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, ch_offset, NULL, hs_procsize, NULL); | |
Vector<Real> a_buffer(procBufferSize[myProc], -1.0); | |
const MultiFab* data; | |
@@ -1019,15 +1026,12 @@ void WriteMultiLevelPlotfileHDF5MultiDset (const std::string& plotfilename, | |
offsets[sortedGrids.size()] = currentOffset; | |
Vector<unsigned long long> procOffsets(nProcs); | |
- int posCount(0); | |
Vector<unsigned long long> procBufferSize(nProcs); | |
unsigned long long totalOffset(0); | |
for(auto it = gridMap.begin(); it != gridMap.end(); ++it) { | |
int proc = it->first; | |
Vector<Box> &boxesAtProc = it->second; | |
- /* BL_ASSERT(posCount == proc); */ | |
- procOffsets[posCount] = totalOffset; | |
- ++posCount; | |
+ procOffsets[proc] = totalOffset; | |
procBufferSize[proc] = 0L; | |
for(int b(0); b < boxesAtProc.size(); ++b) { | |
/* procBufferSize[proc] += boxesAtProc[b].numPts() * ncomp; */ | |
@@ -1081,7 +1085,10 @@ void WriteMultiLevelPlotfileHDF5MultiDset (const std::string& plotfilename, | |
hid_t dataspace = H5Screate_simple(1, hs_allprocsize, NULL); | |
hid_t memdataspace = H5Screate_simple(1, hs_procsize, NULL); | |
- H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, ch_offset, NULL, hs_procsize, NULL); | |
+ if (hs_procsize[0] == 0) | |
+ H5Sselect_none(dataspace); | |
+ else | |
+ H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, ch_offset, NULL, hs_procsize, NULL); | |
Vector<Real> a_buffer(procBufferSize[myProc]*ncomp, -1.0); | |
Vector<Real> a_buffer_ind(procBufferSize[myProc], -1.0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment