ug4
checkpoint_util.lua File Reference

This provides restart/checkpointing functions. More...

Functions

function util CheckCheckpointData (cp)
 
function util GetStdCheckpointData ()
 
function util nilstr (s)
 
function util ReadCheckpointFromDir (u, dir, name, verbose)
 
function util ReadStateCheckpoint (gf_names, id, name)
 
function util WriteCheckpoint (u, id, myData, name, verbose)
 
function util WriteCheckpointIntervallic (u, id, myData, name, IntervalMS)
 
function util WriteStateCheckpoint (gf_names, id, myData, name)
 

Variables

location __pad0__
 
location name
 
location verbose
 

Detailed Description

This provides restart/checkpointing functions.

Author
Martin Rupp

example writing a checkpoint (std is every 10s) util.WriteCheckpointIntervallic(u, time, {time=time, step=step})

example reading a checkpoint local restart = util.HasParamOption("-restart") if restart then cp = util.ReadCheckpoint(u)

– re-get our additional data time = cp.myData.time step = cp.myData.step end

Note: The used SaveToFile/ReadFromFile functions for u assume that u has exactly the same structure as in the checkpoint. That means approxSpace, grid and so on have to be the same This will normally exclude adaptive calculations from restarting, unless you add code which also reads/writes the adapted grid. See also util.GetStdCheckpointData for variables which are automatically checked to be the same between runs.

Function Documentation

◆ CheckCheckpointData()

function util CheckCheckpointData ( cp  )

check that the stdData is same in file and current run

See also
util.GetStdCheckpointData

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :88-114

References dim, pcl::NumProcs(), and numRefs.

◆ GetStdCheckpointData()

function util GetStdCheckpointData ( )

the standard checkpoint data data in this table will be checked between loaded checkpoints and the current run. e.g. numRefs and numCores should be the same note that values which are nil are NOT saved in the table so it is OK to add values here which are not defined in every script

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :72-79

function util.GetStdCheckpointData()
return {
numPreRefs=numPreRefs,
numCores=NumProcs()
}
end
parameterNumber numRefs
int NumProcs()
returns the number of processes
Definition: pcl_base.cpp:91
static const int dim

◆ nilstr()

function util nilstr ( s  )

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :81-83

function util.nilstr(s)
if s == nil then return "(nil)" else return s end
end
parameterString s

◆ ReadCheckpointFromDir()

function util ReadCheckpointFromDir ( ,
dir  ,
name  ,
verbose   
)

util.ReadCheckpointFromDir

Parameters
uthe GridFunction to read into
dirthe GridFunction to read into
namename of Lua checkpoint file. may be nil.
Returns
the checkpoint data cp. (see util.WriteCheckpoint) myData will be saved cp.myData.
Parameters
verboseif verbose defined then print additional debug output to console

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :218-241

◆ ReadStateCheckpoint()

function util ReadStateCheckpoint ( gf_names  ,
id  ,
name   
)

util.ReadStateCheckpoint

Parameters
gf_namesa table of names of grid functions to save (e.g. {u=u, lsf=lsf})
idthe id for the current solution (e.g. the current time)
namename used when writing the checkpoint (may be nil).

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :306-339

◆ WriteCheckpoint()

function util WriteCheckpoint ( ,
id  ,
myData  ,
name  ,
verbose   
)

util.WriteCheckpoint

Parameters
ucurrent solution to write (a GridFunction)
idthe id for the current solution (like, the current time)
myDataadditional Data in Form of a table. Will be available as cp.myData when loading the checkpoint Can contain all LUA types (tables, arrays, strings, numbers etc.), but no userdata! Can also be nil.
namename to use when writing the checkpoint. may be nil.
verboseif verbose defined then print additional debug output to console

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :126-155

◆ WriteCheckpointIntervallic()

function util WriteCheckpointIntervallic ( ,
id  ,
myData  ,
name  ,
IntervalMS   
)

util.WriteCheckpointIntervallic

See also
util.WriteCheckpoint use this function to write checkpoint data in time intervals
Parameters
IntervalMSwrite checkpoint every IntervalMS milliseconds. can be null, then defaults to util.checkpoint.stdIntervalMS

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :162-172

