Skip to content

Commit

Permalink
Merge pull request #4161 from anagainaru/derived-performance
Browse files Browse the repository at this point in the history
Adding hooks to gather performance for derived variables
  • Loading branch information
anagainaru authored May 11, 2024
2 parents 42edba8 + 224062d commit e2962b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
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

0 comments on commit e2962b9

Please sign in to comment.