diff --git a/.clang-format b/.clang-format index 57d55c2452a83dab6c8da75e52409e44f1f52ea6..31504228ffccf69a386ce6a52bf50e0291bef622 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ --- Language: Cpp -# BasedOnStyle: LLVM -AccessModifierOffset: -2 +# BasedOnStyle: Google +AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignArrayOfStructures: None AlignConsecutiveAssignments: @@ -33,7 +33,7 @@ AlignConsecutiveShortCaseStatements: AcrossEmptyLines: false AcrossComments: false AlignCaseColons: false -AlignEscapedNewlines: Right +AlignEscapedNewlines: Left AlignOperands: Align AlignTrailingComments: Kind: Always @@ -44,13 +44,13 @@ AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never +AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLambdasOnASingleLine: All -AllowShortLoopsOnASingleLine: false +AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: MultiLine +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes AttributeMacros: - __capability BinPackArguments: true @@ -92,7 +92,7 @@ CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DerivePointerAlignment: false +DerivePointerAlignment: true DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: LogicalBlock @@ -104,25 +104,29 @@ ForEachMacros: - BOOST_FOREACH IfMacros: - KJ_IF_MAYBE -IncludeBlocks: Preserve +IncludeBlocks: Regroup IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + - Regex: '^' Priority: 2 SortPriority: 0 CaseSensitive: false - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 + - Regex: '^<.*\.h>' + Priority: 1 + SortPriority: 0 + CaseSensitive: false + - Regex: '^<.*' + Priority: 2 SortPriority: 0 CaseSensitive: false - Regex: '.*' - Priority: 1 + Priority: 3 SortPriority: 0 CaseSensitive: false -IncludeIsMainRegex: '(Test)?$' +IncludeIsMainRegex: '([-_](test|unittest))?$' IncludeIsMainSourceRegex: '' IndentAccessModifiers: false IndentCaseBlocks: false -IndentCaseLabels: false +IndentCaseLabels: true IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: None @@ -141,7 +145,7 @@ IntegerLiteralSeparator: HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature LineEnding: DeriveLF @@ -149,14 +153,14 @@ MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: None -ObjCBinPackProtocolList: Auto +ObjCBinPackProtocolList: Never ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true -PackConstructorInitializers: BinPack +PackConstructorInitializers: NextLine PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakOpenParenthesis: 0 @@ -164,10 +168,40 @@ PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyIndentedWhitespace: 0 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left PPIndentWidth: -1 QualifierAlignment: Leave +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + - ParseTestProto + - ParsePartialTestProto + CanonicalDelimiter: pb + BasedOnStyle: google ReferenceAlignment: Pointer ReflowComments: true RemoveBracesLLVM: false @@ -204,7 +238,7 @@ SpaceBeforeParensOptions: SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false -SpacesBeforeTrailingComments: 1 +SpacesBeforeTrailingComments: 2 SpacesInAngles: Never SpacesInContainerLiterals: true SpacesInLineCommentPrefix: @@ -217,7 +251,7 @@ SpacesInParensOptions: InEmptyParentheses: false Other: false SpacesInSquareBrackets: false -Standard: Latest +Standard: Auto StatementAttributeLikeMacros: - Q_EMIT StatementMacros: @@ -232,5 +266,6 @@ WhitespaceSensitiveMacros: - NS_SWIFT_NAME - PP_STRINGIZE - STRINGIZE -... - +--- +Language: Json +BasedOnStyle: llvm diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b040aeff045f6c6fed333d9a851793e9ed72353d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: +# Official repo for the clang-format hook +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: 'v18.1.8' + hooks: + - id: clang-format +# Official repo for default hooks +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: 'v4.3.0' + hooks: + - id: mixed-line-ending + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: end-of-file-fixer +- repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell diff --git a/CMakeLists.txt b/CMakeLists.txt index 9be69e24efe078590c6daba3e49eb06067fe7193..81051690488af14b1d9aa46d17a7ec2e80f47493 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ option(SPLIT_FORTRAN_LIBRARY "Split the fortran symbols into a special library ( option(GEN_BINDINGS "Use Shroud to Generate C/Fortran interface - EXPERIMENTAL" OFF) # Install options -option(INSTALL_WITH_RPATH "RPATH the build depencies for e.g dlb into the shared object, if not you have to provide symbols at loading time" OFF) +option(INSTALL_WITH_RPATH "RPATH the build dependencies for e.g dlb into the shared object, if not you have to provide symbols at loading time" OFF) # Other options option(WITH_MPI "Compile with MPI" OFF) @@ -69,7 +69,7 @@ if(ENABLE_EXTRAE) target_link_libraries(nesmik PUBLIC ${Extrae_LIBRARIES}) target_compile_definitions(nesmik PRIVATE "ENABLE_EXTRAE") else() - message(FATAL_ERROR "Couldnt find Extrae") + message(FATAL_ERROR "Couldn't find Extrae") endif() endif() @@ -81,7 +81,7 @@ if(ENABLE_DLB) target_link_libraries(nesmik PRIVATE ${DLB_LIBRARIES}) target_compile_definitions(nesmik PRIVATE "ENABLE_DLB") else() - message(FATAL_ERROR "Couldnt find DLB") + message(FATAL_ERROR "Couldn't find DLB") endif() endif() @@ -105,8 +105,7 @@ add_subdirectory(tests) # Install Targets for nesmik # -# Setup General Install for: -# precice - the library +# Setup General Install for: the library include(GNUInstallDirs) message(STATUS ${CMAKE_INSTALL_INCLUDEDIR}) @@ -146,7 +145,7 @@ install(EXPORT nesmikTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nesmik ) -# Generate a Package Config File for precice +# Generate a Package Config File for nesmik include(CMakePackageConfigHelpers) write_basic_package_version_file("nesmikConfigVersion.cmake" VERSION 1.0.0 @@ -167,4 +166,3 @@ file(COPY "cmake/nesmikConfig.cmake" # Add an alias to allow subprojects to use the namespaced name add_library(nesmik::nesmik ALIAS nesmik) - diff --git a/LICENSE b/LICENSE index 351c65131530a034074765b4ab977cf0622b0eda..33bb36808dc118661fb0999f79f1c9ce5f5aa566 100644 --- a/LICENSE +++ b/LICENSE @@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation. whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the -Library. \ No newline at end of file +Library. diff --git a/cmake/FindDLB.cmake b/cmake/FindDLB.cmake index 590d7e7b38bc08aeb12b000d156d797afed66973..3bdbd770e2126832ba63a2d8c9abe5f67102893d 100644 --- a/cmake/FindDLB.cmake +++ b/cmake/FindDLB.cmake @@ -32,20 +32,20 @@ The following cache variables may also be set: if(NOT DLB_DIR) if(DEFINED ENV{DLB_HOME}) - message(STATUS "FindDLB: DLB_DIR not explicity set, using DLB_HOME set to: $ENV{DLB_HOME}") + message(STATUS "FindDLB: DLB_DIR not explicitly set, using DLB_HOME set to: $ENV{DLB_HOME}") set(DLB_DIR $ENV{DLB_HOME} ) else() message(FATAL_ERROR "FindDLB: Couldn't auto-detect DLB_DIR, please provide the installation location of DLB with -DDLB_DIR=") endif() endif() -if(DEFINED DLB_LIB) - find_library(DLB_LIBRARY +if(DEFINED DLB_LIB) + find_library(DLB_LIBRARY NAMES ${DLB_LIB} HINTS ${DLB_DIR} PATH_SUFFIXES lib lib64) else() - find_library(DLB_LIBRARY + find_library(DLB_LIBRARY NAMES dlb HINTS ${DLB_DIR} PATH_SUFFIXES lib lib64) diff --git a/cmake/FindExtrae.cmake b/cmake/FindExtrae.cmake index 6fe5ebc791c0a7f220f28c997e9cab13b50d274a..8213ea9e3d9163b2acf7e87d166246df197ffd9d 100644 --- a/cmake/FindExtrae.cmake +++ b/cmake/FindExtrae.cmake @@ -45,15 +45,15 @@ endif() -if(DEFINED Extrae_LIB) - find_library(Extrae_LIBRARY +if(DEFINED Extrae_LIB) + find_library(Extrae_LIBRARY NAMES ${Extrae_LIB} HINTS ${Extrae_DIR} PATH_SUFFIXES lib lib64) else() - find_library(Extrae_LIBRARY + find_library(Extrae_LIBRARY NAMES seqtrace - HINTS ${Extrae_DIR} + HINTS ${Extrae_DIR} PATH_SUFFIXES lib lib64) endif() @@ -70,7 +70,7 @@ find_package_handle_standard_args(Extrae Extrae_LIBRARY Extrae_INCLUDE_DIR ) - + if(Extrae_FOUND) set(Extrae_LIBRARIES ${Extrae_LIBRARY}) set(Extrae_INCLUDE_DIRS ${Extrae_INCLUDE_DIR}) diff --git a/cmake/nesmikConfig.cmake b/cmake/nesmikConfig.cmake index 4574ea9e4cdee0823a9434ce33a48b0653c26d97..7e47d51fc3e9799421f165e33cdd59ae48e7f858 100644 --- a/cmake/nesmikConfig.cmake +++ b/cmake/nesmikConfig.cmake @@ -1 +1 @@ -include("${CMAKE_CURRENT_LIST_DIR}/nesmikTargets.cmake") \ No newline at end of file +include("${CMAKE_CURRENT_LIST_DIR}/nesmikTargets.cmake") diff --git a/include/nesmik/nesmik.hpp b/include/nesmik/nesmik.hpp index d350cf15a14239df713df305e7df3b5f6a22084c..80b192e82314541203ea19b03e2a1a8abb73a37e 100644 --- a/include/nesmik/nesmik.hpp +++ b/include/nesmik/nesmik.hpp @@ -4,6 +4,6 @@ namespace nesmik { void init(const std::string &nesting_mode, const std::string &backend); void region_start(const std::string &name); void region_stop(const std::string &name); -void region_stop_last(void); // only supported in PN backends +void region_stop_last(void); // only supported in PN backends void finalize(); -} // namespace nesmik +} // namespace nesmik diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7297b4d5273a81dedb14b5cd81124dff85a2b78f..3be7aed5ad0e1281d2ac3cb4bf8c0398ade2dced 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,4 +5,3 @@ target_sources(nesmik PRIVATE delegator.cpp nesmik.cpp) if(BUILD_C_FORTRAN) add_subdirectory(bindings) endif() - diff --git a/src/backends/default/default.cpp b/src/backends/default/default.cpp index 7b0c2709574dc0d7ee401674f853a48802c927fe..63d34684a925433fe33af5235d828a7cf4d987a4 100644 --- a/src/backends/default/default.cpp +++ b/src/backends/default/default.cpp @@ -1,23 +1,20 @@ +#include "default.hpp" + #include #include -#include "default.hpp" - -PNDefault::PNDefault(){ - parallelism_descriptor_={ - .mpi_descriptor_ = MPIDescriptor::DontCare, - .thread_descriptor_ = ThreadDescriptor::Supported - }; +PNDefault::PNDefault() { + parallelism_descriptor_ = {.mpi_descriptor_ = MPIDescriptor::DontCare, + .thread_descriptor_ = ThreadDescriptor::Supported}; } - void PNDefault::RegionStart( const ProperlyNestedRegionInformation ®ion) noexcept { std::cout << "Region start: " << region.name << std::endl; } void PNDefault::RegionStopLast( - const ProperlyNestedRegionInformation ®ion) noexcept { + const ProperlyNestedRegionInformation ®ion) noexcept { std::cout << "Region stop: " << region.name << std::endl; } @@ -30,23 +27,18 @@ void PNDefault::Finalize() noexcept { // NPN - -NPNDefault::NPNDefault(){ - parallelism_descriptor_={ - .mpi_descriptor_ = MPIDescriptor::DontCare, - .thread_descriptor_ = ThreadDescriptor::Supported - }; +NPNDefault::NPNDefault() { + parallelism_descriptor_ = {.mpi_descriptor_ = MPIDescriptor::DontCare, + .thread_descriptor_ = ThreadDescriptor::Supported}; } - - void NPNDefault::RegionStart( const NotProperlyNestedRegionInformation ®ion) noexcept { std::cout << "Region start: " << region.name << std::endl; } void NPNDefault::RegionStop( - const NotProperlyNestedRegionInformation ®ion) noexcept { + const NotProperlyNestedRegionInformation ®ion) noexcept { std::cout << "Region stop: " << region.name << std::endl; } @@ -55,4 +47,4 @@ void NPNDefault::Init() noexcept { } void NPNDefault::Finalize() noexcept { std::cout << "nesmik::Finalize() Backend: NPN;Default " << std::endl; -} \ No newline at end of file +} diff --git a/src/backends/default/default.hpp b/src/backends/default/default.hpp index 8a1242f560768a343701d382757bc50305bc33b9..2792dbd93c3c05c4ce1fbf61d336ca23e662263c 100644 --- a/src/backends/default/default.hpp +++ b/src/backends/default/default.hpp @@ -1,25 +1,27 @@ -#include "strategies.hpp" #include -class PNDefault : public ProperlyNestedAnnotationStrategy { +#include "strategies.hpp" -public: +class PNDefault : public ProperlyNestedAnnotationStrategy { + public: PNDefault(); inline static const std::string name = "Default"; - void RegionStart(const ProperlyNestedRegionInformation &info_to_start) noexcept override; - void RegionStopLast(const ProperlyNestedRegionInformation &info_to_stop) noexcept override; - virtual void Init() noexcept; + void RegionStart( + const ProperlyNestedRegionInformation &info_to_start) noexcept override; + void RegionStopLast( + const ProperlyNestedRegionInformation &info_to_stop) noexcept override; + virtual void Init() noexcept; virtual void Finalize() noexcept; }; - class NPNDefault : public NotProperlyNestedAnnotationStrategy { - -public: + public: NPNDefault(); inline static const std::string name = "Default"; - virtual void RegionStart(const NotProperlyNestedRegionInformation &info_to_start) noexcept override; - virtual void RegionStop(const NotProperlyNestedRegionInformation &info_to_stop) noexcept override; - virtual void Init() noexcept; + virtual void RegionStart(const NotProperlyNestedRegionInformation + &info_to_start) noexcept override; + virtual void RegionStop( + const NotProperlyNestedRegionInformation &info_to_stop) noexcept override; + virtual void Init() noexcept; virtual void Finalize() noexcept; }; diff --git a/src/backends/detection/detection.cpp b/src/backends/detection/detection.cpp index 9f9d29a5556f5ab38309b3ed2104d0511cf3819f..3fb20fa11c928f4ee86dc81589c538c04451f5fb 100644 --- a/src/backends/detection/detection.cpp +++ b/src/backends/detection/detection.cpp @@ -1,232 +1,255 @@ #include "detection.hpp" -#include -#include -#include -#include +#include #include - #include +#include +#include +#include #ifdef WITH_MPI - #include +#include #endif // for convenience using json = nlohmann::json; -void to_json(json& j, const RegionEventEntry& p){ - - +void to_json(json& j, const RegionEventEntry& p) { // first convert to the stack to std::vector in order - std::stack local_stack = p.stack_; // copy stack + std::stack local_stack = p.stack_; // copy stack std::vector stack_vec(local_stack.size()); - for(std::size_t i = 0; i< local_stack.size(); i++){ + for (std::size_t i = 0; i < local_stack.size(); i++) { stack_vec.at(i) = local_stack.top(); local_stack.pop(); } - // we use camelCase as suggested in https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format - j = json{ - {"threadId", p.thread_.thread_id_}, - {"processId", p.thread_.process_id_}, - {"regionName", p.region_name_}, - {"stack", stack_vec}, - {"timestamp", p.timestamp} - }; - + // we use camelCase as suggested in + // https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format + j = json{{"threadId", p.thread_.thread_id_}, + {"processId", p.thread_.process_id_}, + {"regionName", p.region_name_}, + {"stack", stack_vec}, + {"timestamp", p.timestamp}}; } -void from_json(const json& j, RegionEventEntry& p){ +void from_json(const json& j, RegionEventEntry& p) {} -} - -ThreadStore getThreadStoreOfCaller(){ +ThreadStore getThreadStoreOfCaller() { ThreadStore thread_store; thread_store.process_id_ = getpid(); thread_store.thread_id_ = gettid(); return thread_store; } -double getTimeStamp(){ - #ifdef WITH_MPI - return MPI_Wtime(); - #else - using clock = std::chrono::system_clock; - auto now = clock::now(); - double seconds = std::chrono::duration_cast>(now.time_since_epoch()).count(); - return seconds; - - #endif - - } - - -DetectionStrategy::DetectionStrategy():mpi_helper_{}{ - parallelism_descriptor_={ - .mpi_descriptor_ = MPIDescriptor::Aware, - .thread_descriptor_ = ThreadDescriptor::Supported - }; - +double getTimeStamp() { +#ifdef WITH_MPI + return MPI_Wtime(); +#else + using clock = std::chrono::system_clock; + auto now = clock::now(); + double seconds = std::chrono::duration_cast >( + now.time_since_epoch()) + .count(); + return seconds; +#endif } -void DetectionStrategy::Init() noexcept { - +DetectionStrategy::DetectionStrategy() : mpi_helper_{} { + parallelism_descriptor_ = {.mpi_descriptor_ = MPIDescriptor::Aware, + .thread_descriptor_ = ThreadDescriptor::Supported}; } +void DetectionStrategy::Init() noexcept {} + void DetectionStrategy::RegionStart( - const ProperlyNestedRegionInformation ®ion) noexcept { - RegionEventEntry start_entry; - start_entry.timestamp= getTimeStamp(); - start_entry.region_name_=std::string(region.name); - start_entry.stack_ = region.stack_; - start_entry.thread_ = getThreadStoreOfCaller(); - - std::lock_guard guard(starts_mutex_); - starts_.push_back(start_entry); + const ProperlyNestedRegionInformation& region) noexcept { + RegionEventEntry start_entry; + start_entry.timestamp = getTimeStamp(); + start_entry.region_name_ = std::string(region.name); + start_entry.stack_ = region.stack_; + start_entry.thread_ = getThreadStoreOfCaller(); + + std::lock_guard guard(starts_mutex_); + starts_.push_back(start_entry); } void DetectionStrategy::RegionStopLast( - const ProperlyNestedRegionInformation ®ion) noexcept { - - // first create an entry - RegionEventEntry stop_entry; - stop_entry.timestamp= getTimeStamp(); - stop_entry.region_name_ = std::string(region.name); - - stop_entry.stack_ = region.stack_; - stop_entry.thread_ = getThreadStoreOfCaller(); - - - std::lock_guard guard(ends_mutex_); - ends_.push_back(stop_entry); - - // two error checks are following - - if(region.stack_.empty()){ - if(verbose_mode_.getValue().value_or(false)) - { - std::cout << "neSmiK WARNING: The stack is already empty, so no more regions to close, but it tried to close " << region.name << std::endl; - } - has_errors_ = true; - return; - } - // now check if we actually pop the right name - if(region.name.compare(region.stack_.top())!= 0){ - if(verbose_mode_.getValue().value_or(false)){ - std::cout << "neSmiK WARNING: The stack says the next region to close is " << region.stack_.top() << " but tried closing " << region.name<< std::endl; - } - has_errors_ = true; - return; - } + const ProperlyNestedRegionInformation& region) noexcept { + // first create an entry + RegionEventEntry stop_entry; + stop_entry.timestamp = getTimeStamp(); + stop_entry.region_name_ = std::string(region.name); -} + stop_entry.stack_ = region.stack_; + stop_entry.thread_ = getThreadStoreOfCaller(); - + std::lock_guard guard(ends_mutex_); + ends_.push_back(stop_entry); + // two error checks are following -void DetectionStrategy::Finalize() noexcept { + if (region.stack_.empty()) { + if (verbose_mode_.getValue().value_or(false)) { + std::cout << "neSmiK WARNING: The stack is already empty, so no more " + "regions to close, but it tried to close " + << region.name << std::endl; + } + has_errors_ = true; + return; + } + // now check if we actually pop the right name + if (region.name.compare(region.stack_.top()) != 0) { + if (verbose_mode_.getValue().value_or(false)) { + std::cout << "neSmiK WARNING: The stack says the next region to close is " + << region.stack_.top() << " but tried closing " << region.name + << std::endl; + } + has_errors_ = true; + return; + } +} - - int has_errors = static_cast(has_errors_); - int has_been_called_from_threads = 0; - +void DetectionStrategy::Finalize() noexcept { + int has_errors = static_cast(has_errors_); + int has_been_called_from_threads = 0; - pid_t first_thread_id = 0; + pid_t first_thread_id = 0; - for(const auto& start : starts_){ - if(first_thread_id == 0){ - first_thread_id = start.thread_.thread_id_; - } - if(start.thread_.thread_id_ != first_thread_id){ - has_been_called_from_threads = 1; - break; - } + for (const auto& start : starts_) { + if (first_thread_id == 0) { + first_thread_id = start.thread_.thread_id_; } - - for(const auto& end : ends_){ - if(first_thread_id == 0){ - first_thread_id = end.thread_.thread_id_; - } - if(end.thread_.thread_id_ != first_thread_id){ - has_been_called_from_threads = 1; - break; - } + if (start.thread_.thread_id_ != first_thread_id) { + has_been_called_from_threads = 1; + break; } + } - - - #ifdef WITH_MPI - int local_has_been_called_from_threads = has_been_called_from_threads; - int local_has_errors = has_errors; - if(mpi_helper_.IsUsingMPI()){ - PMPI_Reduce(&local_has_been_called_from_threads,&has_been_called_from_threads,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); - PMPI_Reduce(&local_has_errors,&has_errors,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); - } - #endif - - - // print summary report - if(mpi_helper_.IsRankNumber(0)){ - if(mpi_helper_.IsUsingMPI()){ - std::cout << "############################### Using MPI: Yes ##################################################" << std::endl; - } - std::cout << "############################### Nesting Summary #################################################" << std::endl; - std::cout << "# #" << std::endl; - if(has_errors > 0 ){ - std::cout << "# neSmiK detected that the nesting of regions implemented by the application is NotProperlyNested #" << std::endl; - std::cout << "# Please be aware, that using backends that require ProperlyNested regions is not supported #" << std::endl; - std::cout << "# If you think this is a bug, as you expected them to be ProperlyNested, #" << std::endl; - std::cout << "# please look at the docs on instructions on how to proceed. #"<< std::endl; - std::cout << "# #" << std::endl; - if(mpi_helper_.IsUsingMPI()){ - std::cout << "# Nesmik also produced files called nesmik_detection_ends_.json and #" << std::endl; - std::cout << "# nesmik_detection_starts_.json with a json event trace you can use to debug. #" << std::endl; - }else{ - std::cout << "# Nesmik also produced files called nesmik_detection_ends.json and #" << std::endl; - std::cout << "# nesmik_detection_starts.json with a json event trace you can use to debug. #" << std::endl; - } - - }else{ - std::cout << "# neSmiK detected that the nesting of regions implemented by the application is ProperlyNested #" << std::endl; - std::cout << "# That is great news! #" << std::endl; - std::cout << "# #" << std::endl; + for (const auto& end : ends_) { + if (first_thread_id == 0) { + first_thread_id = end.thread_.thread_id_; } - std::cout << "################################ Thread Summary #################################################" << std::endl; - std::cout << "# #" << std::endl; - if(has_been_called_from_threads > 0 ){ - std::cout << "# neSmiks annontation API has been called from more than one thread. #"<< std::endl; - std::cout << "# Note, that your backend needs to have multithreading support to generate proper results #"<< std::endl; - std::cout << "# #" << std::endl; - }else{ - std::cout << "# neSmiks annotation API has been NOT called from more than one thread. #"<< std::endl; - std::cout << "# #" << std::endl; + if (end.thread_.thread_id_ != first_thread_id) { + has_been_called_from_threads = 1; + break; } - std::cout << "###################################################################################################" << std::endl; } +#ifdef WITH_MPI + int local_has_been_called_from_threads = has_been_called_from_threads; + int local_has_errors = has_errors; + if (mpi_helper_.IsUsingMPI()) { + PMPI_Reduce(&local_has_been_called_from_threads, + &has_been_called_from_threads, 1, MPI_INT, MPI_SUM, 0, + MPI_COMM_WORLD); + PMPI_Reduce(&local_has_errors, &has_errors, 1, MPI_INT, MPI_SUM, 0, + MPI_COMM_WORLD); + } +#endif - - nlohmann::json j_starts = starts_; - nlohmann::json j_end = ends_; - - std::string filenname_starts = "nesmik_detection_starts"; - std::string filenname_ends = "nesmik_detection_ends"; - if(mpi_helper_.IsUsingMPI()){ - // prepend MPI rank to the filename - filenname_starts += "_" + std::to_string(mpi_helper_.getRankNumber()); - filenname_ends += "_" + std::to_string(mpi_helper_.getRankNumber()); + // print summary report + if (mpi_helper_.IsRankNumber(0)) { + if (mpi_helper_.IsUsingMPI()) { + std::cout << "############################### Using MPI: Yes " + "##################################################" + << std::endl; } + std::cout << "############################### Nesting Summary " + "#################################################" + << std::endl; + std::cout << "# " + " #" + << std::endl; + if (has_errors > 0) { + std::cout << "# neSmiK detected that the nesting of regions implemented " + "by the application is NotProperlyNested #" + << std::endl; + std::cout << "# Please be aware, that using backends that require " + "ProperlyNested regions is not supported #" + << std::endl; + std::cout << "# If you think this is a bug, as you expected them to be " + "ProperlyNested, #" + << std::endl; + std::cout << "# please look at the docs on instructions on how to " + "proceed. #" + << std::endl; + std::cout << "# " + " #" + << std::endl; + if (mpi_helper_.IsUsingMPI()) { + std::cout + << "# Nesmik also produced files called " + "nesmik_detection_ends_.json and #" + << std::endl; + std::cout << "# nesmik_detection_starts_.json with a json event " + "trace you can use to debug. #" + << std::endl; + } else { + std::cout + << "# Nesmik also produced files called nesmik_detection_ends.json " + "and #" + << std::endl; + std::cout << "# nesmik_detection_starts.json with a json event trace " + "you can use to debug. #" + << std::endl; + } - std::ofstream file_starts(filenname_starts +".json"); - std::ofstream file_ends(filenname_ends +".json"); - - file_starts << j_starts; - file_ends << j_end; + } else { + std::cout << "# neSmiK detected that the nesting of regions implemented " + "by the application is ProperlyNested #" + << std::endl; + std::cout << "# That is great news! " + " #" + << std::endl; + std::cout << "# " + " #" + << std::endl; + } + std::cout << "################################ Thread Summary " + "#################################################" + << std::endl; + std::cout << "# " + " #" + << std::endl; + if (has_been_called_from_threads > 0) { + std::cout << "# neSmiks annontation API has been called from more than " + "one thread. #" + << std::endl; + std::cout << "# Note, that your backend needs to have multithreading " + "support to generate proper results #" + << std::endl; + std::cout << "# " + " #" + << std::endl; + } else { + std::cout << "# neSmiks annotation API has been NOT called from more " + "than one thread. #" + << std::endl; + std::cout << "# " + " #" + << std::endl; + } + std::cout << "#############################################################" + "######################################" + << std::endl; + } + nlohmann::json j_starts = starts_; + nlohmann::json j_end = ends_; + std::string filenname_starts = "nesmik_detection_starts"; + std::string filenname_ends = "nesmik_detection_ends"; + if (mpi_helper_.IsUsingMPI()) { + // prepend MPI rank to the filename + filenname_starts += "_" + std::to_string(mpi_helper_.getRankNumber()); + filenname_ends += "_" + std::to_string(mpi_helper_.getRankNumber()); + } + std::ofstream file_starts(filenname_starts + ".json"); + std::ofstream file_ends(filenname_ends + ".json"); + file_starts << j_starts; + file_ends << j_end; } diff --git a/src/backends/detection/detection.hpp b/src/backends/detection/detection.hpp index 1b9ca7da9aee0ace87a473bd4081d5e6ba2a5718..e1d87582e2d2f52046fa0e987b060145784abef8 100644 --- a/src/backends/detection/detection.hpp +++ b/src/backends/detection/detection.hpp @@ -1,62 +1,57 @@ #ifndef NESMIK_DETECTION_H #define NESMIK_DETECTION_H -#include -#include -#include - -#include #include -#include -#include -#include +#include +#include #include +#include +#include +#include +#include +#include // for convenience using json = nlohmann::json; - -struct ThreadStore{ - pid_t thread_id_; - pid_t process_id_; +struct ThreadStore { + pid_t thread_id_; + pid_t process_id_; }; - -struct RegionEventEntry{ +struct RegionEventEntry { ThreadStore thread_; std::string region_name_; - std::stack stack_; + std::stack stack_; double timestamp; }; - - void to_json(json& j, const RegionEventEntry& p); void from_json(const json& j, RegionEventEntry& p); - - class DetectionStrategy : public ProperlyNestedAnnotationStrategy { + private: + MPIHelper mpi_helper_; + std::vector starts_; + std::vector ends_; -private: - MPIHelper mpi_helper_; - std::vector starts_; - std::vector ends_; - - std::mutex starts_mutex_; - std::mutex ends_mutex_; - EnvironmentVariable verbose_mode_ = - EnvironmentVariable("DETECTION_VERBOSE", "Enables the verbose mode in the detection backend",true); + std::mutex starts_mutex_; + std::mutex ends_mutex_; + EnvironmentVariable verbose_mode_ = EnvironmentVariable( + "DETECTION_VERBOSE", "Enables the verbose mode in the detection backend", + true); - bool has_errors_ = false; + bool has_errors_ = false; -public: + public: DetectionStrategy(); inline static const std::string name = "Detection"; - virtual void RegionStart(const ProperlyNestedRegionInformation ®ion) noexcept override; - virtual void RegionStopLast(const ProperlyNestedRegionInformation ®ion) noexcept override; - virtual void Init() noexcept; - virtual void Finalize() noexcept; + virtual void RegionStart( + const ProperlyNestedRegionInformation& region) noexcept override; + virtual void RegionStopLast( + const ProperlyNestedRegionInformation& region) noexcept override; + virtual void Init() noexcept; + virtual void Finalize() noexcept; }; -#endif // NESMIK_DETECTION_H +#endif // NESMIK_DETECTION_H diff --git a/src/backends/dlb/dlb/dlb.cpp b/src/backends/dlb/dlb/dlb.cpp index 6ab417112c95d9d83a27e9b273da4da35c8b1012..dc35e99fa91b83be61aed423abc6f720bbc57ce9 100644 --- a/src/backends/dlb/dlb/dlb.cpp +++ b/src/backends/dlb/dlb/dlb.cpp @@ -1,18 +1,20 @@ #include "dlb.hpp" -#include "dlb.h" -#include "dlb_talp.h" + #include +#include "dlb.h" +#include "dlb_talp.h" -DLBTalpStrategy::DLBTalpStrategy(){ - parallelism_descriptor_={ - .mpi_descriptor_ = MPIDescriptor::DontCare, - .thread_descriptor_ = ThreadDescriptor::Supported // Even though it makes no semantical sense +DLBTalpStrategy::DLBTalpStrategy() { + parallelism_descriptor_ = { + .mpi_descriptor_ = MPIDescriptor::DontCare, + .thread_descriptor_ = ThreadDescriptor::Supported // Even though it makes + // no semantical sense }; } void DLBTalpStrategy::RegionStart( - const NotProperlyNestedRegionInformation ®ion) noexcept { + const NotProperlyNestedRegionInformation ®ion) noexcept { // we have to create a small std::string thing because we cannot assume that // the string_view passed is properly null terminated auto handle = DLB_MonitoringRegionRegister(std::string(region.name).c_str()); @@ -20,17 +22,16 @@ void DLBTalpStrategy::RegionStart( } void DLBTalpStrategy::RegionStop( - const NotProperlyNestedRegionInformation ®ion) noexcept { + const NotProperlyNestedRegionInformation ®ion) noexcept { auto handle = DLB_MonitoringRegionRegister(std::string(region.name).c_str()); DLB_MonitoringRegionStop(handle); } -void DLBTalpStrategy::Init() noexcept { - +void DLBTalpStrategy::Init() noexcept { DLB_Init(0, NULL, "--talp"); std::cout << "nesmik::" << name << " init()" << std::endl; } -void DLBTalpStrategy::Finalize() noexcept { +void DLBTalpStrategy::Finalize() noexcept { DLB_Finalize(); std::cout << "nesmik::" << name << " Finalize()" << std::endl; } diff --git a/src/backends/dlb/dlb/dlb.hpp b/src/backends/dlb/dlb/dlb.hpp index b3647b12c04c2fc08beffa713dda898ef58060b2..876a524a293131df2a7284b48b869fc421d1ed2e 100644 --- a/src/backends/dlb/dlb/dlb.hpp +++ b/src/backends/dlb/dlb/dlb.hpp @@ -4,13 +4,14 @@ #include class DLBTalpStrategy : public NotProperlyNestedAnnotationStrategy { - -public: + public: DLBTalpStrategy(); inline static const std::string name = "TALP"; - virtual void RegionStart(const NotProperlyNestedRegionInformation ®ion) noexcept override; - virtual void RegionStop(const NotProperlyNestedRegionInformation ®ion) noexcept override; - virtual void Init() noexcept; - virtual void Finalize() noexcept; + virtual void RegionStart( + const NotProperlyNestedRegionInformation ®ion) noexcept override; + virtual void RegionStop( + const NotProperlyNestedRegionInformation ®ion) noexcept override; + virtual void Init() noexcept; + virtual void Finalize() noexcept; }; -#endif // SIT_DLB_H +#endif // SIT_DLB_H diff --git a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.cpp b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.cpp index 3bd604aafe19eb222be09da1cdd07b588339d224..19e7bcb50293fc35c1e946e17ba862fcc7833927 100644 --- a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.cpp +++ b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.cpp @@ -1,8 +1,5 @@ #include "dlb_talp_tree.hpp" -#include "dlb.h" -#include "dlb_talp.h" -#include "dlb_talp_tree_ascii_serializer.hpp" -#include "dlb_talp_tree_json_serializer.hpp" + #include #include #include @@ -11,6 +8,11 @@ #include #include +#include "dlb.h" +#include "dlb_talp.h" +#include "dlb_talp_tree_ascii_serializer.hpp" +#include "dlb_talp_tree_json_serializer.hpp" + #ifdef WITH_MPI #include #endif @@ -20,20 +22,19 @@ using json = nlohmann::json; DLBTalpTreeStrategy::DLBTalpTreeStrategy() : mpi_helper_{} { - parallelism_descriptor_ = {.mpi_descriptor_ = MPIDescriptor::Aware, - .thread_descriptor_ = - ThreadDescriptor::Unsupported}; + parallelism_descriptor_ = { + .mpi_descriptor_ = MPIDescriptor::Aware, + .thread_descriptor_ = ThreadDescriptor::Unsupported}; } std::string region_hash_to_string(std::size_t region_hash) { - // We need to cast the std::size_t before conversion to get - // decimal representation in the string. - return std::to_string(static_cast(region_hash)); + // We need to cast the std::size_t before conversion to get + // decimal representation in the string. + return std::to_string(static_cast(region_hash)); } void DLBTalpTreeStrategy::RegionStart( const ProperlyNestedRegionInformation ®ion) noexcept { - // Construct the opening region hash by joining the name of the region with // the current region (i.e. the parent) hash. std::string region_name = @@ -46,12 +47,12 @@ void DLBTalpTreeStrategy::RegionStart( if (regions_.count(region_hash) == 0) { // Add the new region as a child to the current region - regions_[current_region_].childs.push_back(region_hash); + regions_[current_region_].children.push_back(region_hash); // Add the new region in the map regions_[region_hash] = {/* .name */ std::string(region.name), /* .parent */ current_region_, - /* .childs */ {}, + /* .children */ {}, /* .pop_metrics*/ {}}; } @@ -63,7 +64,6 @@ void DLBTalpTreeStrategy::RegionStart( void DLBTalpTreeStrategy::RegionStopLast( const ProperlyNestedRegionInformation ®ion) noexcept { - auto current_region = regions_[current_region_]; if (region.name.compare(current_region.name) != 0) { @@ -89,17 +89,15 @@ void DLBTalpTreeStrategy::RegionStopLast( } void DLBTalpTreeStrategy::Init() noexcept { - current_region_ = std::hash{}(top_region_); regions_[current_region_] = {/* .name */ top_region_, /* .parent */ 0, - /* .childs */ {}, + /* .children */ {}, /* .pop_metrics*/ {}}; talp_profiling_strategy_.Init(); } void DLBTalpTreeStrategy::Finalize() noexcept { - // Stop the top region which was automatically started by TALP. talp_profiling_strategy_.RegionStop({.name = top_region_}); diff --git a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.hpp b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.hpp index 029ec8232a9d32ef4580ef420b97a51dced12e79..f013186f93d88e5f4143c4e3ac1ea0bc1ad5f4f0 100644 --- a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.hpp +++ b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree.hpp @@ -1,28 +1,27 @@ #ifndef SIT_DLB_TALP_TREE_H #define SIT_DLB_TALP_TREE_H -#include "../dlb/dlb.hpp" -#include "dlb.h" -#include "dlb_talp.h" -#include "strategies.hpp" #include #include #include -#include - #include #include +#include + +#include "../dlb/dlb.hpp" +#include "dlb.h" +#include "dlb_talp.h" +#include "strategies.hpp" struct TalpRegionNode { std::string name; std::size_t parent; - std::vector childs; + std::vector children; dlb_pop_metrics_t pop_metrics; }; class DLBTalpTreeStrategy : public ProperlyNestedAnnotationStrategy { - -private: + private: DLBTalpStrategy talp_profiling_strategy_; inline static const std::string top_region_ = "Application"; @@ -50,15 +49,15 @@ private: "Enables human readable output to standard output. (default: off)", false); -public: + public: DLBTalpTreeStrategy(); inline static const std::string_view name = "TALP::Tree"; - void - RegionStart(const ProperlyNestedRegionInformation ®ion) noexcept override; + void RegionStart( + const ProperlyNestedRegionInformation ®ion) noexcept override; void RegionStopLast( const ProperlyNestedRegionInformation ®ion) noexcept override; virtual void Init() noexcept; virtual void Finalize() noexcept; }; -#endif // DLB_TALP_TREE_H +#endif // DLB_TALP_TREE_H diff --git a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.cpp b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.cpp index 7873f3fe98f3782ddc7214cacba532c87ba97b85..dcfbeccea5ebfb0435c05a538a669804462ed795 100644 --- a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.cpp +++ b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.cpp @@ -1,18 +1,17 @@ +#include "dlb_talp_tree_ascii_serializer.hpp" + #include -#include -#include #include - -#include "dlb_talp_tree_ascii_serializer.hpp" +#include +#include using json = nlohmann::json; -DLBTalpTreeASCIISerializer::DLBTalpTreeASCIISerializer(std::size_t top_region, std::map const& regions) - : top_region(top_region) - , regions(regions) - , tree_lines{} - {} +DLBTalpTreeASCIISerializer::DLBTalpTreeASCIISerializer( + std::size_t top_region, + std::map const& regions) + : top_region(top_region), regions(regions), tree_lines{} {} struct RegionStackEntry { std::size_t hash; @@ -21,90 +20,100 @@ struct RegionStackEntry { }; std::size_t DLBTalpTreeASCIISerializer::compute_tree_lines() { - std::stack regions_stack; - regions_stack.push({ - .hash = this->top_region, - .level = 0, - .tree_lines = "" - }); + regions_stack.push({.hash = this->top_region, .level = 0, .tree_lines = ""}); std::size_t max_width = 0; while (!regions_stack.empty()) { - RegionStackEntry current_region = regions_stack.top(); regions_stack.pop(); - // I am the last child either if the stack is empty or if the level of the following element - // in the stack is lower than mine. - bool last_child = regions_stack.empty() || regions_stack.top().level < current_region.level; + // I am the last child either if the stack is empty or if the level of the + // following element in the stack is lower than mine. + bool last_child = regions_stack.empty() || + regions_stack.top().level < current_region.level; - std::string next_tree_lines = " │ "; // By default I get the continuation line. - if (current_region.level == 0) // If I am the root region I don't need line. + std::string next_tree_lines = + " │ "; // By default I get the continuation line. + if (current_region.level == + 0) // If I am the root region I don't need line. next_tree_lines = ""; - else if (last_child) // If I am the last child I add space. + else if (last_child) // If I am the last child I add space. next_tree_lines = " "; - for (auto region : this->regions.at(current_region.hash).childs) { - regions_stack.push({ - .hash = region, - .level = current_region.level + 1, - .tree_lines = current_region.tree_lines + next_tree_lines - }); + for (auto region : this->regions.at(current_region.hash).children) { + regions_stack.push( + {.hash = region, + .level = current_region.level + 1, + .tree_lines = current_region.tree_lines + next_tree_lines}); } std::size_t level = current_region.level; std::string tree_lines = current_region.tree_lines; - if (level == 0) tree_lines += ""; // If I am the root I don't have lines - else if (last_child) tree_lines += " └─ "; // If I am the last child I close the line - else tree_lines += " ├─ "; // Otherwise i continue the line. + if (level == 0) + tree_lines += ""; // If I am the root I don't have lines + else if (last_child) + tree_lines += " └─ "; // If I am the last child I close the line + else + tree_lines += " ├─ "; // Otherwise i continue the line. this->tree_lines[current_region.hash] = tree_lines; - max_width = std::max(max_width, - this->regions.at(current_region.hash).name.length() + tree_lines.length()); + max_width = std::max(max_width, + this->regions.at(current_region.hash).name.length() + + tree_lines.length()); } - } std::string DLBTalpTreeASCIISerializer::generate_tree_view(int name_width) { - std::stack regions_stack; regions_stack.push(this->top_region); std::stringstream region_stream; while (!regions_stack.empty()) { - std::size_t current_region_hash = regions_stack.top(); regions_stack.pop(); - for (std::size_t child_hash : this->regions.at(current_region_hash).childs) { + for (std::size_t child_hash : + this->regions.at(current_region_hash).children) { regions_stack.push(child_hash); } TalpRegionNode current_region = this->regions.at(current_region_hash); - dlb_pop_metrics_t &pop_metrics = current_region.pop_metrics; + dlb_pop_metrics_t& pop_metrics = current_region.pop_metrics; - std::string name_with_tree_lines = this->tree_lines[current_region_hash] + current_region.name; + std::string name_with_tree_lines = + this->tree_lines[current_region_hash] + current_region.name; - region_stream << std::setw(name_width+3) << std::left << name_with_tree_lines; + region_stream << std::setw(name_width + 3) << std::left + << name_with_tree_lines; region_stream << std::fixed << std::setprecision(2); - region_stream << std::setw(15) << std::right << pop_metrics.elapsed_time/1000000000 << "s"; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.parallel_efficiency; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.mpi_parallel_efficiency; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.mpi_communication_efficiency; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.mpi_load_balance; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.mpi_load_balance_in; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.mpi_load_balance_out; - - region_stream << std::setw(8) << std::right << 100 * pop_metrics.omp_parallel_efficiency; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.omp_load_balance; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.omp_scheduling_efficiency; - region_stream << std::setw(8) << std::right << 100 * pop_metrics.omp_serialization_efficiency; + region_stream << std::setw(15) << std::right + << pop_metrics.elapsed_time / 1000000000 << "s"; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.parallel_efficiency; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.mpi_parallel_efficiency; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.mpi_communication_efficiency; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.mpi_load_balance; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.mpi_load_balance_in; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.mpi_load_balance_out; + + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.omp_parallel_efficiency; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.omp_load_balance; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.omp_scheduling_efficiency; + region_stream << std::setw(8) << std::right + << 100 * pop_metrics.omp_serialization_efficiency; region_stream << std::endl; - } return region_stream.str(); diff --git a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.hpp b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.hpp index 14e210aceed3b4a4a8d01aeac98c8fbe968c3ed8..a6bafbae22d624b97fd94dee8a774a7e763485c4 100644 --- a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.hpp +++ b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_ascii_serializer.hpp @@ -6,19 +6,20 @@ #include "dlb_talp_tree.hpp" class DLBTalpTreeASCIISerializer { - -private: + private: std::size_t top_region; std::map const& regions; std::map tree_lines; -public: - DLBTalpTreeASCIISerializer(std::size_t top_region, const std::map ®ions); + public: + DLBTalpTreeASCIISerializer( + std::size_t top_region, + const std::map& regions); std::string dump(); -private: + private: std::size_t compute_tree_lines(); std::string generate_tree_view(int name_width); }; -#endif // NESMIK_DLB_TALP_TREE_ASCII_SERIALIZER_H +#endif // NESMIK_DLB_TALP_TREE_ASCII_SERIALIZER_H diff --git a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.cpp b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.cpp index fd44ae4161fd825fb9d0d2d879d6097e0e7d9160..89191f907ca1eadbba641445f2708d91c2d2f646 100644 --- a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.cpp +++ b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.cpp @@ -1,51 +1,49 @@ +#include "dlb_talp_tree_json_serializer.hpp" + #include #include - -#include "dlb_talp_tree_json_serializer.hpp" - using json = nlohmann::json; -DLBTalpTreeJSONSerializer::DLBTalpTreeJSONSerializer(std::size_t top_region, std::map const& regions) - : top_region(top_region) - , regions(regions) - {} - -void treeToJSON(const TalpRegionNode &node, json &talp_json, - std::map const& regions) { +DLBTalpTreeJSONSerializer::DLBTalpTreeJSONSerializer( + std::size_t top_region, + std::map const& regions) + : top_region(top_region), regions(regions) {} +void treeToJSON(const TalpRegionNode& node, json& talp_json, + std::map const& regions) { talp_json["regionName"] = node.name; talp_json["metrics"] = { - {"elapsedTime", node.pop_metrics.elapsed_time}, + {"elapsedTime", node.pop_metrics.elapsed_time}, - {"parallelEfficiency", node.pop_metrics.parallel_efficiency}, + {"parallelEfficiency", node.pop_metrics.parallel_efficiency}, - {"mpiParallelEfficiency", node.pop_metrics.mpi_parallel_efficiency}, - {"mpiCommunicationEfficiency", node.pop_metrics.mpi_communication_efficiency}, - {"mpiLoadBalance", node.pop_metrics.mpi_load_balance}, - {"mpiLoadBalanceIn", node.pop_metrics.mpi_load_balance_in}, - {"mpiLoadBalanceOut", node.pop_metrics.mpi_load_balance_out}, + {"mpiParallelEfficiency", node.pop_metrics.mpi_parallel_efficiency}, + {"mpiCommunicationEfficiency", + node.pop_metrics.mpi_communication_efficiency}, + {"mpiLoadBalance", node.pop_metrics.mpi_load_balance}, + {"mpiLoadBalanceIn", node.pop_metrics.mpi_load_balance_in}, + {"mpiLoadBalanceOut", node.pop_metrics.mpi_load_balance_out}, - {"ompParallelEfficiency", node.pop_metrics.omp_parallel_efficiency}, - {"ompLoadBalance", node.pop_metrics.omp_load_balance}, - {"ompSchedulingEfficiency", node.pop_metrics.omp_scheduling_efficiency}, - {"ompSerializationEfficiency", node.pop_metrics.omp_serialization_efficiency} - }; + {"ompParallelEfficiency", node.pop_metrics.omp_parallel_efficiency}, + {"ompLoadBalance", node.pop_metrics.omp_load_balance}, + {"ompSchedulingEfficiency", node.pop_metrics.omp_scheduling_efficiency}, + {"ompSerializationEfficiency", + node.pop_metrics.omp_serialization_efficiency}}; talp_json["subregions"] = json::array(); - for (std::size_t child : node.childs) { + for (std::size_t child : node.children) { json childJSON; treeToJSON(regions.at(child), childJSON, regions); talp_json["subregions"].push_back(childJSON); } - } std::string DLBTalpTreeJSONSerializer::dump() { json talp_tree; treeToJSON(this->regions.at(this->top_region), talp_tree, this->regions); - // Activate pretty printing by giving an ammount of spaces bigger than 0. - return talp_tree.dump(/* ammount of spaces for indentation */ 2); + // Activate pretty printing by giving an amount of spaces bigger than 0. + return talp_tree.dump(/* amount of spaces for indentation */ 2); } diff --git a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.hpp b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.hpp index 4e279f4defd6757a6301f75c11ec621f11eb0e2c..b19e1c1a9ee627c72ed5022ba9405aa05b4ee17d 100644 --- a/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.hpp +++ b/src/backends/dlb/dlb_talp_tree/dlb_talp_tree_json_serializer.hpp @@ -6,14 +6,15 @@ #include "dlb_talp_tree.hpp" class DLBTalpTreeJSONSerializer { - -private: + private: std::size_t top_region; std::map const& regions; -public: - DLBTalpTreeJSONSerializer(std::size_t top_region, const std::map ®ions); + public: + DLBTalpTreeJSONSerializer( + std::size_t top_region, + const std::map& regions); std::string dump(); }; -#endif // NESMIK_DLB_TALP_TREE_JSON_SERIALIZER_H +#endif // NESMIK_DLB_TALP_TREE_JSON_SERIALIZER_H diff --git a/src/backends/extrae/extrae_type_stack.cpp b/src/backends/extrae/extrae_type_stack.cpp index 831b8d1b2190f2a7e4df3b73bd2883c9f6607e19..bf8f5d291fe9bbee8a0f8c7e6ac8ed7a43b68967 100644 --- a/src/backends/extrae/extrae_type_stack.cpp +++ b/src/backends/extrae/extrae_type_stack.cpp @@ -1,4 +1,5 @@ #include "extrae_type_stack.hpp" + #include #include #include @@ -16,7 +17,7 @@ ExtraeTypeStackStrategy::ExtraeTypeStackStrategy() { parallelism_descriptor_ = { .mpi_descriptor_ = MPIDescriptor::Aware, .thread_descriptor_ = - ThreadDescriptor::Supported // i guess no test currently for this + ThreadDescriptor::Supported // i guess no test currently for this }; } @@ -104,7 +105,6 @@ window_filter_module evt_type 1 NESMIK_REPLACE_EVENT_TYPE )"; void ExtraeTypeStackStrategy::Init() noexcept { - auto isInitializedVal = Extrae_is_initialized(); if (isInitializedVal == 0) { // Extrae is not initialized yet see @@ -114,8 +114,8 @@ void ExtraeTypeStackStrategy::Init() noexcept { } } -extrae_value -ExtraeTypeStackStrategy::get_value_by_region_name(const std::string &name) { +extrae_value ExtraeTypeStackStrategy::get_value_by_region_name( + const std::string &name) { // maybe insert if (regionMapData.regionNameToValue.count(name) > 0) { return regionMapData.regionNameToValue[name]; @@ -130,7 +130,6 @@ ExtraeTypeStackStrategy::get_value_by_region_name(const std::string &name) { void ExtraeTypeStackStrategy::RegionStart( const ProperlyNestedRegionInformation ®ion) noexcept { - // First push to stack const auto regionName = std::string(region.name); auto typeOffset = regionStackData.regionNameStack.size(); @@ -147,10 +146,9 @@ void ExtraeTypeStackStrategy::RegionStart( } void ExtraeTypeStackStrategy::RegionStopLast( const ProperlyNestedRegionInformation ®ion) noexcept { - if (regionStackData.regionNameStack.empty()) { // whoops - std::cout << "imbalanced region stop REASON: Emtpy stack " << region.name + std::cout << "imbalanced region stop REASON: Empty stack " << region.name << std::endl; return; } @@ -170,7 +168,6 @@ void ExtraeTypeStackStrategy::RegionStopLast( } void ExtraeTypeStackStrategy::Finalize() noexcept { - unsigned int numberOfRegionsRegistered = regionMapData.regionNameToValue.size(); std::vector values{}; @@ -209,10 +206,10 @@ void ExtraeTypeStackStrategy::Finalize() noexcept { // compute overview auto numberOfEventTypes = - regionStackData.historicMaxStackSize + 1; // 0 based so plus 1 + regionStackData.historicMaxStackSize + 1; // 0 based so plus 1 auto allTypes = std::vector(numberOfEventTypes); std::iota(std::begin(allTypes), std::end(allTypes), - baseType); // Fill with baseType baseType+1 .. + baseType); // Fill with baseType baseType+1 .. // Build a small list of all types std::string allTypesString = ""; @@ -231,7 +228,7 @@ void ExtraeTypeStackStrategy::Finalize() noexcept { outputFile << overviewReplacedAllTypes; outputFile << std::endl; - // write seperate windows + // write separate windows for (unsigned int level = 0; level <= regionStackData.historicMaxStackSize; level++) { std::string windowName = diff --git a/src/backends/extrae/extrae_type_stack.hpp b/src/backends/extrae/extrae_type_stack.hpp index 4c9956601fe103fccb91baff8ddff393cfa00d02..207894a5342c1bc5fef0f34069f0e918be718a19 100644 --- a/src/backends/extrae/extrae_type_stack.hpp +++ b/src/backends/extrae/extrae_type_stack.hpp @@ -1,8 +1,9 @@ -#include "strategies.hpp" #include #include #include #include + +#include "strategies.hpp" // #include typedef unsigned long extrae_value; typedef unsigned long extrae_type; @@ -17,8 +18,7 @@ struct RegionMapData { }; class ExtraeTypeStackStrategy : public ProperlyNestedAnnotationStrategy { - -private: + private: const bool write_config_file_default_{true}; const unsigned long baseType{81000}; static const std::string paraverConfigHead; @@ -35,12 +35,12 @@ private: inline static thread_local RegionMapData regionMapData; extrae_value get_value_by_region_name(const std::string &name); -public: + public: ExtraeTypeStackStrategy(); inline static const std::string_view name = "Extrae::TypeStack"; - virtual void - RegionStart(const ProperlyNestedRegionInformation ®ion) noexcept override; + virtual void RegionStart( + const ProperlyNestedRegionInformation ®ion) noexcept override; virtual void RegionStopLast( const ProperlyNestedRegionInformation ®ion) noexcept override; virtual void Init() noexcept override; diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt index 4b5497d9210e8bd8d2cf78580923e0af6f678568..22ddfad0b077136637b88e1504c9114382393b99 100644 --- a/src/bindings/CMakeLists.txt +++ b/src/bindings/CMakeLists.txt @@ -9,7 +9,7 @@ if(GEN_BINDINGS) message(FATAL_ERROR "Error from Shroud: ${SHROUD_cmake_error}") endif() include(${CMAKE_CURRENT_BINARY_DIR}/SetupShroud.cmake) - + # Generate the headers add_shroud( YAML_INPUT_FILE nesmik.yaml @@ -29,7 +29,3 @@ if(SPLIT_FORTRAN_LIBRARY) else() target_sources(nesmik PRIVATE wrapfnesmik.f) endif() - - - - diff --git a/src/bindings/nesmik.json b/src/bindings/nesmik.json index 71ba9941a36527489ad3810c45316e5c1eb2413e..96f8aba20b89291ad9d49d1a7f9bfaaa0694ca83 100644 --- a/src/bindings/nesmik.json +++ b/src/bindings/nesmik.json @@ -1,1077 +1,1077 @@ { - "": "This file is generated by Shroud 0.13.0 and is useful for debugging.", - "library": { - "cxx_header": [ - "nesmik/nesmik.hpp" + "": "This file is generated by Shroud 0.13.0 and is useful for debugging.", + "library": { + "cxx_header": [ + "nesmik/nesmik.hpp" + ], + "functions": [ + { + "": "0 ****************************************", + "C_generated_path": [ + "arg_to_buffer" ], - "functions": [ - { - "": "0 ****************************************", - "C_generated_path": [ - "arg_to_buffer" - ], - "_PTR_F_C_index": "5", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "init", - "params": [ - { - "const": true, - "declarator": { - "metaattrs": { - "intent": "in" - }, - "name": "nesting_mode", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - }, - { - "const": true, - "declarator": { - "metaattrs": { - "intent": "in" - }, - "name": "backend", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - } - ], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void init(const std::string &nesting_mode, const std::string &backend)", - "declgen": "void init(const std::string & nesting_mode, const std::string & backend)", - "linenumber": 8, - "name": "init", - "options": {}, - "wrap": { - "c": true, - "fortran": true + "_PTR_F_C_index": "5", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" + }, + "name": "init", + "params": [ + { + "const": true, + "declarator": { + "metaattrs": { + "intent": "in" + }, + "name": "nesting_mode", + "pointer": [ + { + "ptr": "&" + } + ], + "typemap_name": "std::string" }, - "zz_fmtargs": { - "backend": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "backend", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_backend)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_backend", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&", - "stmt1": "c_in_string_&" - }, - "fmtf": { - "F_C_var": "backend", - "c_var": "backend", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "backend", - "sh_type": "SH_TYPE_OTHER" - } - }, - "nesting_mode": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "nesting_mode", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_nesting_mode)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_nesting_mode", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&", - "stmt1": "c_in_string_&" - }, - "fmtf": { - "F_C_var": "nesting_mode", - "c_var": "nesting_mode", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "nesting_mode", - "sh_type": "SH_TYPE_OTHER" - } + "specifier": [ + "std::string" + ], + "typemap_name": "std::string" + }, + { + "const": true, + "declarator": { + "metaattrs": { + "intent": "in" + }, + "name": "backend", + "pointer": [ + { + "ptr": "&" } + ], + "typemap_name": "std::string" }, - "zz_fmtdict": { - "C_call_list": "SHCXX_nesting_mode,\t SHCXX_backend", - "C_name": "nesmik_init", - "C_name_api": "init", - "C_prototype": "const char * nesting_mode,\t const char * backend", - "C_return_type": "void", - "F_C_arguments": "nesting_mode,\t backend", - "F_C_call": "c_init_bufferify", - "F_C_name": "c_init", - "F_C_subprogram": "subroutine", - "F_arg_c_call": "nesting_mode,\t SHT_nesting_mode_len,\t backend,\t SHT_backend_len", - "F_arguments": "nesting_mode,\t backend", - "F_name_api": "init", - "F_name_function": "init", - "F_name_generic": "init", - "F_name_impl": "init", - "F_subprogram": "subroutine", - "function_name": "init", - "stmt0": "f_subroutine", - "stmt1": "f_subroutine", - "stmtc0": "c_subroutine", - "stmtc1": "c_subroutine" - } + "specifier": [ + "std::string" + ], + "typemap_name": "std::string" + } + ], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void init(const std::string &nesting_mode, const std::string &backend)", + "declgen": "void init(const std::string & nesting_mode, const std::string & backend)", + "linenumber": 8, + "name": "init", + "options": {}, + "wrap": { + "c": true, + "fortran": true + }, + "zz_fmtargs": { + "backend": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "backend", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_backend)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_backend", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&", + "stmt1": "c_in_string_&" }, - { - "": "5 ****************************************", - "_generated": "arg_to_buffer", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "init", - "params": [ - { - "const": true, - "declarator": { - "metaattrs": { - "api": "buf", - "intent": "in" - }, - "name": "nesting_mode", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - }, - { - "const": true, - "declarator": { - "metaattrs": { - "api": "buf", - "intent": "in" - }, - "name": "backend", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - } - ], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void init(const std::string &nesting_mode, const std::string &backend)", - "declgen": "void init(const std::string & nesting_mode, const std::string & backend)", - "linenumber": 8, - "name": "init", - "options": {}, - "splicer_group": "buf", - "wrap": { - "c": true, - "f_c": true - }, - "zz_fmtargs": { - "backend": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "backend", - "c_var_len": "SHT_backend_len", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_backend)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_backend", - "hnamefunc0": "ShroudLenTrim", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&_buf", - "stmt1": "c_in_string_&_buf" - }, - "fmtf": { - "F_C_var": "backend", - "c_var": "backend", - "c_var_len": "SHT_backend_len", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "backend", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "f_in_string_&_buf", - "stmt1": "f_in_string_&_buf", - "stmtc0": "c_in_string_&_buf", - "stmtc1": "c_in_string_&_buf" - } - }, - "nesting_mode": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "nesting_mode", - "c_var_len": "SHT_nesting_mode_len", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_nesting_mode)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_nesting_mode", - "hnamefunc0": "ShroudLenTrim", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&_buf", - "stmt1": "c_in_string_&_buf" - }, - "fmtf": { - "F_C_var": "nesting_mode", - "c_var": "nesting_mode", - "c_var_len": "SHT_nesting_mode_len", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "nesting_mode", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "f_in_string_&_buf", - "stmt1": "f_in_string_&_buf", - "stmtc0": "c_in_string_&_buf", - "stmtc1": "c_in_string_&_buf" - } + "fmtf": { + "F_C_var": "backend", + "c_var": "backend", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "backend", + "sh_type": "SH_TYPE_OTHER" + } + }, + "nesting_mode": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "nesting_mode", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_nesting_mode)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_nesting_mode", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&", + "stmt1": "c_in_string_&" + }, + "fmtf": { + "F_C_var": "nesting_mode", + "c_var": "nesting_mode", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "nesting_mode", + "sh_type": "SH_TYPE_OTHER" + } + } + }, + "zz_fmtdict": { + "C_call_list": "SHCXX_nesting_mode,\t SHCXX_backend", + "C_name": "nesmik_init", + "C_name_api": "init", + "C_prototype": "const char * nesting_mode,\t const char * backend", + "C_return_type": "void", + "F_C_arguments": "nesting_mode,\t backend", + "F_C_call": "c_init_bufferify", + "F_C_name": "c_init", + "F_C_subprogram": "subroutine", + "F_arg_c_call": "nesting_mode,\t SHT_nesting_mode_len,\t backend,\t SHT_backend_len", + "F_arguments": "nesting_mode,\t backend", + "F_name_api": "init", + "F_name_function": "init", + "F_name_generic": "init", + "F_name_impl": "init", + "F_subprogram": "subroutine", + "function_name": "init", + "stmt0": "f_subroutine", + "stmt1": "f_subroutine", + "stmtc0": "c_subroutine", + "stmtc1": "c_subroutine" + } + }, + { + "": "5 ****************************************", + "_generated": "arg_to_buffer", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" + }, + "name": "init", + "params": [ + { + "const": true, + "declarator": { + "metaattrs": { + "api": "buf", + "intent": "in" + }, + "name": "nesting_mode", + "pointer": [ + { + "ptr": "&" } + ], + "typemap_name": "std::string" }, - "zz_fmtdict": { - "C_call_list": "SHCXX_nesting_mode,\t SHCXX_backend", - "C_name": "nesmik_init_bufferify", - "C_name_api": "init", - "C_prototype": "char *nesting_mode,\t int SHT_nesting_mode_len,\t char *backend,\t int SHT_backend_len", - "C_return_type": "void", - "F_C_arguments": "nesting_mode,\t SHT_nesting_mode_len,\t backend,\t SHT_backend_len", - "F_C_name": "c_init_bufferify", - "F_C_subprogram": "subroutine", - "F_name_api": "init", - "function_name": "init", - "function_suffix": "_bufferify", - "stmt0": "c_subroutine", - "stmt1": "c_subroutine" - } - }, - { - "": "1 ****************************************", - "C_generated_path": [ - "arg_to_buffer" + "specifier": [ + "std::string" ], - "_PTR_F_C_index": "6", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "region_start", - "params": [ - { - "const": true, - "declarator": { - "metaattrs": { - "intent": "in" - }, - "name": "name", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - } - ], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void region_start(const std::string &name)", - "declgen": "void region_start(const std::string & name)", - "linenumber": 9, - "name": "region_start", - "options": {}, - "wrap": { - "c": true, - "fortran": true - }, - "zz_fmtargs": { - "name": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "name", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_name", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&", - "stmt1": "c_in_string_&" - }, - "fmtf": { - "F_C_var": "name", - "c_var": "name", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "name", - "sh_type": "SH_TYPE_OTHER" - } + "typemap_name": "std::string" + }, + { + "const": true, + "declarator": { + "metaattrs": { + "api": "buf", + "intent": "in" + }, + "name": "backend", + "pointer": [ + { + "ptr": "&" } + ], + "typemap_name": "std::string" }, - "zz_fmtdict": { - "C_call_list": "SHCXX_name", - "C_name": "nesmik_region_start", - "C_name_api": "region_start", - "C_prototype": "const char * name", - "C_return_type": "void", - "F_C_arguments": "name", - "F_C_call": "c_region_start_bufferify", - "F_C_name": "c_region_start", - "F_C_subprogram": "subroutine", - "F_arg_c_call": "name,\t SHT_name_len", - "F_arguments": "name", - "F_name_api": "region_start", - "F_name_function": "region_start", - "F_name_generic": "region_start", - "F_name_impl": "region_start", - "F_subprogram": "subroutine", - "function_name": "region_start", - "stmt0": "f_subroutine", - "stmt1": "f_subroutine", - "stmtc0": "c_subroutine", - "stmtc1": "c_subroutine" - } + "specifier": [ + "std::string" + ], + "typemap_name": "std::string" + } + ], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void init(const std::string &nesting_mode, const std::string &backend)", + "declgen": "void init(const std::string & nesting_mode, const std::string & backend)", + "linenumber": 8, + "name": "init", + "options": {}, + "splicer_group": "buf", + "wrap": { + "c": true, + "f_c": true + }, + "zz_fmtargs": { + "backend": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "backend", + "c_var_len": "SHT_backend_len", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_backend)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_backend", + "hnamefunc0": "ShroudLenTrim", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&_buf", + "stmt1": "c_in_string_&_buf" }, - { - "": "6 ****************************************", - "_PTR_C_CXX_index": "1", - "_generated": "arg_to_buffer", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "region_start", - "params": [ - { - "const": true, - "declarator": { - "metaattrs": { - "api": "buf", - "intent": "in" - }, - "name": "name", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - } - ], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void region_start(const std::string &name)", - "declgen": "void region_start(const std::string & name)", - "linenumber": 9, - "name": "region_start", - "options": {}, - "splicer_group": "buf", - "wrap": { - "c": true, - "f_c": true - }, - "zz_fmtargs": { - "name": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "name", - "c_var_len": "SHT_name_len", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_name", - "hnamefunc0": "ShroudLenTrim", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&_buf", - "stmt1": "c_in_string_&_buf" - }, - "fmtf": { - "F_C_var": "name", - "c_var": "name", - "c_var_len": "SHT_name_len", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "name", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "f_in_string_&_buf", - "stmt1": "f_in_string_&_buf", - "stmtc0": "c_in_string_&_buf", - "stmtc1": "c_in_string_&_buf" - } + "fmtf": { + "F_C_var": "backend", + "c_var": "backend", + "c_var_len": "SHT_backend_len", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "backend", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "f_in_string_&_buf", + "stmt1": "f_in_string_&_buf", + "stmtc0": "c_in_string_&_buf", + "stmtc1": "c_in_string_&_buf" + } + }, + "nesting_mode": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "nesting_mode", + "c_var_len": "SHT_nesting_mode_len", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_nesting_mode)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_nesting_mode", + "hnamefunc0": "ShroudLenTrim", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&_buf", + "stmt1": "c_in_string_&_buf" + }, + "fmtf": { + "F_C_var": "nesting_mode", + "c_var": "nesting_mode", + "c_var_len": "SHT_nesting_mode_len", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "nesting_mode", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "f_in_string_&_buf", + "stmt1": "f_in_string_&_buf", + "stmtc0": "c_in_string_&_buf", + "stmtc1": "c_in_string_&_buf" + } + } + }, + "zz_fmtdict": { + "C_call_list": "SHCXX_nesting_mode,\t SHCXX_backend", + "C_name": "nesmik_init_bufferify", + "C_name_api": "init", + "C_prototype": "char *nesting_mode,\t int SHT_nesting_mode_len,\t char *backend,\t int SHT_backend_len", + "C_return_type": "void", + "F_C_arguments": "nesting_mode,\t SHT_nesting_mode_len,\t backend,\t SHT_backend_len", + "F_C_name": "c_init_bufferify", + "F_C_subprogram": "subroutine", + "F_name_api": "init", + "function_name": "init", + "function_suffix": "_bufferify", + "stmt0": "c_subroutine", + "stmt1": "c_subroutine" + } + }, + { + "": "1 ****************************************", + "C_generated_path": [ + "arg_to_buffer" + ], + "_PTR_F_C_index": "6", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" + }, + "name": "region_start", + "params": [ + { + "const": true, + "declarator": { + "metaattrs": { + "intent": "in" + }, + "name": "name", + "pointer": [ + { + "ptr": "&" } + ], + "typemap_name": "std::string" }, - "zz_fmtdict": { - "C_call_list": "SHCXX_name", - "C_name": "nesmik_region_start_bufferify", - "C_name_api": "region_start", - "C_prototype": "char *name,\t int SHT_name_len", - "C_return_type": "void", - "F_C_arguments": "name,\t SHT_name_len", - "F_C_name": "c_region_start_bufferify", - "F_C_subprogram": "subroutine", - "F_name_api": "region_start", - "function_name": "region_start", - "function_suffix": "_bufferify", - "stmt0": "c_subroutine", - "stmt1": "c_subroutine" - } - }, - { - "": "2 ****************************************", - "C_generated_path": [ - "arg_to_buffer" + "specifier": [ + "std::string" ], - "_PTR_F_C_index": "7", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "region_stop", - "params": [ - { - "const": true, - "declarator": { - "metaattrs": { - "intent": "in" - }, - "name": "name", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - } - ], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void region_stop(const std::string &name)", - "declgen": "void region_stop(const std::string & name)", - "linenumber": 10, - "name": "region_stop", - "options": {}, - "wrap": { - "c": true, - "fortran": true - }, - "zz_fmtargs": { - "name": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "name", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_name", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&", - "stmt1": "c_in_string_&" - }, - "fmtf": { - "F_C_var": "name", - "c_var": "name", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "name", - "sh_type": "SH_TYPE_OTHER" - } + "typemap_name": "std::string" + } + ], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void region_start(const std::string &name)", + "declgen": "void region_start(const std::string & name)", + "linenumber": 9, + "name": "region_start", + "options": {}, + "wrap": { + "c": true, + "fortran": true + }, + "zz_fmtargs": { + "name": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "name", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_name", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&", + "stmt1": "c_in_string_&" + }, + "fmtf": { + "F_C_var": "name", + "c_var": "name", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "name", + "sh_type": "SH_TYPE_OTHER" + } + } + }, + "zz_fmtdict": { + "C_call_list": "SHCXX_name", + "C_name": "nesmik_region_start", + "C_name_api": "region_start", + "C_prototype": "const char * name", + "C_return_type": "void", + "F_C_arguments": "name", + "F_C_call": "c_region_start_bufferify", + "F_C_name": "c_region_start", + "F_C_subprogram": "subroutine", + "F_arg_c_call": "name,\t SHT_name_len", + "F_arguments": "name", + "F_name_api": "region_start", + "F_name_function": "region_start", + "F_name_generic": "region_start", + "F_name_impl": "region_start", + "F_subprogram": "subroutine", + "function_name": "region_start", + "stmt0": "f_subroutine", + "stmt1": "f_subroutine", + "stmtc0": "c_subroutine", + "stmtc1": "c_subroutine" + } + }, + { + "": "6 ****************************************", + "_PTR_C_CXX_index": "1", + "_generated": "arg_to_buffer", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" + }, + "name": "region_start", + "params": [ + { + "const": true, + "declarator": { + "metaattrs": { + "api": "buf", + "intent": "in" + }, + "name": "name", + "pointer": [ + { + "ptr": "&" } + ], + "typemap_name": "std::string" }, - "zz_fmtdict": { - "C_call_list": "SHCXX_name", - "C_name": "nesmik_region_stop", - "C_name_api": "region_stop", - "C_prototype": "const char * name", - "C_return_type": "void", - "F_C_arguments": "name", - "F_C_call": "c_region_stop_bufferify", - "F_C_name": "c_region_stop", - "F_C_subprogram": "subroutine", - "F_arg_c_call": "name,\t SHT_name_len", - "F_arguments": "name", - "F_name_api": "region_stop", - "F_name_function": "region_stop", - "F_name_generic": "region_stop", - "F_name_impl": "region_stop", - "F_subprogram": "subroutine", - "function_name": "region_stop", - "stmt0": "f_subroutine", - "stmt1": "f_subroutine", - "stmtc0": "c_subroutine", - "stmtc1": "c_subroutine" - } + "specifier": [ + "std::string" + ], + "typemap_name": "std::string" + } + ], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void region_start(const std::string &name)", + "declgen": "void region_start(const std::string & name)", + "linenumber": 9, + "name": "region_start", + "options": {}, + "splicer_group": "buf", + "wrap": { + "c": true, + "f_c": true + }, + "zz_fmtargs": { + "name": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "name", + "c_var_len": "SHT_name_len", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_name", + "hnamefunc0": "ShroudLenTrim", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&_buf", + "stmt1": "c_in_string_&_buf" }, - { - "": "7 ****************************************", - "_PTR_C_CXX_index": "2", - "_generated": "arg_to_buffer", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "region_stop", - "params": [ - { - "const": true, - "declarator": { - "metaattrs": { - "api": "buf", - "intent": "in" - }, - "name": "name", - "pointer": [ - { - "ptr": "&" - } - ], - "typemap_name": "std::string" - }, - "specifier": [ - "std::string" - ], - "typemap_name": "std::string" - } - ], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void region_stop(const std::string &name)", - "declgen": "void region_stop(const std::string & name)", - "linenumber": 10, - "name": "region_stop", - "options": {}, - "splicer_group": "buf", - "wrap": { - "c": true, - "f_c": true - }, - "zz_fmtargs": { - "name": { - "fmtc": { - "c_addr": "", - "c_const": "const ", - "c_deref": "*", - "c_member": "->", - "c_type": "char", - "c_var": "name", - "c_var_len": "SHT_name_len", - "cfi_type": "CFI_type_other", - "cxx_addr": "&", - "cxx_member": ".", - "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", - "cxx_type": "std::string", - "cxx_var": "SHCXX_name", - "hnamefunc0": "ShroudLenTrim", - "idtor": "0", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "c_in_string_&_buf", - "stmt1": "c_in_string_&_buf" - }, - "fmtf": { - "F_C_var": "name", - "c_var": "name", - "c_var_len": "SHT_name_len", - "f_intent": "IN", - "f_kind": "C_CHAR", - "f_type": "character(*)", - "f_var": "name", - "sh_type": "SH_TYPE_OTHER", - "stmt0": "f_in_string_&_buf", - "stmt1": "f_in_string_&_buf", - "stmtc0": "c_in_string_&_buf", - "stmtc1": "c_in_string_&_buf" - } + "fmtf": { + "F_C_var": "name", + "c_var": "name", + "c_var_len": "SHT_name_len", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "name", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "f_in_string_&_buf", + "stmt1": "f_in_string_&_buf", + "stmtc0": "c_in_string_&_buf", + "stmtc1": "c_in_string_&_buf" + } + } + }, + "zz_fmtdict": { + "C_call_list": "SHCXX_name", + "C_name": "nesmik_region_start_bufferify", + "C_name_api": "region_start", + "C_prototype": "char *name,\t int SHT_name_len", + "C_return_type": "void", + "F_C_arguments": "name,\t SHT_name_len", + "F_C_name": "c_region_start_bufferify", + "F_C_subprogram": "subroutine", + "F_name_api": "region_start", + "function_name": "region_start", + "function_suffix": "_bufferify", + "stmt0": "c_subroutine", + "stmt1": "c_subroutine" + } + }, + { + "": "2 ****************************************", + "C_generated_path": [ + "arg_to_buffer" + ], + "_PTR_F_C_index": "7", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" + }, + "name": "region_stop", + "params": [ + { + "const": true, + "declarator": { + "metaattrs": { + "intent": "in" + }, + "name": "name", + "pointer": [ + { + "ptr": "&" } + ], + "typemap_name": "std::string" }, - "zz_fmtdict": { - "C_call_list": "SHCXX_name", - "C_name": "nesmik_region_stop_bufferify", - "C_name_api": "region_stop", - "C_prototype": "char *name,\t int SHT_name_len", - "C_return_type": "void", - "F_C_arguments": "name,\t SHT_name_len", - "F_C_name": "c_region_stop_bufferify", - "F_C_subprogram": "subroutine", - "F_name_api": "region_stop", - "function_name": "region_stop", - "function_suffix": "_bufferify", - "stmt0": "c_subroutine", - "stmt1": "c_subroutine" - } + "specifier": [ + "std::string" + ], + "typemap_name": "std::string" + } + ], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void region_stop(const std::string &name)", + "declgen": "void region_stop(const std::string & name)", + "linenumber": 10, + "name": "region_stop", + "options": {}, + "wrap": { + "c": true, + "fortran": true + }, + "zz_fmtargs": { + "name": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "name", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_name", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&", + "stmt1": "c_in_string_&" }, - { - "": "3 ****************************************", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "region_stop_last", - "params": [], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void region_stop_last(void)", - "declgen": "void region_stop_last(void)", - "linenumber": 11, - "name": "region_stop_last", - "options": {}, - "wrap": { - "c": true, - "f_c": true, - "fortran": true - }, - "zz_fmtdict": { - "C_name": "nesmik_region_stop_last", - "C_name_api": "region_stop_last", - "C_prototype": "void", - "C_return_type": "void", - "F_C_arguments": "", - "F_C_call": "c_region_stop_last", - "F_C_name": "region_stop_last", - "F_C_subprogram": "subroutine", - "F_arguments": "", - "F_name_api": "region_stop_last", - "F_name_function": "region_stop_last", - "F_name_generic": "region_stop_last", - "F_name_impl": "region_stop_last", - "F_subprogram": "subroutine", - "function_name": "region_stop_last", - "stmt0": "f_subroutine", - "stmt1": "f_subroutine", - "stmtc0": "c_subroutine", - "stmtc1": "c_subroutine" - } + "fmtf": { + "F_C_var": "name", + "c_var": "name", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "name", + "sh_type": "SH_TYPE_OTHER" + } + } + }, + "zz_fmtdict": { + "C_call_list": "SHCXX_name", + "C_name": "nesmik_region_stop", + "C_name_api": "region_stop", + "C_prototype": "const char * name", + "C_return_type": "void", + "F_C_arguments": "name", + "F_C_call": "c_region_stop_bufferify", + "F_C_name": "c_region_stop", + "F_C_subprogram": "subroutine", + "F_arg_c_call": "name,\t SHT_name_len", + "F_arguments": "name", + "F_name_api": "region_stop", + "F_name_function": "region_stop", + "F_name_generic": "region_stop", + "F_name_impl": "region_stop", + "F_subprogram": "subroutine", + "function_name": "region_stop", + "stmt0": "f_subroutine", + "stmt1": "f_subroutine", + "stmtc0": "c_subroutine", + "stmtc1": "c_subroutine" + } + }, + { + "": "7 ****************************************", + "_PTR_C_CXX_index": "2", + "_generated": "arg_to_buffer", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" }, - { - "": "4 ****************************************", - "ast": { - "declarator": { - "metaattrs": { - "intent": "subroutine" - }, - "name": "finalize", - "params": [], - "typemap_name": "void" - }, - "specifier": [ - "void" - ], - "typemap_name": "void" - }, - "decl": "void finalize()", - "declgen": "void finalize(void)", - "linenumber": 12, - "name": "finalize", - "options": {}, - "wrap": { - "c": true, - "f_c": true, - "fortran": true + "name": "region_stop", + "params": [ + { + "const": true, + "declarator": { + "metaattrs": { + "api": "buf", + "intent": "in" + }, + "name": "name", + "pointer": [ + { + "ptr": "&" + } + ], + "typemap_name": "std::string" }, - "zz_fmtdict": { - "C_name": "nesmik_finalize", - "C_name_api": "finalize", - "C_prototype": "void", - "C_return_type": "void", - "F_C_arguments": "", - "F_C_call": "c_finalize", - "F_C_name": "finalize", - "F_C_subprogram": "subroutine", - "F_arguments": "", - "F_name_api": "finalize", - "F_name_function": "finalize", - "F_name_generic": "finalize", - "F_name_impl": "finalize", - "F_subprogram": "subroutine", - "function_name": "finalize", - "stmt0": "f_subroutine", - "stmt1": "f_subroutine", - "stmtc0": "c_subroutine", - "stmtc1": "c_subroutine" - } + "specifier": [ + "std::string" + ], + "typemap_name": "std::string" + } + ], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void region_stop(const std::string &name)", + "declgen": "void region_stop(const std::string & name)", + "linenumber": 10, + "name": "region_stop", + "options": {}, + "splicer_group": "buf", + "wrap": { + "c": true, + "f_c": true + }, + "zz_fmtargs": { + "name": { + "fmtc": { + "c_addr": "", + "c_const": "const ", + "c_deref": "*", + "c_member": "->", + "c_type": "char", + "c_var": "name", + "c_var_len": "SHT_name_len", + "cfi_type": "CFI_type_other", + "cxx_addr": "&", + "cxx_member": ".", + "cxx_nonconst_ptr": "const_cast\t(&SHCXX_name)", + "cxx_type": "std::string", + "cxx_var": "SHCXX_name", + "hnamefunc0": "ShroudLenTrim", + "idtor": "0", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "c_in_string_&_buf", + "stmt1": "c_in_string_&_buf" + }, + "fmtf": { + "F_C_var": "name", + "c_var": "name", + "c_var_len": "SHT_name_len", + "f_intent": "IN", + "f_kind": "C_CHAR", + "f_type": "character(*)", + "f_var": "name", + "sh_type": "SH_TYPE_OTHER", + "stmt0": "f_in_string_&_buf", + "stmt1": "f_in_string_&_buf", + "stmtc0": "c_in_string_&_buf", + "stmtc1": "c_in_string_&_buf" } - ], - "language": "cxx", - "options": { - "CXX_standard": 2011, - "C_API_case": "preserve", - "C_enum_member_template": "{C_prefix}{C_name_scope}{enum_member_name}", - "C_enum_template": "{C_prefix}{C_name_scope}{enum_name}", - "C_force_wrapper": false, - "C_header_filename_class_template": "wrap{file_scope}.{C_header_filename_suffix}", - "C_header_filename_library_template": "wrap{library}.{C_header_filename_suffix}", - "C_header_filename_namespace_template": "wrap{file_scope}.{C_header_filename_suffix}", - "C_header_utility_template": "types{library}.{C_header_filename_suffix}", - "C_impl_filename_class_template": "wrap{file_scope}.{C_impl_filename_suffix}", - "C_impl_filename_library_template": "wrap{library}.{C_impl_filename_suffix}", - "C_impl_filename_namespace_template": "wrap{file_scope}.{C_impl_filename_suffix}", - "C_impl_utility_template": "util{library}.{C_impl_filename_suffix}", - "C_line_length": 72, - "C_memory_dtor_function_template": "{C_prefix}SHROUD_memory_destructor", - "C_name_template": "{C_prefix}{C_name_scope}{C_name_api}{function_suffix}{template_suffix}", - "C_name_typedef_template": "{C_prefix}{C_name_scope}{typedef_name}", - "C_shadow_result": true, - "C_var_capsule_template": "C{c_var}", - "C_var_context_template": "D{c_var}", - "F_API_case": "underscore", - "F_CFI": false, - "F_C_name_template": "{F_C_prefix}{F_name_scope}{F_name_api}{function_suffix}{template_suffix}", - "F_abstract_interface_argument_template": "arg{index}", - "F_abstract_interface_subprogram_template": "{F_name_api}_{argname}", - "F_array_type_template": "{C_prefix}SHROUD_array", - "F_assumed_rank_max": 7, - "F_assumed_rank_min": 0, - "F_auto_reference_count": false, - "F_blanknull": false, - "F_capsule_data_type_template": "{C_prefix}SHROUD_capsule_data", - "F_capsule_type_template": "{C_prefix}SHROUD_capsule", - "F_create_bufferify_function": true, - "F_create_generic": true, - "F_default_args": "generic", - "F_derived_name_template": "{F_name_api}", - "F_enum_member_template": "{F_name_scope}{enum_member_lower}", - "F_flatten_namespace": false, - "F_force_wrapper": false, - "F_impl_filename_library_template": "wrapf{library_lower}.{F_filename_suffix}", - "F_impl_filename_namespace_template": "wrapf{file_scope}.{F_filename_suffix}", - "F_line_length": 72, - "F_module_name_library_template": "{library_lower}_mod", - "F_module_name_namespace_template": "{file_scope}_mod", - "F_name_function_template": "{F_name_api}{function_suffix}{template_suffix}", - "F_name_generic_template": "{F_name_api}", - "F_name_impl_template": "{F_name_scope}{F_name_api}{function_suffix}{template_suffix}", - "F_name_typedef_template": "{F_name_scope}{F_name_api}", - "F_return_fortran_pointer": true, - "F_standard": 2003, - "F_string_len_trim": true, - "F_struct_getter_setter": true, - "F_trim_char_in": true, - "LUA_API_case": "preserve", - "LUA_class_reg_template": "{LUA_prefix}{cxx_class}_Reg", - "LUA_ctor_name_template": "{cxx_class}", - "LUA_header_filename_template": "lua{library}module.{LUA_header_filename_suffix}", - "LUA_metadata_template": "{cxx_class}.metatable", - "LUA_module_filename_template": "lua{library}module.{LUA_impl_filename_suffix}", - "LUA_module_name_template": "{library_lower}", - "LUA_module_reg_template": "{LUA_prefix}{library}_Reg", - "LUA_name_impl_template": "{LUA_prefix}{C_name_scope}{LUA_name_api}", - "LUA_name_template": "{function_name}", - "LUA_userdata_member_template": "self", - "LUA_userdata_type_template": "{LUA_prefix}{cxx_class}_Type", - "PY_PyObject_template": "{PY_prefix}{cxx_class}", - "PY_PyTypeObject_template": "{PY_prefix}{cxx_class}_Type", - "PY_array_arg": "numpy", - "PY_capsule_destructor_function_template": "{PY_prefix}SHROUD_capsule_destructor", - "PY_create_generic": true, - "PY_dtor_context_array_template": "{PY_prefix}SHROUD_capsule_context", - "PY_dtor_context_typedef_template": "{PY_prefix}SHROUD_dtor_context", - "PY_fetch_context_function_template": "{PY_prefix}SHROUD_fetch_context", - "PY_header_filename_template": "py{library}module.{PY_header_filename_suffix}", - "PY_member_data_template": "{variable_name}_dataobj", - "PY_member_getter_template": "{PY_prefix}{cxx_class}_{variable_name}_getter", - "PY_member_object_template": "{variable_name}_obj", - "PY_member_setter_template": "{PY_prefix}{cxx_class}_{variable_name}_setter", - "PY_module_filename_template": "py{file_scope}module.{PY_impl_filename_suffix}", - "PY_name_impl_template": "{PY_prefix}{function_name}{function_suffix}{template_suffix}", - "PY_numpy_array_capsule_name_template": "{PY_prefix}array_dtor", - "PY_release_memory_function_template": "{PY_prefix}SHROUD_release_memory", - "PY_struct_arg": "numpy", - "PY_struct_array_descr_create_template": "{PY_prefix}{cxx_class}_create_array_descr", - "PY_struct_array_descr_name_template": "{cxx_class}_dtype", - "PY_struct_array_descr_variable_template": "{PY_prefix}{cxx_class}_array_descr", - "PY_type_filename_template": "py{file_scope}type.{PY_impl_filename_suffix}", - "PY_type_impl_template": "{PY_prefix}{cxx_class}_{PY_type_method}{function_suffix}{template_suffix}", - "PY_utility_filename_template": "py{library}util.{PY_impl_filename_suffix}", - "PY_write_helper_in_util": false, - "SH_class_getter_template": "get_{wrapped_name}", - "SH_class_setter_template": "set_{wrapped_name}", - "SH_struct_getter_template": "{struct_name}_get_{wrapped_name}", - "SH_struct_setter_template": "{struct_name}_set_{wrapped_name}", - "YAML_type_filename_template": "{library_lower}_types.yaml", - "class_baseclass": null, - "class_ctor": null, - "class_method": null, - "debug": false, - "debug_index": false, - "debug_testsuite": false, - "doxygen": true, - "flatten_namespace": false, - "literalinclude": false, - "literalinclude2": false, - "return_scalar_pointer": "pointer", - "show_splicer_comments": true, - "wrap_c": true, - "wrap_class_as": "class", - "wrap_fortran": true, - "wrap_lua": false, - "wrap_python": false, - "wrap_struct_as": "struct" + } }, - "scope_file": [ - "nesmik" - ], + "zz_fmtdict": { + "C_call_list": "SHCXX_name", + "C_name": "nesmik_region_stop_bufferify", + "C_name_api": "region_stop", + "C_prototype": "char *name,\t int SHT_name_len", + "C_return_type": "void", + "F_C_arguments": "name,\t SHT_name_len", + "F_C_name": "c_region_stop_bufferify", + "F_C_subprogram": "subroutine", + "F_name_api": "region_stop", + "function_name": "region_stop", + "function_suffix": "_bufferify", + "stmt0": "c_subroutine", + "stmt1": "c_subroutine" + } + }, + { + "": "3 ****************************************", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" + }, + "name": "region_stop_last", + "params": [], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void region_stop_last(void)", + "declgen": "void region_stop_last(void)", + "linenumber": 11, + "name": "region_stop_last", + "options": {}, + "wrap": { + "c": true, + "f_c": true, + "fortran": true + }, + "zz_fmtdict": { + "C_name": "nesmik_region_stop_last", + "C_name_api": "region_stop_last", + "C_prototype": "void", + "C_return_type": "void", + "F_C_arguments": "", + "F_C_call": "c_region_stop_last", + "F_C_name": "region_stop_last", + "F_C_subprogram": "subroutine", + "F_arguments": "", + "F_name_api": "region_stop_last", + "F_name_function": "region_stop_last", + "F_name_generic": "region_stop_last", + "F_name_impl": "region_stop_last", + "F_subprogram": "subroutine", + "function_name": "region_stop_last", + "stmt0": "f_subroutine", + "stmt1": "f_subroutine", + "stmtc0": "c_subroutine", + "stmtc1": "c_subroutine" + } + }, + { + "": "4 ****************************************", + "ast": { + "declarator": { + "metaattrs": { + "intent": "subroutine" + }, + "name": "finalize", + "params": [], + "typemap_name": "void" + }, + "specifier": [ + "void" + ], + "typemap_name": "void" + }, + "decl": "void finalize()", + "declgen": "void finalize(void)", + "linenumber": 12, + "name": "finalize", + "options": {}, "wrap": { - "c": true, - "fortran": true + "c": true, + "f_c": true, + "fortran": true }, "zz_fmtdict": { - "CXX_local": "SHCXX_", - "CXX_template": "", - "CXX_this": "SH_this", - "CXX_this_call": "", - "C_array_type": "nesmik_SHROUD_array", - "C_bufferify_suffix": "_bufferify", - "C_call_list": "", - "C_capsule_data_type": "nesmik_SHROUD_capsule_data", - "C_cfi_suffix": "_CFI", - "C_custom_return_type": "", - "C_header_filename": "wrapnesmik.h", - "C_header_filename_suffix": "h", - "C_header_utility": "typesnesmik.h", - "C_impl_filename": "wrapnesmik.cpp", - "C_impl_filename_suffix": "cpp", - "C_impl_utility": "utilnesmik.cpp", - "C_local": "SHC_", - "C_memory_dtor_function": "nesmik_SHROUD_memory_destructor", - "C_name_scope": "", - "C_name_typedef": "", - "C_post_call": "", - "C_pre_call": "", - "C_prefix": "nesmik_", - "C_result": "rv", - "C_string_result_as_arg": "SHF_rv", - "C_this": "self", - "F_C_name": "-F_C_name-", - "F_C_prefix": "c_", - "F_C_pure_clause": "", - "F_C_result_clause": "", - "F_arg_c_call": "", - "F_array_type": "nesmik_SHROUD_array", - "F_capsule_data_type": "nesmik_SHROUD_capsule_data", - "F_capsule_delete_function": "SHROUD_capsule_delete", - "F_capsule_final_function": "SHROUD_capsule_final", - "F_capsule_type": "nesmik_SHROUD_capsule", - "F_derived_member": "cxxmem", - "F_derived_member_base": "", - "F_filename_suffix": "f", - "F_impl_filename": "wrapfnesmik.f", - "F_module_name": "nesmik_mod", - "F_name_assign": "assign", - "F_name_associated": "associated", - "F_name_final": "final", - "F_name_instance_get": "get_instance", - "F_name_instance_set": "set_instance", - "F_name_scope": "", - "F_name_typedef": "", - "F_pure_clause": "", - "F_result": "SHT_rv", - "F_result_clause": "", - "F_result_ptr": "SHT_prv", - "F_string_result_as_arg": "", - "F_this": "obj", - "LUA_header_filename_suffix": "hpp", - "LUA_impl_filename_suffix": "cpp", - "LUA_prefix": "l_", - "LUA_result": "rv", - "LUA_state_var": "L", - "LUA_this_call": "", - "PY_ARRAY_UNIQUE_SYMBOL": "SHROUD_NESMIK_ARRAY_API", - "PY_capsule_destructor_function": "PY_SHROUD_capsule_destructor", - "PY_dtor_context_array": "PY_SHROUD_capsule_context", - "PY_dtor_context_typedef": "PY_SHROUD_dtor_context", - "PY_fetch_context_function": "PY_SHROUD_fetch_context", - "PY_helper_prefix": "SHROUD_", - "PY_helper_static": "static ", - "PY_module_init": "nesmik", - "PY_module_name": "nesmik", - "PY_module_scope": "nesmik", - "PY_numpy_array_capsule_name": "PY_array_dtor", - "PY_prefix": "PY_", - "PY_release_memory_function": "PY_SHROUD_release_memory", - "PY_result": "SHTPy_rv", - "PY_this_call": "", - "PY_type_dtor": "idtor", - "PY_type_obj": "obj", - "PY_typedef_converter": "NES_SHROUD_converter_value", - "PY_value_init": "{NULL, NULL, NULL, NULL, 0}", - "YAML_type_filename": "nesmik_types.yaml", - "__line__": 4, - "c_array_shape": "", - "c_array_size": "1", - "c_blanknull": "0", - "c_char_len": "0", - "c_temp": "SHT_", - "c_temp_extents_decl": "", - "c_temp_extents_use": "NULL", - "c_temp_lower_decl": "", - "c_temp_lower_use": "NULL", - "cast1": ">\t(", - "cast2": ")", - "cast_const": "const_cast<", - "cast_reinterpret": "reinterpret_cast<", - "cast_static": "static_cast<", - "class_scope": "", - "cxx_class": "", - "f_array_allocate": "", - "f_array_shape": "", - "f_assumed_shape": "", - "f_c_dimension": "", - "f_char_len": ":", - "f_char_type": "", - "f_declare_shape_array": "", - "f_declare_shape_prefix": "SHAPE_", - "f_get_shape_array": "", - "f_intent": "", - "f_kind": "", - "f_shape_var": "", - "f_type": "", - "f_var_shape": "", - "file_scope": "nesmik", - "function_suffix": "", - "library": "nesmik", - "library_lower": "nesmik", - "library_upper": "NESMIK", - "namespace_scope": "", - "nullptr": "nullptr", - "rank": "0", - "stdlib": "std::", - "template_suffix": "", - "void_proto": "" + "C_name": "nesmik_finalize", + "C_name_api": "finalize", + "C_prototype": "void", + "C_return_type": "void", + "F_C_arguments": "", + "F_C_call": "c_finalize", + "F_C_name": "finalize", + "F_C_subprogram": "subroutine", + "F_arguments": "", + "F_name_api": "finalize", + "F_name_function": "finalize", + "F_name_generic": "finalize", + "F_name_impl": "finalize", + "F_subprogram": "subroutine", + "function_name": "finalize", + "stmt0": "f_subroutine", + "stmt1": "f_subroutine", + "stmtc0": "c_subroutine", + "stmtc1": "c_subroutine" } + } + ], + "language": "cxx", + "options": { + "CXX_standard": 2011, + "C_API_case": "preserve", + "C_enum_member_template": "{C_prefix}{C_name_scope}{enum_member_name}", + "C_enum_template": "{C_prefix}{C_name_scope}{enum_name}", + "C_force_wrapper": false, + "C_header_filename_class_template": "wrap{file_scope}.{C_header_filename_suffix}", + "C_header_filename_library_template": "wrap{library}.{C_header_filename_suffix}", + "C_header_filename_namespace_template": "wrap{file_scope}.{C_header_filename_suffix}", + "C_header_utility_template": "types{library}.{C_header_filename_suffix}", + "C_impl_filename_class_template": "wrap{file_scope}.{C_impl_filename_suffix}", + "C_impl_filename_library_template": "wrap{library}.{C_impl_filename_suffix}", + "C_impl_filename_namespace_template": "wrap{file_scope}.{C_impl_filename_suffix}", + "C_impl_utility_template": "util{library}.{C_impl_filename_suffix}", + "C_line_length": 72, + "C_memory_dtor_function_template": "{C_prefix}SHROUD_memory_destructor", + "C_name_template": "{C_prefix}{C_name_scope}{C_name_api}{function_suffix}{template_suffix}", + "C_name_typedef_template": "{C_prefix}{C_name_scope}{typedef_name}", + "C_shadow_result": true, + "C_var_capsule_template": "C{c_var}", + "C_var_context_template": "D{c_var}", + "F_API_case": "underscore", + "F_CFI": false, + "F_C_name_template": "{F_C_prefix}{F_name_scope}{F_name_api}{function_suffix}{template_suffix}", + "F_abstract_interface_argument_template": "arg{index}", + "F_abstract_interface_subprogram_template": "{F_name_api}_{argname}", + "F_array_type_template": "{C_prefix}SHROUD_array", + "F_assumed_rank_max": 7, + "F_assumed_rank_min": 0, + "F_auto_reference_count": false, + "F_blanknull": false, + "F_capsule_data_type_template": "{C_prefix}SHROUD_capsule_data", + "F_capsule_type_template": "{C_prefix}SHROUD_capsule", + "F_create_bufferify_function": true, + "F_create_generic": true, + "F_default_args": "generic", + "F_derived_name_template": "{F_name_api}", + "F_enum_member_template": "{F_name_scope}{enum_member_lower}", + "F_flatten_namespace": false, + "F_force_wrapper": false, + "F_impl_filename_library_template": "wrapf{library_lower}.{F_filename_suffix}", + "F_impl_filename_namespace_template": "wrapf{file_scope}.{F_filename_suffix}", + "F_line_length": 72, + "F_module_name_library_template": "{library_lower}_mod", + "F_module_name_namespace_template": "{file_scope}_mod", + "F_name_function_template": "{F_name_api}{function_suffix}{template_suffix}", + "F_name_generic_template": "{F_name_api}", + "F_name_impl_template": "{F_name_scope}{F_name_api}{function_suffix}{template_suffix}", + "F_name_typedef_template": "{F_name_scope}{F_name_api}", + "F_return_fortran_pointer": true, + "F_standard": 2003, + "F_string_len_trim": true, + "F_struct_getter_setter": true, + "F_trim_char_in": true, + "LUA_API_case": "preserve", + "LUA_class_reg_template": "{LUA_prefix}{cxx_class}_Reg", + "LUA_ctor_name_template": "{cxx_class}", + "LUA_header_filename_template": "lua{library}module.{LUA_header_filename_suffix}", + "LUA_metadata_template": "{cxx_class}.metatable", + "LUA_module_filename_template": "lua{library}module.{LUA_impl_filename_suffix}", + "LUA_module_name_template": "{library_lower}", + "LUA_module_reg_template": "{LUA_prefix}{library}_Reg", + "LUA_name_impl_template": "{LUA_prefix}{C_name_scope}{LUA_name_api}", + "LUA_name_template": "{function_name}", + "LUA_userdata_member_template": "self", + "LUA_userdata_type_template": "{LUA_prefix}{cxx_class}_Type", + "PY_PyObject_template": "{PY_prefix}{cxx_class}", + "PY_PyTypeObject_template": "{PY_prefix}{cxx_class}_Type", + "PY_array_arg": "numpy", + "PY_capsule_destructor_function_template": "{PY_prefix}SHROUD_capsule_destructor", + "PY_create_generic": true, + "PY_dtor_context_array_template": "{PY_prefix}SHROUD_capsule_context", + "PY_dtor_context_typedef_template": "{PY_prefix}SHROUD_dtor_context", + "PY_fetch_context_function_template": "{PY_prefix}SHROUD_fetch_context", + "PY_header_filename_template": "py{library}module.{PY_header_filename_suffix}", + "PY_member_data_template": "{variable_name}_dataobj", + "PY_member_getter_template": "{PY_prefix}{cxx_class}_{variable_name}_getter", + "PY_member_object_template": "{variable_name}_obj", + "PY_member_setter_template": "{PY_prefix}{cxx_class}_{variable_name}_setter", + "PY_module_filename_template": "py{file_scope}module.{PY_impl_filename_suffix}", + "PY_name_impl_template": "{PY_prefix}{function_name}{function_suffix}{template_suffix}", + "PY_numpy_array_capsule_name_template": "{PY_prefix}array_dtor", + "PY_release_memory_function_template": "{PY_prefix}SHROUD_release_memory", + "PY_struct_arg": "numpy", + "PY_struct_array_descr_create_template": "{PY_prefix}{cxx_class}_create_array_descr", + "PY_struct_array_descr_name_template": "{cxx_class}_dtype", + "PY_struct_array_descr_variable_template": "{PY_prefix}{cxx_class}_array_descr", + "PY_type_filename_template": "py{file_scope}type.{PY_impl_filename_suffix}", + "PY_type_impl_template": "{PY_prefix}{cxx_class}_{PY_type_method}{function_suffix}{template_suffix}", + "PY_utility_filename_template": "py{library}util.{PY_impl_filename_suffix}", + "PY_write_helper_in_util": false, + "SH_class_getter_template": "get_{wrapped_name}", + "SH_class_setter_template": "set_{wrapped_name}", + "SH_struct_getter_template": "{struct_name}_get_{wrapped_name}", + "SH_struct_setter_template": "{struct_name}_set_{wrapped_name}", + "YAML_type_filename_template": "{library_lower}_types.yaml", + "class_baseclass": null, + "class_ctor": null, + "class_method": null, + "debug": false, + "debug_index": false, + "debug_testsuite": false, + "doxygen": true, + "flatten_namespace": false, + "literalinclude": false, + "literalinclude2": false, + "return_scalar_pointer": "pointer", + "show_splicer_comments": true, + "wrap_c": true, + "wrap_class_as": "class", + "wrap_fortran": true, + "wrap_lua": false, + "wrap_python": false, + "wrap_struct_as": "struct" + }, + "scope_file": [ + "nesmik" + ], + "wrap": { + "c": true, + "fortran": true + }, + "zz_fmtdict": { + "CXX_local": "SHCXX_", + "CXX_template": "", + "CXX_this": "SH_this", + "CXX_this_call": "", + "C_array_type": "nesmik_SHROUD_array", + "C_bufferify_suffix": "_bufferify", + "C_call_list": "", + "C_capsule_data_type": "nesmik_SHROUD_capsule_data", + "C_cfi_suffix": "_CFI", + "C_custom_return_type": "", + "C_header_filename": "wrapnesmik.h", + "C_header_filename_suffix": "h", + "C_header_utility": "typesnesmik.h", + "C_impl_filename": "wrapnesmik.cpp", + "C_impl_filename_suffix": "cpp", + "C_impl_utility": "utilnesmik.cpp", + "C_local": "SHC_", + "C_memory_dtor_function": "nesmik_SHROUD_memory_destructor", + "C_name_scope": "", + "C_name_typedef": "", + "C_post_call": "", + "C_pre_call": "", + "C_prefix": "nesmik_", + "C_result": "rv", + "C_string_result_as_arg": "SHF_rv", + "C_this": "self", + "F_C_name": "-F_C_name-", + "F_C_prefix": "c_", + "F_C_pure_clause": "", + "F_C_result_clause": "", + "F_arg_c_call": "", + "F_array_type": "nesmik_SHROUD_array", + "F_capsule_data_type": "nesmik_SHROUD_capsule_data", + "F_capsule_delete_function": "SHROUD_capsule_delete", + "F_capsule_final_function": "SHROUD_capsule_final", + "F_capsule_type": "nesmik_SHROUD_capsule", + "F_derived_member": "cxxmem", + "F_derived_member_base": "", + "F_filename_suffix": "f", + "F_impl_filename": "wrapfnesmik.f", + "F_module_name": "nesmik_mod", + "F_name_assign": "assign", + "F_name_associated": "associated", + "F_name_final": "final", + "F_name_instance_get": "get_instance", + "F_name_instance_set": "set_instance", + "F_name_scope": "", + "F_name_typedef": "", + "F_pure_clause": "", + "F_result": "SHT_rv", + "F_result_clause": "", + "F_result_ptr": "SHT_prv", + "F_string_result_as_arg": "", + "F_this": "obj", + "LUA_header_filename_suffix": "hpp", + "LUA_impl_filename_suffix": "cpp", + "LUA_prefix": "l_", + "LUA_result": "rv", + "LUA_state_var": "L", + "LUA_this_call": "", + "PY_ARRAY_UNIQUE_SYMBOL": "SHROUD_NESMIK_ARRAY_API", + "PY_capsule_destructor_function": "PY_SHROUD_capsule_destructor", + "PY_dtor_context_array": "PY_SHROUD_capsule_context", + "PY_dtor_context_typedef": "PY_SHROUD_dtor_context", + "PY_fetch_context_function": "PY_SHROUD_fetch_context", + "PY_helper_prefix": "SHROUD_", + "PY_helper_static": "static ", + "PY_module_init": "nesmik", + "PY_module_name": "nesmik", + "PY_module_scope": "nesmik", + "PY_numpy_array_capsule_name": "PY_array_dtor", + "PY_prefix": "PY_", + "PY_release_memory_function": "PY_SHROUD_release_memory", + "PY_result": "SHTPy_rv", + "PY_this_call": "", + "PY_type_dtor": "idtor", + "PY_type_obj": "obj", + "PY_typedef_converter": "NES_SHROUD_converter_value", + "PY_value_init": "{NULL, NULL, NULL, NULL, 0}", + "YAML_type_filename": "nesmik_types.yaml", + "__line__": 4, + "c_array_shape": "", + "c_array_size": "1", + "c_blanknull": "0", + "c_char_len": "0", + "c_temp": "SHT_", + "c_temp_extents_decl": "", + "c_temp_extents_use": "NULL", + "c_temp_lower_decl": "", + "c_temp_lower_use": "NULL", + "cast1": ">\t(", + "cast2": ")", + "cast_const": "const_cast<", + "cast_reinterpret": "reinterpret_cast<", + "cast_static": "static_cast<", + "class_scope": "", + "cxx_class": "", + "f_array_allocate": "", + "f_array_shape": "", + "f_assumed_shape": "", + "f_c_dimension": "", + "f_char_len": ":", + "f_char_type": "", + "f_declare_shape_array": "", + "f_declare_shape_prefix": "SHAPE_", + "f_get_shape_array": "", + "f_intent": "", + "f_kind": "", + "f_shape_var": "", + "f_type": "", + "f_var_shape": "", + "file_scope": "nesmik", + "function_suffix": "", + "library": "nesmik", + "library_lower": "nesmik", + "library_upper": "NESMIK", + "namespace_scope": "", + "nullptr": "nullptr", + "rank": "0", + "stdlib": "std::", + "template_suffix": "", + "void_proto": "" } -} \ No newline at end of file + } +} diff --git a/src/bindings/nesmik.yaml b/src/bindings/nesmik.yaml index eb9d6b544114c44908e6bfdfaf841c1a7a5a3613..57662bedd9695e7fcb5e46a4a0fb4b2120636079 100644 --- a/src/bindings/nesmik.yaml +++ b/src/bindings/nesmik.yaml @@ -9,4 +9,4 @@ declarations: - decl: void region_start(const std::string &name) - decl: void region_stop(const std::string &name) - decl: void region_stop_last(void) -- decl: void finalize() \ No newline at end of file +- decl: void finalize() diff --git a/src/bindings/typesnesmik.h b/src/bindings/typesnesmik.h index f0cf83a4dc6b4cb225965e63558eaf9bd6205d77..579ec89b8fdc1501db76cb29b02ebf75aafacf75 100644 --- a/src/bindings/typesnesmik.h +++ b/src/bindings/typesnesmik.h @@ -17,8 +17,8 @@ extern "C" { // helper capsule_data_helper struct s_nesmik_SHROUD_capsule_data { - void *addr; /* address of C++ memory */ - int idtor; /* index of destructor */ + void *addr; /* address of C++ memory */ + int idtor; /* index of destructor */ }; typedef struct s_nesmik_SHROUD_capsule_data nesmik_SHROUD_capsule_data; diff --git a/src/bindings/utilnesmik.cpp b/src/bindings/utilnesmik.cpp index ab15c6f8010af3f04ba4efdc1627b375de97303d..d81afb744f503fba3eaed5a03aca4ab31575f65c 100644 --- a/src/bindings/utilnesmik.cpp +++ b/src/bindings/utilnesmik.cpp @@ -3,16 +3,14 @@ #include "typesnesmik.h" - #ifdef __cplusplus extern "C" { #endif // Release library allocated memory. -void nesmik_SHROUD_memory_destructor(nesmik_SHROUD_capsule_data *cap) -{ - cap->addr = nullptr; - cap->idtor = 0; // avoid deleting again +void nesmik_SHROUD_memory_destructor(nesmik_SHROUD_capsule_data *cap) { + cap->addr = nullptr; + cap->idtor = 0; // avoid deleting again } #ifdef __cplusplus diff --git a/src/bindings/wrapnesmik.cpp b/src/bindings/wrapnesmik.cpp index 7940f9cc96f3469d00e9566c7da89cf657b8b2b2..91d2230555ed30fe8247c438d304845499feec0b 100644 --- a/src/bindings/wrapnesmik.cpp +++ b/src/bindings/wrapnesmik.cpp @@ -1,101 +1,92 @@ // wrapnesmik.cpp // This file is generated by Shroud 0.13.0. Do not edit. -#include "nesmik/nesmik.hpp" -#include #include "wrapnesmik.h" +#include + +#include "nesmik/nesmik.hpp" + // splicer begin CXX_definitions // splicer end CXX_definitions extern "C" { - // helper ShroudLenTrim // Returns the length of character string src with length nsrc, // ignoring any trailing blanks. static int ShroudLenTrim(const char *src, int nsrc) { - int i; + int i; - for (i = nsrc - 1; i >= 0; i--) { - if (src[i] != ' ') { - break; - } + for (i = nsrc - 1; i >= 0; i--) { + if (src[i] != ' ') { + break; } + } - return i + 1; + return i + 1; } // splicer begin C_definitions // splicer end C_definitions -void nesmik_init(const char * nesting_mode, const char * backend) -{ - // splicer begin function.init - const std::string SHCXX_nesting_mode(nesting_mode); - const std::string SHCXX_backend(backend); - nesmik::init(SHCXX_nesting_mode, SHCXX_backend); - // splicer end function.init +void nesmik_init(const char *nesting_mode, const char *backend) { + // splicer begin function.init + const std::string SHCXX_nesting_mode(nesting_mode); + const std::string SHCXX_backend(backend); + nesmik::init(SHCXX_nesting_mode, SHCXX_backend); + // splicer end function.init } void nesmik_init_bufferify(char *nesting_mode, int SHT_nesting_mode_len, - char *backend, int SHT_backend_len) -{ - // splicer begin function.init_bufferify - const std::string SHCXX_nesting_mode(nesting_mode, - ShroudLenTrim(nesting_mode, SHT_nesting_mode_len)); - const std::string SHCXX_backend(backend, - ShroudLenTrim(backend, SHT_backend_len)); - nesmik::init(SHCXX_nesting_mode, SHCXX_backend); - // splicer end function.init_bufferify + char *backend, int SHT_backend_len) { + // splicer begin function.init_bufferify + const std::string SHCXX_nesting_mode( + nesting_mode, ShroudLenTrim(nesting_mode, SHT_nesting_mode_len)); + const std::string SHCXX_backend(backend, + ShroudLenTrim(backend, SHT_backend_len)); + nesmik::init(SHCXX_nesting_mode, SHCXX_backend); + // splicer end function.init_bufferify } -void nesmik_region_start(const char * name) -{ - // splicer begin function.region_start - const std::string SHCXX_name(name); - nesmik::region_start(SHCXX_name); - // splicer end function.region_start +void nesmik_region_start(const char *name) { + // splicer begin function.region_start + const std::string SHCXX_name(name); + nesmik::region_start(SHCXX_name); + // splicer end function.region_start } -void nesmik_region_start_bufferify(char *name, int SHT_name_len) -{ - // splicer begin function.region_start_bufferify - const std::string SHCXX_name(name, - ShroudLenTrim(name, SHT_name_len)); - nesmik::region_start(SHCXX_name); - // splicer end function.region_start_bufferify +void nesmik_region_start_bufferify(char *name, int SHT_name_len) { + // splicer begin function.region_start_bufferify + const std::string SHCXX_name(name, ShroudLenTrim(name, SHT_name_len)); + nesmik::region_start(SHCXX_name); + // splicer end function.region_start_bufferify } -void nesmik_region_stop(const char * name) -{ - // splicer begin function.region_stop - const std::string SHCXX_name(name); - nesmik::region_stop(SHCXX_name); - // splicer end function.region_stop +void nesmik_region_stop(const char *name) { + // splicer begin function.region_stop + const std::string SHCXX_name(name); + nesmik::region_stop(SHCXX_name); + // splicer end function.region_stop } -void nesmik_region_stop_bufferify(char *name, int SHT_name_len) -{ - // splicer begin function.region_stop_bufferify - const std::string SHCXX_name(name, - ShroudLenTrim(name, SHT_name_len)); - nesmik::region_stop(SHCXX_name); - // splicer end function.region_stop_bufferify +void nesmik_region_stop_bufferify(char *name, int SHT_name_len) { + // splicer begin function.region_stop_bufferify + const std::string SHCXX_name(name, ShroudLenTrim(name, SHT_name_len)); + nesmik::region_stop(SHCXX_name); + // splicer end function.region_stop_bufferify } -void nesmik_region_stop_last(void) -{ - // splicer begin function.region_stop_last - nesmik::region_stop_last(); - // splicer end function.region_stop_last +void nesmik_region_stop_last(void) { + // splicer begin function.region_stop_last + nesmik::region_stop_last(); + // splicer end function.region_stop_last } -void nesmik_finalize(void) -{ - // splicer begin function.finalize - nesmik::finalize(); - // splicer end function.finalize +void nesmik_finalize(void) { + // splicer begin function.finalize + nesmik::finalize(); + // splicer end function.finalize } } // extern "C" diff --git a/src/bindings/wrapnesmik.h b/src/bindings/wrapnesmik.h index ec1afc648d047c30020afcacdbe189563a3db55e..80e85cfa474bb2fc83c155f8762fac4e2870f6f6 100644 --- a/src/bindings/wrapnesmik.h +++ b/src/bindings/wrapnesmik.h @@ -21,16 +21,16 @@ extern "C" { // splicer begin C_declarations // splicer end C_declarations -void nesmik_init(const char * nesting_mode, const char * backend); +void nesmik_init(const char *nesting_mode, const char *backend); void nesmik_init_bufferify(char *nesting_mode, int SHT_nesting_mode_len, - char *backend, int SHT_backend_len); + char *backend, int SHT_backend_len); -void nesmik_region_start(const char * name); +void nesmik_region_start(const char *name); void nesmik_region_start_bufferify(char *name, int SHT_name_len); -void nesmik_region_stop(const char * name); +void nesmik_region_stop(const char *name); void nesmik_region_stop_bufferify(char *name, int SHT_name_len); diff --git a/src/delegator.cpp b/src/delegator.cpp index 72958f7843336c57b7d27e2b6d0e9aad7dc32d6e..ea73f973363c0211b307824be7c3f6a5259f298c 100644 --- a/src/delegator.cpp +++ b/src/delegator.cpp @@ -1,16 +1,14 @@ -#include -#include - +#include #include #include - -#include "backends/default/default.hpp" -#include "backends/detection/detection.hpp" -#include #include #include - +#include #include +#include + +#include "backends/default/default.hpp" +#include "backends/detection/detection.hpp" #ifdef ENABLE_DLB #include "backends/dlb/dlb/dlb.hpp" #include "backends/dlb/dlb_talp_tree/dlb_talp_tree.hpp" @@ -64,7 +62,6 @@ void Delegator::InitProperlyNestedBackends(const std::string_view backend) { } void Delegator::Init(std::string_view nesting_mode, std::string_view backend) { - std::cout << nesting_mode << "Backend:" << backend << std::endl; // detect nesting mode requested by the user @@ -78,120 +75,121 @@ void Delegator::Init(std::string_view nesting_mode, std::string_view backend) { // Some debug output switch (nesting_mode_) { - case NestingMode::Detection: - std::cout << "Selecting nesting mode to: " - << "detecting nesting behavior" << std::endl; - break; - case NestingMode::NotProperlyNested: - std::cout << "Selecting nesting mode to: " - << "non properly nested behavior" << std::endl; - break; - case NestingMode::ProperlyNested: - std::cout << "Selecting nesting mode to: " - << "assume properly nested behavior" << std::endl; - break; - } - - if (stringsAreCaseInsensitiveEqual("ENV",std::string(backend))) { - // We instanciate the variable here, because its only required if the - // backend is set to "env". - EnvironmentVariable env_backend = EnvironmentVariable< - std::string>( - "BACKEND", - "Set the backend to use, when init with \"env\" backend name.", - true); - - // Unwraping the std::optional is safe because the variable is required. - backend = env_backend.getValue().value(); + case NestingMode::Detection: + std::cout << "Selecting nesting mode to: " + << "detecting nesting behavior" << std::endl; + break; + case NestingMode::NotProperlyNested: + std::cout << "Selecting nesting mode to: " + << "non properly nested behavior" << std::endl; + break; + case NestingMode::ProperlyNested: + std::cout << "Selecting nesting mode to: " + << "assume properly nested behavior" << std::endl; + break; + } + + if (stringsAreCaseInsensitiveEqual("ENV", std::string(backend))) { + // We instantiate the variable here, because its only required if the + // backend is set to "env". + EnvironmentVariable env_backend = + EnvironmentVariable( + "BACKEND", + "Set the backend to use, when init with \"env\" backend name.", + true); + + // Unwraping the std::optional is safe because the variable is required. + backend = env_backend.getValue().value(); } // next choose backend switch (nesting_mode_) { - case NestingMode::Detection: - InitDetectionBackend(backend); - break; - case NestingMode::ProperlyNested: - case NestingMode::NotProperlyNested: - // we preferably use a Propely nested backend, - // but if this is not possible, we will select the not properly nested one - InitProperlyNestedBackends(backend); - if (pn_annotation_strategy_ == nullptr) { - std::cout << "No ProperlyNested backend found, proceeding with Not " - "Properly Nested Backend" - << std::endl; - InitNonProperlyNestedBackends(backend); - nesting_mode_ = NestingMode::NotProperlyNested; - } - break; + case NestingMode::Detection: + InitDetectionBackend(backend); + break; + case NestingMode::ProperlyNested: + case NestingMode::NotProperlyNested: + // we preferably use a Properly nested backend, + // but if this is not possible, we will select the not properly nested + // one + InitProperlyNestedBackends(backend); + if (pn_annotation_strategy_ == nullptr) { + std::cout << "No ProperlyNested backend found, proceeding with Not " + "Properly Nested Backend" + << std::endl; + InitNonProperlyNestedBackends(backend); + nesting_mode_ = NestingMode::NotProperlyNested; + } + break; } switch (nesting_mode_) { - - case NestingMode::NotProperlyNested: - return npn_annotation_strategy_->Init(); - break; - case NestingMode::Detection: - case NestingMode::ProperlyNested: - return pn_annotation_strategy_->Init(); - break; + case NestingMode::NotProperlyNested: + return npn_annotation_strategy_->Init(); + break; + case NestingMode::Detection: + case NestingMode::ProperlyNested: + return pn_annotation_strategy_->Init(); + break; } } // should be thread safe to call? void Delegator::RegionStart(std::string_view name) { - - switch (nesting_mode_) { - case NestingMode::NotProperlyNested: - return npn_annotation_strategy_->RegionStart({name}); - case NestingMode::Detection: - case NestingMode::ProperlyNested: - // First push to stack - name_stack_.push(std::string(name)); - return pn_annotation_strategy_->RegionStart({name, name_stack_}); - break; + case NestingMode::NotProperlyNested: + return npn_annotation_strategy_->RegionStart({name}); + case NestingMode::Detection: + case NestingMode::ProperlyNested: + // First push to stack + name_stack_.push(std::string(name)); + return pn_annotation_strategy_->RegionStart({name, name_stack_}); + break; } } void Delegator::RegionStop(std::string_view name) { switch (nesting_mode_) { - - case NestingMode::NotProperlyNested: - return npn_annotation_strategy_->RegionStop({name}); - break; - case NestingMode::Detection: - case NestingMode::ProperlyNested: - pn_annotation_strategy_->RegionStopLast({name,name_stack_}); - if(!name_stack_.empty()) {name_stack_.pop();} - break; + case NestingMode::NotProperlyNested: + return npn_annotation_strategy_->RegionStop({name}); + break; + case NestingMode::Detection: + case NestingMode::ProperlyNested: + pn_annotation_strategy_->RegionStopLast({name, name_stack_}); + if (!name_stack_.empty()) { + name_stack_.pop(); + } + break; } }; -void Delegator::RegionStopLast(){ +void Delegator::RegionStopLast() { switch (nesting_mode_) { - - case NestingMode::NotProperlyNested: - std::cout << "Calling region_stop_last() is not supported in NotProperlyNested Backends" << std::endl; - break; - case NestingMode::Detection: - case NestingMode::ProperlyNested: - const std::string stack_empty="NESMIK: STACK EMPTPY"; - const std::string& last_region_name = name_stack_.empty() ? stack_empty: name_stack_.top(); - pn_annotation_strategy_->RegionStopLast({last_region_name,name_stack_}); - if(!name_stack_.empty()) {name_stack_.pop();} - break; + case NestingMode::NotProperlyNested: + std::cout << "Calling region_stop_last() is not supported in " + "NotProperlyNested Backends" + << std::endl; + break; + case NestingMode::Detection: + case NestingMode::ProperlyNested: + const std::string stack_empty = "NESMIK: STACK EMPTPY"; + const std::string& last_region_name = + name_stack_.empty() ? stack_empty : name_stack_.top(); + pn_annotation_strategy_->RegionStopLast({last_region_name, name_stack_}); + if (!name_stack_.empty()) { + name_stack_.pop(); + } + break; } } void Delegator::Finalize() { - switch (nesting_mode_) { - - case NestingMode::NotProperlyNested: - return npn_annotation_strategy_->Finalize(); - break; - case NestingMode::Detection: - case NestingMode::ProperlyNested: - return pn_annotation_strategy_->Finalize(); - break; + case NestingMode::NotProperlyNested: + return npn_annotation_strategy_->Finalize(); + break; + case NestingMode::Detection: + case NestingMode::ProperlyNested: + return pn_annotation_strategy_->Finalize(); + break; } }; diff --git a/src/delegator.hpp b/src/delegator.hpp index 68b97ded84e78e1f8cb1fb3695dae91ebf5eb340..dd521aaa11ec3cf646446e57ef994c651f0ef906 100644 --- a/src/delegator.hpp +++ b/src/delegator.hpp @@ -2,36 +2,35 @@ #define NESMIK_DELEGATOR_HPP #include +#include #include #include -#include - enum class NestingMode { Detection, ProperlyNested, NotProperlyNested }; class Delegator { -private: + private: inline static std::unique_ptr pn_annotation_strategy_; inline static std::unique_ptr npn_annotation_strategy_; - + inline static thread_local std::stack name_stack_; inline static NestingMode nesting_mode_ = NestingMode::Detection; -public: + public: static void Init(std::string_view nesting_mode, std::string_view backend); static void RegionStart(std::string_view name); static void RegionStop(std::string_view name); static void RegionStopLast(); static void Finalize(); -private: + private: static std::vector SplitString(const std::string &str, char delimiter); static void InitDetectionBackend(const std::string_view backend); static void InitNonProperlyNestedBackends(const std::string_view backend); static void InitProperlyNestedBackends(const std::string_view backend); }; -#endif // NESMIK_DELEGATOR_HPP \ No newline at end of file +#endif // NESMIK_DELEGATOR_HPP diff --git a/src/nesmik.cpp b/src/nesmik.cpp index 1783839759e3ec6ec93d6358fce97ee8fab2ba59..b818587aa750339f3d8377cf77b7b87aca789f5a 100644 --- a/src/nesmik.cpp +++ b/src/nesmik.cpp @@ -3,8 +3,8 @@ #include #include -// provides a c-like way to call things with just a fuction compared to -// instanciate a class. +// provides a c-like way to call things with just a function compared to +// instantiate a class. namespace nesmik { void init(const std::string &nesting_mode, const std::string &backend) { return Delegator::Init(nesting_mode, backend); @@ -16,8 +16,6 @@ void region_stop(const std::string &name) { return Delegator::RegionStop(name); } -void region_stop_last() { - return Delegator::RegionStopLast(); -} +void region_stop_last() { return Delegator::RegionStopLast(); } void finalize() { return Delegator::Finalize(); } -} // namespace nesmik +} // namespace nesmik diff --git a/src/strategies.hpp b/src/strategies.hpp index dbebd8b6e861e6c4ea4dcbe27f3425f02835ec38..e19425dd112cf42f7572694b4e09f05c03e89acb 100644 --- a/src/strategies.hpp +++ b/src/strategies.hpp @@ -3,37 +3,34 @@ #include #include -#include #include +#include - -/* - Describes the Strategy behavior with respect to MPI. +/* + Describes the Strategy behavior with respect to MPI. */ -enum class MPIDescriptor{ - DontCare, // Strategy doesnt know and doesnt care - Aware, // Strategy knows about MPI and can use the PMPI Interface to do e.g. reductions. - Required // Strategy requires MPI (should be safeguareded by build options) +enum class MPIDescriptor { + DontCare, // Strategy does not know and does not care + Aware, // Strategy knows about MPI and can use the PMPI Interface to do e.g. + // reductions. + Required // Strategy requires MPI (should be safeguareded by build options) }; -/* +/* Describes the Strategy behavior with respect to any thread level parallelism - Mainly concerned if starting and stopping regions is supported from multiple threads + Mainly concerned if starting and stopping regions is supported from multiple + threads */ -enum class ThreadDescriptor{ - Supported, - Unsupported -}; +enum class ThreadDescriptor { Supported, Unsupported }; -/* +/* Bundles the above enums into a nice struct */ -struct ParallelismDescriptor{ +struct ParallelismDescriptor { MPIDescriptor mpi_descriptor_ = MPIDescriptor::DontCare; ThreadDescriptor thread_descriptor_ = ThreadDescriptor::Unsupported; }; - struct ProperlyNestedRegionInformation { std::string_view name; const std::stack &stack_; @@ -45,29 +42,29 @@ struct NotProperlyNestedRegionInformation { // A backend implementing the Properly Nested Profiling class ProperlyNestedAnnotationStrategy { -public: + public: virtual ~ProperlyNestedAnnotationStrategy() = default; virtual void Init() noexcept = 0; - virtual void - RegionStart(const ProperlyNestedRegionInformation ®ion) noexcept = 0; - virtual void - RegionStopLast(const ProperlyNestedRegionInformation ®ion) noexcept = 0; + virtual void RegionStart( + const ProperlyNestedRegionInformation ®ion) noexcept = 0; + virtual void RegionStopLast( + const ProperlyNestedRegionInformation ®ion) noexcept = 0; virtual void Finalize() noexcept = 0; ParallelismDescriptor parallelism_descriptor_; }; class NotProperlyNestedAnnotationStrategy { -public: + public: virtual void Init() noexcept = 0; virtual ~NotProperlyNestedAnnotationStrategy() = default; - virtual void - RegionStart(const NotProperlyNestedRegionInformation ®ion) noexcept = 0; - virtual void - RegionStop(const NotProperlyNestedRegionInformation ®ion) noexcept = 0; + virtual void RegionStart( + const NotProperlyNestedRegionInformation ®ion) noexcept = 0; + virtual void RegionStop( + const NotProperlyNestedRegionInformation ®ion) noexcept = 0; virtual void Finalize() noexcept = 0; ParallelismDescriptor parallelism_descriptor_; }; -#endif // NESMIK_STRATEGY_HPP \ No newline at end of file +#endif // NESMIK_STRATEGY_HPP diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index ea714acbd422f8e87dc05a2c6cbaa6238e657d1e..d058970f81637d045bcf8ccbd464bd475e1cfa67 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1 +1 @@ -target_sources(nesmik PRIVATE environment_variable.cpp parallelism_helper.cpp string_helpers.cpp) \ No newline at end of file +target_sources(nesmik PRIVATE environment_variable.cpp parallelism_helper.cpp string_helpers.cpp) diff --git a/src/utils/environment_variable.cpp b/src/utils/environment_variable.cpp index 9b1df9d62207d8ac85d63aa9a9960367daa6c945..979be296fab92a9d23bdbbe0c900466d462ca600 100644 --- a/src/utils/environment_variable.cpp +++ b/src/utils/environment_variable.cpp @@ -1,14 +1,14 @@ +#include "environment_variable.hpp" + #include #include #include #include #include - #include -#include "environment_variable.hpp" - -template <> std::optional fromEnvString(const std::string &env_string) { +template <> +std::optional fromEnvString(const std::string &env_string) { if (stringsAreCaseInsensitiveEqual(env_string, "0") || stringsAreCaseInsensitiveEqual(env_string, "false") || stringsAreCaseInsensitiveEqual(env_string, "off")) { @@ -22,6 +22,7 @@ template <> std::optional fromEnvString(const std::string &env_string) { } } -template <> std::optional fromEnvString(const std::string &env_string) { - return std::optional{env_string}; +template <> +std::optional fromEnvString(const std::string &env_string) { + return std::optional{env_string}; } diff --git a/src/utils/environment_variable.hpp b/src/utils/environment_variable.hpp index 97834f0b6193434e4c1bc2352e79a43ee25075ce..edf98f3ddf319d3a50882842e7cf107a80251fd1 100644 --- a/src/utils/environment_variable.hpp +++ b/src/utils/environment_variable.hpp @@ -11,12 +11,16 @@ template std::optional fromEnvString(const std::string &env_string) = delete; -template <> std::optional fromEnvString(const std::string &env_string); -template <> std::optional fromEnvString(const std::string &env_string); +template <> +std::optional fromEnvString(const std::string &env_string); +template <> +std::optional fromEnvString(const std::string &env_string); -template class EnvironmentVariable { +template +class EnvironmentVariable { inline static std::string PREFIX = "NESMIK_"; -public: + + public: /* Upon construction it will do the getenv */ @@ -31,21 +35,22 @@ public: if (env_string != nullptr) { value_ = fromEnvString(std::string(env_string)); } - if(required && !value_.has_value()){ - std::cout << "neSmiK Error: " << variable_to_query << " not set, restart application and set it" << std::endl; - exit(1); + if (required && !value_.has_value()) { + std::cout << "neSmiK Error: " << variable_to_query + << " not set, restart application and set it" << std::endl; + exit(1); } } EnvironmentVariable() = delete; -private: + private: std::string variable_name_; std::string description_; std::optional value_; -public: + public: std::optional getValue() const { return value_; } bool isSet() const { return value_.has_value(); } }; -#endif // NESMIK_ENVIROMENT_VARIABLE_HPP +#endif // NESMIK_ENVIROMENT_VARIABLE_HPP diff --git a/src/utils/parallelism_helper.cpp b/src/utils/parallelism_helper.cpp index 20c20147a09628510aef7239cdd6be7ecb71be09..772d6404c533f3bab40f22b1a6dc8f8331bd19c9 100644 --- a/src/utils/parallelism_helper.cpp +++ b/src/utils/parallelism_helper.cpp @@ -1,5 +1,6 @@ -#include #include + +#include #include #ifdef WITH_MPI @@ -40,4 +41,4 @@ int MPIHelper::getRankNumber() const { return mpi_comm_rank; } MPIHelper::MPIHelper() {} -#endif \ No newline at end of file +#endif diff --git a/src/utils/parallelism_helper.hpp b/src/utils/parallelism_helper.hpp index e873bb3030028c5c86b2a02fd58702fb0efb3ca9..a7ff3a0311e427c96b71923696a4d7c2d34a0474 100644 --- a/src/utils/parallelism_helper.hpp +++ b/src/utils/parallelism_helper.hpp @@ -2,17 +2,17 @@ #define NESMIK_PARALLELISM_HELPER_HPP /* Small helper class that can be used by Backends to Check MPI status in the - application beeing run. + application that is running */ class MPIHelper { -private: + private: // Default values for non-MPI execution bool is_using_mpi_ = false; bool mpi_is_initialized_ = false; int mpi_comm_size = 0; int mpi_comm_rank = 0; -public: + public: MPIHelper(); // returns if the library is compiled with MPI support bool CompiledWithMPI() const; @@ -24,4 +24,4 @@ public: int getRankNumber() const; }; -#endif // NESMIK_PARALLELISM_HELPER_HPP \ No newline at end of file +#endif // NESMIK_PARALLELISM_HELPER_HPP diff --git a/src/utils/string_helpers.cpp b/src/utils/string_helpers.cpp index 15de8fc4500de4cc0bbf4d4ca8fdb781c4a8dc4d..a3dc683f24488c34502e0dbbfc583e539355930c 100644 --- a/src/utils/string_helpers.cpp +++ b/src/utils/string_helpers.cpp @@ -1,14 +1,15 @@ +#include "string_helpers.hpp" + #include #include -#include "string_helpers.hpp" - -// some helper function to compare case insenstive strings +// some helper function to compare case insensitive strings bool charToLowerEquals(char a, char b) { return std::tolower(static_cast(a)) == std::tolower(static_cast(b)); } -bool stringsAreCaseInsensitiveEqual(const std::string &a, const std::string &b) { +bool stringsAreCaseInsensitiveEqual(const std::string &a, + const std::string &b) { return std::equal(a.begin(), a.end(), b.begin(), b.end(), charToLowerEquals); } diff --git a/src/utils/string_helpers.hpp b/src/utils/string_helpers.hpp index 043600d470ba6e3d04e08c0cbeb91b479dc15e1d..7eed3af13f559dcc30a7389d6851bd0953449348 100644 --- a/src/utils/string_helpers.hpp +++ b/src/utils/string_helpers.hpp @@ -5,4 +5,4 @@ bool stringsAreCaseInsensitiveEqual(const std::string &a, const std::string &b); -#endif // NESMIK_STRING_HELPERS_HPP +#endif // NESMIK_STRING_HELPERS_HPP diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dab8f22841e62526d2925a82b9c13049c345b025..d99da70a6b481cd07bf65e08e42b0e166d155464 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,7 +36,7 @@ add_test(NAME TestCppTalpTree if(WITH_MPI) - + add_executable(TestCppTalpTreeMPI cpp/TestCppTalpTreeMPI.cpp) target_link_libraries(TestCppTalpTreeMPI nesmik::nesmik MPI::MPI_CXX) target_include_directories(TestCppTalpTreeMPI @@ -45,7 +45,7 @@ add_test(NAME TestCppTalpTree add_test(NAME TestCppTalpTreeMPI COMMAND mpirun -np 2 TestCppTalpTree) - endif() + endif() endif() @@ -82,7 +82,7 @@ if(BUILD_C_FORTRAN) else() target_link_libraries(TestFortranLink nesmik) endif() - + target_include_directories(TestFortranLink PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}) diff --git a/tests/c/TestCLink.c b/tests/c/TestCLink.c index 9ebfc31e43f81ca1fd963ac20768175e9c8d4ecf..07d6ce41076d2d80534ece2f2abef15cafa7a443 100644 --- a/tests/c/TestCLink.c +++ b/tests/c/TestCLink.c @@ -1,3 +1,3 @@ -int main() {} \ No newline at end of file +int main() {} diff --git a/tests/cpp/TestCppDLB.cpp b/tests/cpp/TestCppDLB.cpp index 2ba1cba70273d9d7f2f579b806bed82653f28f7c..89fe69bbb7f5cc8a269f84c39aa1ca113863b025 100644 --- a/tests/cpp/TestCppDLB.cpp +++ b/tests/cpp/TestCppDLB.cpp @@ -1,7 +1,7 @@ #include "nesmik/nesmik.hpp" int main() { - nesmik::init("NotProperlyNested","TALP"); + nesmik::init("NotProperlyNested", "TALP"); nesmik::region_start("Default"); nesmik::region_stop("Default"); nesmik::finalize(); diff --git a/tests/cpp/TestCppExtraeTypeStack.cpp b/tests/cpp/TestCppExtraeTypeStack.cpp index 25bb92f369bb29f21971568bc34c6195ed7ad2b4..64942a6188e6e1d844ab2699acf89319cd093392 100644 --- a/tests/cpp/TestCppExtraeTypeStack.cpp +++ b/tests/cpp/TestCppExtraeTypeStack.cpp @@ -1,17 +1,17 @@ #include "nesmik/nesmik.hpp" int main() { - nesmik::init("ProperlyNested","Extrae::TypeStack"); + nesmik::init("ProperlyNested", "Extrae::TypeStack"); nesmik::region_start("init"); - nesmik::region_start("init_ts"); - nesmik::region_stop("init_ts"); + nesmik::region_start("init_ts"); + nesmik::region_stop("init_ts"); - nesmik::region_start("init_io"); - nesmik::region_stop("init_io"); + nesmik::region_start("init_io"); + nesmik::region_stop("init_io"); nesmik::region_stop("init"); nesmik::region_start("init_ts"); - nesmik::region_stop("init_ts"); + nesmik::region_stop("init_ts"); nesmik::finalize(); -} \ No newline at end of file +} diff --git a/tests/cpp/TestCppLink.cpp b/tests/cpp/TestCppLink.cpp index 79d5ae2484b74e1066e548938630abd4a2a3943e..e56ddbb0b61d9d5256092cc15657f7a88630588b 100644 --- a/tests/cpp/TestCppLink.cpp +++ b/tests/cpp/TestCppLink.cpp @@ -1,8 +1,8 @@ #include "nesmik/nesmik.hpp" int main() { - nesmik::init("ProperlyNested","Default"); + nesmik::init("ProperlyNested", "Default"); nesmik::region_start("Default"); nesmik::region_stop("Default"); nesmik::finalize(); -} \ No newline at end of file +} diff --git a/tests/cpp/TestCppTalpTree.cpp b/tests/cpp/TestCppTalpTree.cpp index bfe90d2e8f5fb519c45e9a4c3b33afa9b8501b6d..1ecfbe2bea8084e8b1425b93d839378712b9f0e5 100644 --- a/tests/cpp/TestCppTalpTree.cpp +++ b/tests/cpp/TestCppTalpTree.cpp @@ -1,18 +1,18 @@ #include "nesmik/nesmik.hpp" int main() { - nesmik::init("ProperlyNested","TALP-Tree"); + nesmik::init("ProperlyNested", "TALP-Tree"); nesmik::region_start("Top"); - nesmik::region_start("child-1"); - nesmik::region_start("child-1.1"); - nesmik::region_stop("child-1.1"); - nesmik::region_start("child-1.2"); - nesmik::region_stop("child-1.2"); - nesmik::region_stop("child-1"); - nesmik::region_start("child-2"); - nesmik::region_start("child-2.1"); - nesmik::region_stop("child-2.1"); - nesmik::region_stop("child-2"); + nesmik::region_start("child-1"); + nesmik::region_start("child-1.1"); + nesmik::region_stop("child-1.1"); + nesmik::region_start("child-1.2"); + nesmik::region_stop("child-1.2"); + nesmik::region_stop("child-1"); + nesmik::region_start("child-2"); + nesmik::region_start("child-2.1"); + nesmik::region_stop("child-2.1"); + nesmik::region_stop("child-2"); nesmik::region_stop("Top"); nesmik::finalize(); } diff --git a/tests/cpp/TestCppTalpTreeMPI.cpp b/tests/cpp/TestCppTalpTreeMPI.cpp index 1e0e64822fdae7fb0f58e4d1b6cb2d6c0bcaed22..8576b6a9e0ee06d478dde9f79917da421dc9e6e3 100644 --- a/tests/cpp/TestCppTalpTreeMPI.cpp +++ b/tests/cpp/TestCppTalpTreeMPI.cpp @@ -1,19 +1,20 @@ -#include "nesmik/nesmik.hpp" #include + +#include "nesmik/nesmik.hpp" int main() { - MPI_Init(NULL,NULL); - nesmik::init("ProperlyNested","TALP-Tree"); + MPI_Init(NULL, NULL); + nesmik::init("ProperlyNested", "TALP-Tree"); nesmik::region_start("Top"); - nesmik::region_start("child-1"); - nesmik::region_start("child-1.1"); - nesmik::region_stop("child-1.1"); - nesmik::region_start("child-1.2"); - nesmik::region_stop("child-1.2"); - nesmik::region_stop("child-1"); - nesmik::region_start("child-2"); - nesmik::region_start("child-2.1"); - nesmik::region_stop("child-2.1"); - nesmik::region_stop("child-2"); + nesmik::region_start("child-1"); + nesmik::region_start("child-1.1"); + nesmik::region_stop("child-1.1"); + nesmik::region_start("child-1.2"); + nesmik::region_stop("child-1.2"); + nesmik::region_stop("child-1"); + nesmik::region_start("child-2"); + nesmik::region_start("child-2.1"); + nesmik::region_stop("child-2.1"); + nesmik::region_stop("child-2"); nesmik::region_stop("Top"); nesmik::finalize(); MPI_Finalize(); diff --git a/tests/cpp/TestRegionStopLast.cpp b/tests/cpp/TestRegionStopLast.cpp index 77a7e284b44a60bb0922a293eff4e6d7207990d1..85c3e496bfec7de7fd057591b253b11bce8a8172 100644 --- a/tests/cpp/TestRegionStopLast.cpp +++ b/tests/cpp/TestRegionStopLast.cpp @@ -1,12 +1,12 @@ #include "nesmik/nesmik.hpp" int main() { - nesmik::init("ProperlyNested","Default"); + nesmik::init("ProperlyNested", "Default"); nesmik::region_start("Test0-1"); - nesmik::region_start("Test1-1"); - nesmik::region_stop_last(); - nesmik::region_start("Test1-2"); - nesmik::region_stop_last(); + nesmik::region_start("Test1-1"); + nesmik::region_stop_last(); + nesmik::region_start("Test1-2"); + nesmik::region_stop_last(); nesmik::region_stop_last(); nesmik::finalize(); } diff --git a/tests/fortran/TestFortranModule.f90 b/tests/fortran/TestFortranModule.f90 index f20187357273da4dfa63b3324d80cdf3e9f9c7ab..b2d288c8df14b77b196551de2a1d4d7f77d893fd 100644 --- a/tests/fortran/TestFortranModule.f90 +++ b/tests/fortran/TestFortranModule.f90 @@ -2,4 +2,4 @@ program do_sample use nesmik_mod call init("ProperlyNested","Default") call region_start("test") -end program do_sample \ No newline at end of file +end program do_sample