function util.WriteCheckpointIntervallic(u, id, myData, name, IntervalMS)
local timeMS = GetClockS()*1000
if IntervalMS == nil then IntervalMS = util.checkpoint.stdIntervalMS end
if util.checkpoint.lastCheckpointTimeMS == nil
or timeMS -util.checkpoint.lastCheckpointTimeMS > IntervalMS then
util.WriteCheckpoint(u, id, myData, name)
util.checkpoint.lastCheckpointTimeMS = timeMS
end
end
location name
Definition: checkpoint_util.lua:128
double GetClockS()
Definition: misc_bridge.cpp:438
int local(bglp_vertex_descriptor p)
Definition: parallel_matrix.h:57

◆ WriteStateCheckpoint()

function util WriteStateCheckpoint ( gf_names  ,
id  ,
myData  ,
name   
)

util.WriteStateCheckpoint

Parameters
gf_namesa table of names of grid functions to save (e.g. {u=u, lsf=lsf})
idthe id for the current solution (e.g. the current time)
myDataadditional Data in Form of a table. Will be available as cp.myData when loading the checkpoint Can contain all LUA types (tables, arrays, strings, numbers etc.), but no userdata! Can also be nil.
namename to use when writing the checkpoint (may be nil).

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / checkpoint_util.lua :252-299

Variable Documentation

◆ __pad0__

location __pad0__

util.ReadCheckpoint

Parameters
uthe GridFunction to read into
namename to use when writing the checkpoint. may be nil.
Returns
the checkpoint data cp. (see util.WriteCheckpoint) myData will be saved cp.myData.
Parameters
verboseif verbose defined then print additional debug output to console

