| 1972 | } |
| 1973 | |
| 1974 | bool model::load_from_checkpoint_shared(persist& p) |
| 1975 | { |
| 1976 | const std::string trainer_dir = p.get_checkpoint_dir(); |
| 1977 | p.open_restart(file::join_path(trainer_dir, get_name())); |
| 1978 | // Assume checkpoint reload from epoch end not step end |
| 1979 | |
| 1980 | std::ifstream ifs; |
| 1981 | if (m_comm->am_trainer_master()) { |
| 1982 | ifs.open(file::join_path(p.get_checkpoint_dir(), "model.bin")); |
| 1983 | LBANN_ASSERT(ifs.good()); |
| 1984 | } |
| 1985 | |
| 1986 | // Restore the checkpoint |
| 1987 | { |
| 1988 | lbann::RootedBinaryInputArchive ar(ifs, m_comm->get_trainer_grid()); |
| 1989 | ar(*this); |
| 1990 | } |
| 1991 | |
| 1992 | m_model_is_setup = false; |
| 1993 | p.set_restart_dir(trainer_dir); |
| 1994 | #ifdef LBANN_HAS_GPU |
| 1995 | hydrogen::gpu::SynchronizeDevice(); |
| 1996 | #endif // LBANN_HAS_GPU |
| 1997 | return true; |
| 1998 | } |
| 1999 | |
| 2000 | bool model::save_to_checkpoint_distributed(persist& p) |
| 2001 | { |
no test coverage detected