Esempio n. 1
0
ErrorStack NumaNodeMemory::uninitialize_once() {
  LOG(INFO) << "Uninitializing NumaNodeMemory for node " << static_cast<int>(numa_node_) << "."
    << " BEFORE: numa_node_size=" << get_numa_node_size(numa_node_);

  ErrorStackBatch batch;
  batch.uninitialize_and_delete_all(&core_memories_);
  volatile_offset_chunk_memory_pieces_.clear();
  volatile_offset_chunk_memory_.release_block();
  snapshot_offset_chunk_memory_pieces_.clear();
  snapshot_offset_chunk_memory_.release_block();
  log_buffer_memory_pieces_.clear();
  log_buffer_memory_.release_block();
  if (snapshot_cache_table_) {
    delete snapshot_cache_table_;
    snapshot_cache_table_ = nullptr;
  }
  batch.emprace_back(volatile_pool_.uninitialize());
  batch.emprace_back(snapshot_pool_.uninitialize());
  snapshot_pool_memory_.release_block();
  snapshot_pool_control_block_.release_block();

  LOG(INFO) << "Uninitialized NumaNodeMemory for node " << static_cast<int>(numa_node_) << "."
    << " AFTER: numa_node_size=" << get_numa_node_size(numa_node_);
  return SUMMARIZE_ERROR_BATCH(batch);
}
Esempio n. 2
0
ErrorStack EnginePimpl::uninitialize_once() {
  LOG(INFO) << "================================================================================";
  LOG(INFO) << "=================== FOEDUS ENGINE ("
    << describe_short() << ") EXITTING...... ================";
  LOG(INFO) << "================================================================================";
  if (is_master() && soc_manager_.is_initialized()) {
    soc_manager_.get_shared_memory_repo()->change_master_status(
      soc::MasterEngineStatus::kWaitingForChildTerminate);
  }
  ErrorStackBatch batch;
  // uninit in reverse order of initialization
  auto modules = get_modules();
  std::reverse(modules.begin(), modules.end());
  for (ModulePtr& module : modules) {
    if (!module.ptr_->is_initialized()) {
      continue;
    }
    // During uninitialization, master waits for SOCs' uninitialization before its uninit.
    if (is_master()) {
      batch.emprace_back(soc_manager_.wait_for_children_module(false, module.type_));
    }
    batch.emprace_back(module.ptr_->uninitialize());
    on_module_uninitialized(module.type_);
    // Then SOCs wait for master before moving on to next module.
    if (!is_master()) {
      batch.emprace_back(soc_manager_.wait_for_master_module(false, module.type_));
    }
  }

  // SOC manager is special. We must uninitialize it at last.
  batch.emprace_back(soc_manager_.uninitialize());
  // after that, we can't even set status. shared memory has been detached.
  return SUMMARIZE_ERROR_BATCH(batch);
}
Esempio n. 3
0
ErrorStack EngineMemory::uninitialize_once() {
  LOG(INFO) << "Uninitializing EngineMemory..";
  ErrorStackBatch batch;
  if (!engine_->get_debug()->is_initialized()) {
    batch.emprace_back(ERROR_STACK(kErrorCodeDepedentModuleUnavailableUninit));
  }
  for (auto* ref : node_memories_) {
    delete ref;
  }
  node_memories_.clear();

  // Uninitialize local memory.
  if (!engine_->is_master() && local_memory_) {
    soc::SocId node = engine_->get_soc_id();
    batch.emprace_back(local_memory_->uninitialize());
    delete local_memory_;
    local_memory_ = nullptr;
    LOG(INFO) << "Node memory-" << node << " was uninitialized!";
  }
  return SUMMARIZE_ERROR_BATCH(batch);
}