aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOHDF5/src
diff options
context:
space:
mode:
authorknarf <knarf@cct.lsu.edu>2012-01-31 21:28:52 -0600
committerBarry Wardell <barry.wardell@gmail.com>2012-09-11 18:17:54 +0100
commit5a9e7f1d1d30045c228ea4040e76def6d14749c3 (patch)
tree48db31c26ab84fb6cbfd41d967149032b90ea9de /Carpet/CarpetIOHDF5/src
parentdc693734ea0a2b1f81aa4f8bfd59f89f22e7d599 (diff)
parent97e44e585ea966068eefb7e2e48cefad171d0d19 (diff)
merge
Diffstat (limited to 'Carpet/CarpetIOHDF5/src')
-rw-r--r--Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc31
-rw-r--r--Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh10
-rw-r--r--Carpet/CarpetIOHDF5/src/Output.cc5
-rw-r--r--Carpet/CarpetIOHDF5/src/OutputSlice.cc31
-rw-r--r--Carpet/CarpetIOHDF5/src/make.configuration.deps2
5 files changed, 71 insertions, 8 deletions
diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
index 12c9a68ea..c3053c332 100644
--- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
+++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
@@ -229,6 +229,28 @@ void CarpetIOHDF5_TerminationCheckpoint (CCTK_ARGUMENTS)
}
+CCTK_INT CarpetIOHDF5_SetCheckpointGroups (CCTK_INT const * const groups,
+ CCTK_INT const ngroups)
+{
+ if (ngroups == -1) {
+ // Checkpoint all groups
+ groups_to_checkpoint.clear();
+ } else {
+ assert (ngroups >= 0);
+ groups_to_checkpoint.resize(CCTK_NumGroups());
+ for (int n=0; n<CCTK_NumGroups(); ++n) {
+ groups_to_checkpoint.at(n) = false;
+ }
+ for (int n=0; n<ngroups; ++n) {
+ groups_to_checkpoint.at(groups[n]) = true;
+ }
+ }
+ return 0;
+}
+
+vector<bool> groups_to_checkpoint;
+
+
hid_t CCTKtoHDF5_Datatype (const cGH* const cctkGH,
int cctk_type, bool single_precision)
{
@@ -938,9 +960,16 @@ static void Checkpoint (const cGH* const cctkGH, int called_from)
}
for (int group = CCTK_NumGroups () - 1; group >= 0; group--) {
+ /* skip variables which have been disabled for checkpointing */
+ if (not groups_to_checkpoint.empty() and
+ not groups_to_checkpoint.at(group))
+ {
+ continue;
+ }
/* only dump groups which have storage assigned */
if (CCTK_QueryGroupStorageI (cctkGH, group) <= 0 or
- CCTK_NumVarsInGroupI(group) == 0) {
+ CCTK_NumVarsInGroupI(group) == 0)
+ {
continue;
}
diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh
index dfa6a276e..3cff7bf3b 100644
--- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh
+++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh
@@ -247,7 +247,8 @@ namespace CarpetIOHDF5
}; // struct IOHDF5
- // scheduled routines (must be declared as C according to schedule.ccl)
+ // scheduled and aliased routines (must be declared as C according
+ // to schedule.ccl)
extern "C" {
int CarpetIOHDF5_RecoverParameters (void);
@@ -261,8 +262,15 @@ namespace CarpetIOHDF5
void CarpetIOHDF5_EvolutionCheckpoint (CCTK_ARGUMENTS);
void CarpetIOHDF5_TerminationCheckpoint (CCTK_ARGUMENTS);
+ CCTK_INT CarpetIOHDF5_SetCheckpointGroups (CCTK_INT const *groups,
+ CCTK_INT ngroups);
+
} // extern "C"
+ // Which groups should be checkpointed. If empty, all variables
+ // should be checkpointed (default).
+ extern vector<bool> groups_to_checkpoint;
+
} // namespace CarpetIOHDF5
#endif // !defined(CARPETIOHDF5_HH)
diff --git a/Carpet/CarpetIOHDF5/src/Output.cc b/Carpet/CarpetIOHDF5/src/Output.cc
index 1b5bf8eec..d77324860 100644
--- a/Carpet/CarpetIOHDF5/src/Output.cc
+++ b/Carpet/CarpetIOHDF5/src/Output.cc
@@ -203,7 +203,8 @@ int WriteVarUnchunked (const cGH* const cctkGH,
processor_component->allocate (overlap, 0);
for (comm_state state; not state.done(); state.step()) {
int const p = hh->processor(refinementlevel,component);
- processor_component->copy_from (state, data, overlap, 0, p);
+ processor_component->copy_from
+ (state, data, overlap, overlap, NULL, 0, p);
}
// Write data
@@ -380,7 +381,7 @@ int WriteVarChunkedSequential (const cGH* const cctkGH,
processor_component->allocate (bbox, 0);
for (comm_state state; not state.done(); state.step()) {
int const p = hh->processor(refinementlevel,component);
- processor_component->copy_from (state, data, bbox, 0, p);
+ processor_component->copy_from (state, data, bbox, bbox, NULL, 0, p);
}
// Write data on I/O processor 0
diff --git a/Carpet/CarpetIOHDF5/src/OutputSlice.cc b/Carpet/CarpetIOHDF5/src/OutputSlice.cc
index 8c4c42295..f0d570ced 100644
--- a/Carpet/CarpetIOHDF5/src/OutputSlice.cc
+++ b/Carpet/CarpetIOHDF5/src/OutputSlice.cc
@@ -648,7 +648,8 @@ namespace CarpetIOHDF5 {
for (comm_state state; not state.done(); state.step()) {
for (size_t n=0; n<datas.size(); ++n) {
tmpdatas.at(n)->copy_from
- (state, datas.at(n), data_ext, ioproc, proc);
+ (state, datas.at(n), data_ext, data_ext, NULL,
+ ioproc, proc);
}
}
@@ -1420,11 +1421,23 @@ namespace CarpetIOHDF5 {
datasetname.append (datasetname_suffix.str());
// remove an already existing dataset of the same name
- if (slice_requests.at(vi + n)->check_exist) {
+ ioRequest* request = slice_requests.at(vi + n);
+ if (not request) {
+#ifdef IOUTIL_PARSER_HAS_OUT_DT
+ request = IOUtil_DefaultIORequest (cctkGH, vi + n, 1, -1.0);
+#else
+ request = IOUtil_DefaultIORequest (cctkGH, vi + n, 1);
+#endif
+ }
+ if (request->check_exist) {
H5E_BEGIN_TRY {
H5Gunlink(file, datasetname.c_str());
} H5E_END_TRY;
}
+ // free I/O request structure
+ if (request != slice_requests.at(vi + n)) {
+ IOUtil_FreeIORequest (&request);
+ }
// write the dataset
hid_t dataset;
@@ -1516,11 +1529,23 @@ namespace CarpetIOHDF5 {
datasetname.append (datasetname_suffix.str());
// remove an already existing dataset of the same name
- if (slice_requests[vi + n]->check_exist) {
+ ioRequest* request = slice_requests.at(vi + n);
+ if (not request) {
+#ifdef IOUTIL_PARSER_HAS_OUT_DT
+ request = IOUtil_DefaultIORequest (cctkGH, vi + n, 1, -1.0);
+#else
+ request = IOUtil_DefaultIORequest (cctkGH, vi + n, 1);
+#endif
+ }
+ if (request->check_exist) {
H5E_BEGIN_TRY {
H5Gunlink(file, datasetname.c_str());
} H5E_END_TRY;
}
+ // free I/O request structure
+ if (request != slice_requests.at(vi + n)) {
+ IOUtil_FreeIORequest (&request);
+ }
// write the dataset
hid_t dataset;
diff --git a/Carpet/CarpetIOHDF5/src/make.configuration.deps b/Carpet/CarpetIOHDF5/src/make.configuration.deps
index 74b2a2aa6..b118cf3b9 100644
--- a/Carpet/CarpetIOHDF5/src/make.configuration.deps
+++ b/Carpet/CarpetIOHDF5/src/make.configuration.deps
@@ -23,4 +23,4 @@ $(UTIL_DIR)/%: $(CARPETIOHDF5_BUILD_DIR)/%.o
$(CARPETIOHDF5_BUILD_DIR)/%.o: $(CARPETIOHDF5_SRC_DIR)/%.cc
@echo Compiling $<
if [ ! -d $(CARPETIOHDF5_BUILD_DIR) ]; then $(MKDIR) $(MKDIRFLAGS) $(CARPETIOHDF5_BUILD_DIR) ; fi
- $(CXX) $< $(CARPETIOHDF5_CXXFLAGS) -c -o $@
+ $(CXX) $< $(CARPETIOHDF5_CXXFLAGS) -DTHORN_IS_CarpetIOHDF5 -c -o $@