/** LoadTheCheckpoint is a function defined in the the lua binding:

See also
ugcore/ugbase/bindings/lua/lua_serialization.cpp

◆ name

location name

Referenced by ug::IApproximationSpace::add(), ug::GridWriterUGX::add_attachment(), ug::GlobalAttachments::add_data_serializer(), ug::GridWriterUGX::add_grid(), ug::ProcessHierarchy::add_partition_hint(), ug::GridWriterUGX::add_projection_handler(), ug::GridWriterUGX::add_selector(), ug::LUAParserClass::add_subfunction(), ug::GridWriterUGX::add_subset_handler(), ug::GridWriterVTU::add_subset_handler(), ug::AddGlobalAttachmentsToSerializer(), ug::IDomain< TGrid, TSubsetHandler >::additional_subset_handler(), ug::bridge::AlgebraCommon::Functionality::Algebra(), ug::bridge::Eigensolver::Functionality::Algebra(), ug::bridge::Preconditioner::Functionality::Algebra(), ug::bridge::Ordering::Functionality::Algebra(), ug::bridge::Schur::Functionality::Algebra(), ug::bridge::Solver::Functionality::Algebra(), ug::bridge::DomainDisc::Functionality::Algebra(), ug::bridge::DiscAlgebra::Functionality::Algebra(), ug::LocalSchurComplement< TAlgebra >::apply(), ug::NestedIterationSolver< TDomain, TAlgebra >::apply(), ug::NLGaussSeidelSolver< TDomain, TAlgebra >::apply(), ug::NLJacobiSolver< TAlgebra >::apply(), ug::Archivar< TArchive, TBase, TPairSeq >::archive(), ug::GlobalAttachments::attach(), ug::AttachAct(), ug::GlobalAttachments::attachment(), ug::GlobalAttachments::attachment_entry(), ug::GlobalAttachments::attachment_pass_on_behaviour(), ug::AttachProperty(), ug::vrl::BasicTest::BasicTest(), ug::detail::archivar::CallArchiveOnDerivedClass(), ug::LuaUserData< TData, dim, TRet >::check_callback_returns(), ug::CheckLuaCallbackName(), ug::Factory< TBase, TPairSeq >::class_name(), ug::vrl::classes2NativeClasses(), ug::vrl::classGroups2NativeClassGroups(), ug::bridge::Registry::classname_registered(), ug::bridge::ClassNameTreeContains(), ug::bridge::ClassNameTreeWay(), ug::bridge::ClassNameVecContains(), ug::bridge::GridFunction::Functionality::Common(), ug::bridge::LoadBalancing::Functionality::Common(), ug::bridge::DiscAlgebra::Functionality::Common(), ug::ConsistencyCheck(), ug::CPPString(), ug::LuaUserDataFactory< TData, dim, TRet >::create(), ug::IDomain< TGrid, TSubsetHandler >::create_additional_subset_handler(), pcl::ParallelArchive::create_BinaryBuffer_file(), pcl::ParallelArchive::create_BinaryStream_file(), ug::GridWriterUGX::create_selector_element_node(), pcl::ParallelArchive::create_stringstream_file(), ug::GridWriterUGX::create_subset_element_node(), ug::LUAParserClass::createJITSG(), ug::LUAParserClass::createVM(), ug::vrl::PrintUserData2d< TData >::dataname(), ug::vrl::PrintCondUserData2d< TData >::dataname(), ug::GlobalAttachments::declare_attachment(), ug::IDomain< TGrid, TSubsetHandler >::deserialize_projector(), ug::DeserializeProjector(), ug::bridge::LuaUserData::Functionality::Dimension(), ug::bridge::Output::Functionality::Dimension(), ug::bridge::UserDataBridge::Functionality::Dimension(), ug::bridge::AdaptiveTools::Functionality::Domain(), ug::bridge::DomainDisc::Functionality::Domain(), ug::bridge::ElemDiscs::Functionality::Domain(), ug::bridge::GridFunction::Functionality::Domain(), ug::bridge::UserDataBridge::Functionality::Domain(), ug::bridge::Domain::Functionality::Domain(), ug::bridge::LoadBalancing::Functionality::Domain(), ug::bridge::domain_ray_tracing::Functionality::Domain(), ug::bridge::CLI_Functionality::DomainAlgebra(), ug::bridge::Obstacle::Functionality::DomainAlgebra(), ug::bridge::Constraints::Functionality::DomainAlgebra(), ug::bridge::Preconditioner::Functionality::DomainAlgebra(), ug::bridge::DomainDisc::Functionality::DomainAlgebra(), ug::bridge::Evaluate::Functionality::DomainAlgebra(), ug::bridge::GridFunction::Functionality::DomainAlgebra(), ug::bridge::MultiGrid::Functionality::DomainAlgebra(), ug::bridge::Ordering::Functionality::DomainAlgebra(), ug::bridge::Output::Functionality::DomainAlgebra(), ug::bridge::DiscAlgebra::Functionality::DomainAlgebra(), ug::bridge::FiniteVolume::Functionality::DomainFVGeom(), ug::GridWriterVTU::end_cell_data(), ug::LuaUserData< TData, dim, TRet >::evaluate(), ug::ExportGridToSWC(), ug::CompositeConvCheck< TVector, TDomain >::extract_dof_indices(), ug::FileTypeIs(), ug::bridge::ClassHierarchy::find_class(), ug::vrl::function2NativeFunction(), ug::GlobalAttachments::function_entry(), ug::bridge::Registry::functionname_registered(), ug::MultipleErrEstData< TDomain, TErrEstData >::get(), ug::bridge::Registry::get_class(), ug::bridge::Registry::get_class_(), ug::bridge::Registry::get_class_group(), ug::bridge::Registry::get_exported_function_group(), ug::LUAParserClass::get_id_for_name(), ug::LoaderObj::get_material_index_by_name(), ug::SubsetInfo::get_property(), ug::ISubsetHandler::get_subset_index(), ug::bridge::lua::GetBestMatchingMember(), ug::bridge::GetClassNames(), ug::bridge::lua::GetColonWarning(), ug::vrl::getInstanceBySmartPtr(), ug::bridge::GetLuaNamespace(), ug::bridge::GetMemberFunctionCompletitions(), ug::bridge::GetMemberFunctionInfo(), ug::bridge::GetNamespaceCompletitions(), ug::ConnectionViewer::GetParallelName(), ug::GetQuadratureType(), getSourceAndLine(), ug::GridReaderUGX::grid(), ug::GridFunctionOrdering< TDomain, TAlgebra >::GridFunctionOrdering(), ug::vrl::VRLUserLinker< TData, dim, TDataIn >::group_name(), ug::vrl::VRLUserData< TData, dim >::group_name(), ug::vrl::VRLCondUserNumber< dim >::group_name(), ug::bridge::Registry::groupname_registered(), ug::bridge::ClassNameProvider< TClass >::is_a(), ug::GlobalAttachments::is_attached(), ug::GlobalAttachments::is_declared(), ug::IsValidRegistryIdentifier(), Java_edu_gcsc_vrl_ug_UG__1getExportedClassPtrByName(), Java_edu_gcsc_vrl_ug_UG__1invokeFunction(), Java_edu_gcsc_vrl_ug_UG__1invokeMethod(), Java_edu_gcsc_vrl_ug_UG__1newInstance(), ug::vrl::jPointerGetName(), ug::JuliaString(), ListUserDataInTable(), ug::FileReaderASC::load_file(), ug::Raster< T, TDIM >::load_from_asc(), ug::LoadGridFromGRDECL(), ug::LoadHeightfieldFromASC(), ug::AssembledMultiGridCycle< TDomain, TAlgebra >::log_debug_data(), ug::bridge::LuaGetBoolean(), ug::bridge::LuaGetNumber(), ug::bridge::LuaGetString(), ug::bridge::LuaPrintTable(), ug::MakeTmpFile(), ug::DenseMatrix< TStorage >::maple_print(), ug::DenseVector< TStorage >::maple_print(), ug::MaplePrint(), ug::MatlabString(), ug::vrl::method2NativeMethod(), ug::LuaUserData< TData, dim, TRet >::name(), ug::vrl::VRLUserLinker< TData, dim, TDataIn >::name(), ug::vrl::VRLUserData< TData, dim >::name(), ug::vrl::VRLCondUserNumber< dim >::name(), ug::vrl::PrintUserData2d< TData >::name(), ug::vrl::PrintCondUserData2d< TData >::name(), ug::ConstrainedLinearIterator< TDomain, TAlgebra, TLinIt, typename >::name(), ug::NonzeroString(), ug::bridge::ClassHierarchy::operator<(), ug::ProcessHierarchy::partition_hint(), ug::PluginLoaded(), ug::VTKOutput< TDim >::print(), ug::VTKOutput< TDim >::print_subset(), ug::VTKOutput< TDim >::print_subsets(), ug::PrintDoFCount(), ug::PrintGlobalLayout(), ug::PrintMaple(), ug::PrintMatrix(), PrintProfile_TotalTime(), ug::GridWriterUGX::process_global_attachments(), ug::LuaUserDataFactory< TData, dim, TRet >::provide_or_create(), ug::GridReaderUGX::read_attachment(), ug::GlobalAttachments::read_attachment_values(), ug::Archivar< TArchive, TBase, TPairSeq >::register_class(), ug::Factory< TBase, TPairSeq >::register_class(), ug::bridge::Preconditioner::Functionality::RegisterBlockGaussSeidel(), ug::bridge::Preconditioner::Functionality::RegisterBlockGaussSeidelIterative(), ug::bridge::RegisterBridge_DiscCommon(), ug::bridge::RegisterBridge_Profiler(), ug::bridge::RegisterBridge_Util(), ug::bridge::LoadBalancing::RegisterClusterElementStacks(), ug::bridge::RegisterDegeneratedLayerManager(), ug::bridge::LoadBalancing::RegisterDynamicBisectionPartitioner(), ug::bridge::RegisterGeometry(), ug::bridge::RegisterGridBridge_Refinement(), ug::bridge::LuaUserData::RegisterLuaUserDataType(), ug::bridge::RegisterRaster(), ug::bridge::RegisterRasterUserData(), ug::bridge::LoadBalancing::RegisterSmoothPartitionBounds(), ug::vrl::RegisterUserData(), ug::vrl::RegisterUserDataType(), ug::bridge::RegisterUserDataTypeA(), ug::bridge::RegisterUserDataTypeB(), ug::LuaUserDataFactory< TData, dim, TRet >::remove(), ug::VTKOutput< TDim >::select(), ug::VTKOutput< TDim >::select_element(), ug::VTKOutput< TDim >::select_nodal(), ug::CompositeConvCheck< TVector, TDomain >::set_all_component_check(), ug::DebugIDManager::set_debug_level(), ug::TarHeader::set_filename(), ug::bridge::ClassNameProvider< TClass >::set_foreward_declared(), ug::CompositeConvCheck< TVector, TDomain >::set_group_check(), ug::bridge::ClassGroupDesc::set_name(), ug::bridge::ClassNameProvider< TClass >::set_name(), ug::VMAdd::set_name(), ug::AlgebraicConvCheck< TVector >::set_name(), ug::StdConvCheck< TVector >::set_name(), ug::CompositeConvCheck< TVector, TDomain >::set_name(), ug::UserDataInfo::set_obj_name(), ug::SubsetInfo::set_property(), ug::ISubsetHandler::set_subset_name(), ug::BinghamViscosityLinker< dim >::set_velocity_gradient(), ug::script::SetLuaDebug(), ug::bridge::SetLuaNamespace(), ug::bridge::SetLuaNamespaceInTable(), ug::vrl::BasicTest::setName(), shiny_backtrace(), ug::vrl::SmartPtrCls::SmartPtrCls(), ug::SortedGridFunctionOrdering< TDomain, TAlgebra >::SortedGridFunctionOrdering(), ug::SubsetInfo::SubsetInfo(), ug::GlobalAttachments::type_name(), ug::TypeName(), ug::script::UGAlgebraCompiled(), ug::script::UGGetMetatable(), ug::GlobalAttachments::undeclare_attachment(), ug::CompositeConvCheck< TVector, TDomain >::update_rest_check(), ug::VTKOutput< TDim >::vtk_name_used(), ug::OverlapWriter< TAlgebra >::write(), ug::GridFunctionDebugWriter< TDomain, TAlgebra >::write_algebra_indices_CV(), ug::GlobalAttachments::write_attachment_values(), ug::VTKOutput< TDim >::write_cell_data(), ug::VTKOutput< TDim >::write_cell_values(), ug::GridWriterVTU::write_data_array_header(), ug::DebugWritingObject< TAlgebra >::write_debug(), ug::StdTransfer< TDomain, TAlgebra >::write_debug(), ug::NLGaussSeidelSolver< TDomain, TAlgebra >::write_debug(), ug::NLJacobiSolver< TAlgebra >::write_debug(), ug::NewtonSolver< TAlgebra >::write_debug(), ug::VectorDebugWritingObject< TVector >::write_debug(), ug::AssembledMultiGridCycle< TDomain, TAlgebra >::write_debug(), ug::OverlapWriter< TAlgebra >::write_dim_(), ug::GridFunctionDebugWriter< TDomain, TAlgebra >::write_matrix(), ug::AlgebraDebugWriter< TAlgebra >::write_matrix_dim(), ug::VTKOutput< TDim >::write_nodal_data(), ug::VTKOutput< TDim >::write_nodal_values(), ug::VTKOutput< TDim >::write_pvtu(), ug::VTKOutput< TDim >::write_subset_pvd(), ug::VTKOutput< TDim >::write_time_processwise_pvd(), ug::VTKOutput< TDim >::write_time_pvd(), ug::VTKOutput< TDim >::write_time_pvd_subset(), ug::AlgebraDebugWriter< TAlgebra >::write_vector_dim(), ug::GridFunctionDebugWriter< TDomain, TAlgebra >::write_vector_to_conn_viewer(), ug::GridFunctionDebugWriter< TDomain, TAlgebra >::write_vector_to_vtk(), ug::WriteAlgebraIndices(), ug::bridge::WriteLUAObject(), ug::bridge::WriteLUAObject2(), ug::ConnectionViewer::WriteMatrixPar(), pcl::WriteParallelArchive(), and ug::WriteVectorCSV().

◆ verbose