Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding hooks to gather performance for derived variables #4161

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions source/adios2/engine/bp5/BP5Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,11 @@ void BP5Writer::MarshalAttributes()
#ifdef ADIOS2_HAVE_DERIVED_VARIABLE
void BP5Writer::ComputeDerivedVariables()
{
PERFSTUBS_SCOPED_TIMER("BP5Writer::ComputeDerivedVariables");
auto const &m_VariablesDerived = m_IO.GetDerivedVariables();
auto const &m_Variables = m_IO.GetVariables();
// parse all derived variables
m_Profiler.Start("DeriveVars");
for (auto it = m_VariablesDerived.begin(); it != m_VariablesDerived.end(); it++)
{
// identify the variables used in the derived variable
Expand Down Expand Up @@ -562,6 +564,7 @@ void BP5Writer::ComputeDerivedVariables()
free(std::get<0>(derivedBlock));
}
}
m_Profiler.Stop("DeriveVars");
}
#endif

Expand Down
4 changes: 4 additions & 0 deletions source/adios2/toolkit/derived/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Function.tcc"
#include "adios2/common/ADIOSMacros.h"
#include "adios2/helper/adiosFunctions.h"
#include <adios2-perfstubs-interface.h>
#include <cmath>

namespace adios2
Expand All @@ -14,6 +15,7 @@ namespace derived

DerivedData AddFunc(std::vector<DerivedData> inputData, DataType type)
{
PERFSTUBS_SCOPED_TIMER("derived::Function::AddFunc");
size_t dataSize = std::accumulate(std::begin(inputData[0].Count), std::end(inputData[0].Count),
1, std::multiplies<size_t>());

Expand All @@ -31,6 +33,7 @@ DerivedData AddFunc(std::vector<DerivedData> inputData, DataType type)

DerivedData MagnitudeFunc(std::vector<DerivedData> inputData, DataType type)
{
PERFSTUBS_SCOPED_TIMER("derived::Function::MagnitudeFunc");
size_t dataSize = std::accumulate(std::begin(inputData[0].Count), std::end(inputData[0].Count),
1, std::multiplies<size_t>());
#define declare_type_mag(T) \
Expand Down Expand Up @@ -147,6 +150,7 @@ float linear_interp(DerivedData input, size_t index, size_t dim)
*/
DerivedData Curl3DFunc(const std::vector<DerivedData> inputData, DataType type)
{
PERFSTUBS_SCOPED_TIMER("derived::Function::Curl3DFunc");
size_t dataSize = inputData[0].Count[0] * inputData[0].Count[1] * inputData[0].Count[2];

DerivedData curl;
Expand Down
2 changes: 2 additions & 0 deletions source/adios2/toolkit/profiling/iochrono/IOChrono.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ JSONProfiler::JSONProfiler(helper::Comm const &comm) : m_Comm(comm)
AddTimerWatch("DC_WaitOnAsync2");
AddTimerWatch("PDW");

AddTimerWatch("DeriveVars");

m_Profiler.m_Bytes.emplace("buffering", 0);
AddTimerWatch("DataRead");
m_Profiler.m_Bytes.emplace("dataread", 0);
Expand Down
Loading