Damaris plugin - #693
Damaris plugin#693Yushan-Wang wants to merge 68 commits into
Conversation
…se or on other configs options.
…ide other plugins (trace, mpi, Decl'HDF5, etc.)
…s in the YML file!
…ch element requiring any metadata value uses depends_on YAML attribute to ensure an update of its attributes value to Damaris lib once the metadata are exposed (using Damaris Parameters in the background)!
…ding auto initialize without on_init event, and adding some cmake instruction in enforce finding of Damaris when Damaris_ROOT is provided.
The condition to do that is to always have this sequence at the end of the simulation: PDI_finalize(); MPI_Finalize(); Or provide in the yml conf the code following PDI_finalize(); Code like the following could not be handled: PDI_finalize(); PC_tree_destroy(&conf); free(cur); free(next); MPI_Finalize();
This reverts commit db29c2c.
Fix-local-install-1
* Hide is_client from user, and ending damaris server in background: - The condition to do that is to always have this sequence at the end of the simulation: PDI_finalize(); MPI_Finalize(); - Or provide in the yml conf the code following PDI_finalize(); - Code like the following could not be handled for the moment. But in the future by providing the instructions to execute...: PDI_finalize(); PC_tree_destroy(&conf); free(cur); free(next); MPI_Finalize(); * update copyright * Removing on_init and on_finalize
* Example with only Damaris API (resolves #10)
|
Some known issues of this implementation are defined in https://github.com/jmorice91/pdi/issues. |
There was a problem hiding this comment.
This file is never used. Perhaps, we should remove for a first version?
@endamlabin : What is the objective of this file?
| ctx.logger().info("Plugin loaded successfully"); | ||
| } | ||
|
|
||
| void data(const std::string& name, PDI::Ref ref) |
There was a problem hiding this comment.
missing description.
As the name of function is to general, we should change the name.
| } | ||
| } | ||
|
|
||
| void event(const std::string& event_name) |
There was a problem hiding this comment.
missing description.
As the name of function is to general, we should change the name.
| } | ||
| } | ||
|
|
||
| void ensure_damaris_is_initialized(const std::string& event_name) |
| } | ||
| } | ||
|
|
||
| void damaris_init() |
| // context().logger().error("The Damaris need write access on the data (`{}')", name); | ||
| throw PDI::System_error{"The Damaris need write access on the data `{}' ", name}; | ||
| } | ||
| } else if (m_config.is_parameter_to_update(name)) { |
There was a problem hiding this comment.
Perhaps, add a comment on this condition?
| //MayBe a PDI_multi_expose is under traitement | ||
| multi_expose_transaction_dataname.emplace_back(name); |
There was a problem hiding this comment.
Can you give us a use case of these lines with an example?
| multi_expose_transaction_dataname.emplace_back(name); | ||
| } | ||
| } else { //Handle other situations... | ||
| multi_expose_transaction_dataname.emplace_back(name); |
There was a problem hiding this comment.
Can you give us a use case of these lines with an example?
| } | ||
| } else { //Handle other situations... | ||
| multi_expose_transaction_dataname.emplace_back(name); | ||
| //multi_expose_transaction_dataref.emplace_back(ref); |
There was a problem hiding this comment.
Please, remove this line.
| if (ds_write_info.when.to_long(context())) { | ||
| context().logger().debug("data `{}' will be written when = '{}'", name, ds_write_info.when.to_long(context())); | ||
|
|
||
| int32_t block = ds_write_info.block.to_long(context()); |
There was a problem hiding this comment.
What is the block? What is the interest for a user?
jmorice91
left a comment
There was a problem hiding this comment.
General comment:
There is not test and no example with custom event name defined in specification tree.
| std::string finalize_event_name = m_event_handler.get_event_name(Event_type::DAMARIS_FINALIZE); | ||
| m_event_handler.damaris_api_call_event(context(), m_damaris, finalize_event_name, multi_expose_transaction_dataname); | ||
| } | ||
| } else if (m_event_handler.is_damaris_api_call_event(event_name)) { |
There was a problem hiding this comment.
Add a comment like the if before.
| } else if (m_event_handler.is_damaris_api_call_event(event_name)) { | |
| } | |
| // use of defined names in damaris plugin to call damaris api | |
| else if (m_event_handler.is_damaris_api_call_event(event_name)) { |
| }; | ||
|
|
||
| /** These default event names are for internal use. If a configured name is given, these ones will be surcharged */ | ||
| const std::unordered_map<Event_type, std::string> event_names |
There was a problem hiding this comment.
This variables depends on the naming of the event in the core of damaris plugin as he used in other files.
suggestion: damaris_event_names
| if (!m_damaris) { | ||
| if (m_config.events().find(event_name) != m_config.events().end()) { | ||
| //Means the first action received by the plugin wasn't fir initialization... | ||
| if (!m_config.init_on_event().empty() && event_name != m_config.init_on_event()) { |
There was a problem hiding this comment.
if the event name for init_on_event="", what is arrived?
(need to be checked)
Do you mean that in your code
m_config.init_on_event().empty() is equivalent to no init_on_event defined in the specification tree of damaris ?
Perhaps, we can add a boolean in the code to know if no init_on_event defined in the specification tree of damaris ?
| if (m_config.finalize_on_event().empty() && m_damaris) { | ||
| context().logger().debug("Calling DAMARIS_FINALIZE in ~damaris_plugin()"); | ||
| std::string finalize_event_name = m_event_handler.get_event_name(Event_type::DAMARIS_FINALIZE); | ||
| m_event_handler.damaris_api_call_event(context(), m_damaris, finalize_event_name, multi_expose_transaction_dataname); | ||
| } |
There was a problem hiding this comment.
Perhaps, we should add the "m_config.finalize_on_event() is not empty and m_damaris" in the case of the user doesn't call event to finalize in its code?
Question:
If the user doesn't call "DAMARIS_STOP" before "DAMARIS_FINALIZE", what damaris do when we call "damaris_finalize"?
|
|
||
| struct Architecture_type { | ||
| int domain; | ||
| placement arch_placement; |
There was a problem hiding this comment.
placement is never used? Perhaps, we can remove for a first version.
Question: What is the placement for damaris?
|
|
||
| /** These default event names are for internal use. If a configured name is given, these ones will be surcharged */ | ||
| const std::unordered_map<Event_type, std::string> event_names | ||
| = {{Event_type::DAMARIS_INITIALIZE, "initialize"}, |
There was a problem hiding this comment.
The event name doesn't depend on damaris.
| = {{Event_type::DAMARIS_INITIALIZE, "initialize"}, | |
| = {{Event_type::DAMARIS_INITIALIZE, "damaris_initialize"}, |
| {Event_type::DAMARIS_SIGNAL, "damaris_signal"}, | ||
| {Event_type::DAMARIS_BIND, "damaris_bind"}, | ||
| {Event_type::DAMARIS_STOP, "damaris_stop"}, | ||
| {Event_type::DAMARIS_FINALIZE, "finalize"}}; |
There was a problem hiding this comment.
The event name doesn't depend on damaris.
| {Event_type::DAMARIS_FINALIZE, "finalize"}}; | |
| {Event_type::DAMARIS_FINALIZE, "damaris_finalize"}}; |
…ous code in Damaris plugin - Fix uninitialized pointer dereferences in DAMARIS_PARAMETER_GET/SET and DAMARIS_SET_BLOCK_POSITION/WRITE_BLOCK - Fix damaris_pdi_write_block returning bool instead of int, which collapsed distinct Damaris error codes down to 0/1 - Remove dead code: shadowed Damaris_cfg architecture members, unused reset_parameter_depends_on(vector)/reset_all_parameters_depends_on(), unnecessary static local - Use const auto& instead of by-value copies in get_updatable_parameters - Resolve and clean up all remaining "// Jacques:" review comments in damaris_cfg.cxx, merging them into proper doxygen where applicable - Add doxygen/explanatory comments across damaris_cfg.h/.cxx, damaris_api_call_handler.h/.cxx and damaris_wrapper.cxx for non-obvious variables and code paths
Revert the erroneous copyright changes to the other 5 files, and correctly extend damaris_api_call_handler.h's end years to 2026 without altering its start years (2015 for CEA, 2024 for Inria).
| * Copyright (C) 2015-2019 Commissariat a l'energie atomique et aux energies alternatives (CEA) | ||
| * Copyright (C) 2021 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC) | ||
| * All rights reserved. |
There was a problem hiding this comment.
| * Copyright (C) 2015-2019 Commissariat a l'energie atomique et aux energies alternatives (CEA) | |
| * Copyright (C) 2021 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC) | |
| * All rights reserved. | |
| * Copyright (C) 2026 Commissariat a l'energie atomique et aux energies alternatives (CEA) | |
| * All rights reserved. |
| * Copyright (C) 2015-2019 Commissariat a l'energie atomique et aux energies alternatives (CEA) | ||
| * Copyright (C) 2021 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC) |
There was a problem hiding this comment.
The copyright need to be change.
jmorice91
left a comment
There was a problem hiding this comment.
The copyright is needed to be checked in all the files.
| # Copyright (C) 2015-2024 Commissariat a l'energie atomique et aux energies alternatives (CEA) | ||
| # Copyright (C) 2024-2026 Institut national de recherche en informatique et en automatique (Inria) |
There was a problem hiding this comment.
The copyright need to be updated.
| # Copyright (C) 2015-2024 Commissariat a l'energie atomique et aux energies alternatives (CEA) | |
| # Copyright (C) 2024-2026 Institut national de recherche en informatique et en automatique (Inria) | |
| # Copyright (C) 2026 Commissariat a l'energie atomique et aux energies alternatives (CEA) | |
| # Copyright (C) 2024-2026 Institut national de recherche en informatique et en automatique (Inria) |
* Adding tests for multidimensional array with ghosts layer
* Adding a test with when condition * Apply suggestion from @Yushan-Wang
- #9: document what `block` means (local sub-domain index, relevant when architecture/domains > 1) in the README, Dataset_Write_Info, and at its read site in damaris.cxx - #12: confirm init_on_event().empty() is the intended "not configured" check, per direct confirmation - #13: fix DAMARIS_FINALIZE's auto-stop fallback to key off whether DAMARIS_STOP has actually run (new m_stopped flag) rather than whether stop_on_event was configured, closing the gap where an explicitly configured stop_on_event that never fires would let finalize run without ever stopping dedicated server ranks (traced via ~/damaris source: no server-side check ties finalize to a prior stop)
| * `write`: list of data that will be write on the disk by damaris. Each data is composed with | ||
| * `dataset`: The dataset in which the data will be written. | ||
| * `position`: The starting position of the data (for each client process) with repect to the dataset. | ||
| * `block`(integer, default: 0): Which local sub-domain of this client process the data belongs to, when `architecture/domains` is greater than 1 (i.e. a single client manages several sub-domains/patches itself). Must be between `0` and `domains - 1`. Can be left at its default when `domains = 1`. |
There was a problem hiding this comment.
Where is the test for this option?
It would be nice to have a discuss about this point.
There was a problem hiding this comment.
remove domains and block for the 1st release
| include(FindPackageHandleStandardArgs) | ||
| include(DamarisPluginUtils) | ||
|
|
||
| set(Damaris_BASE_DIR /usr/local/lib/damaris /usr/lib/damaris /opt/damaris) |
There was a problem hiding this comment.
is this still needed?
| include(DamarisPluginUtils) | ||
|
|
||
| set(Damaris_BASE_DIR /usr/local/lib/damaris /usr/lib/damaris /opt/damaris) | ||
| set(Damaris_VERSIONS 1.12.0) |
There was a problem hiding this comment.
shouldn't this version number be retrieved from Damaris lib?
| global: ['$psize[0]*($dsize[0]-2)', '$psize[1]*($dsize[1]-2)'] | ||
| dimensions: [ '$dsize[0]', '$dsize[1]' ] # process dim, with ghosts/boundaries | ||
| ghosts: '1:1,1:1' |
There was a problem hiding this comment.
| global: ['$psize[0]*($dsize[0]-2)', '$psize[1]*($dsize[1]-2)'] | |
| dimensions: [ '$dsize[0]', '$dsize[1]' ] # process dim, with ghosts/boundaries | |
| ghosts: '1:1,1:1' | |
| # some where in the config yaml we have NG = 2 | |
| global: ['$psize[0]*($dsize[0]-$NG*2)', '$psize[1]*($dsize[1]-$NG*2)'] | |
| dimensions: [ '$dsize[0]', '$dsize[1]' ] # process dim, with ghosts/boundaries | |
| ghosts: '$NG:$NG,$NG:$NG' |
| } else if (key == "init_on_event" || key == "on_init") { | ||
| m_init_on_event = PDI::to_string(value); | ||
| load_event(m_events, ctx, m_init_on_event, Event_type::DAMARIS_INITIALIZE); | ||
| } else if (key == "finalize_on_event" || key == "on_finalize") { | ||
| m_finalize_on_event = PDI::to_string(value); | ||
| load_event(m_events, ctx, m_finalize_on_event, Event_type::DAMARIS_FINALIZE); |
There was a problem hiding this comment.
It is would be better to use only one key to define this event.
| store.store_opt_FileMode_ = PDI::to_string(value); | ||
| } else if (key == "files_path") { | ||
| store.store_opt_FilesPath_ = PDI::to_string(value); | ||
| // bool create_dir = creation_directory_c_only(ctx, store.store_opt_FilesPath_); |
There was a problem hiding this comment.
We can remove these lines
| /// @return true if the directory is created or exists | ||
| /// NOTE: currently unused (kept as a pre-C++17 <filesystem> fallback) - creation_directory_cpp() | ||
| /// below is the one actually called from parse_storages_tree(). | ||
| bool creation_directory_c_only(PDI::Context& ctx, const std::string& dir_name) |
There was a problem hiding this comment.
Never used. we can remove.
| void retrive_nested_groups(std::string& dataset_elt_full_name, char delimiter, std::string nested_groups_names[], unsigned& index); | ||
| template <typename DS_TYPE> | ||
| void insert_dataset_elts_to_group(DS_TYPE varxml, std::string nested_groups_names[], unsigned index); | ||
| //void insert_dataset_elts_to_group(damaris::model::DamarisVarXML varxml, std::string nested_groups_names[], unsigned index); |
| } | ||
| } | ||
|
|
||
| else if (key == "start" || key == "get_is_client" || key == "is_client_get") |
List of things to check before making a PR
Before merging your code, please check the following:
.clang-format;Fix #issuekeyword to autoclose the issue when merged.