Skip to content

Commit

Permalink
Revert "Only rank 0 should print the initialization message in perfstub"
Browse files Browse the repository at this point in the history
This reverts commit 39f0cb2.
  • Loading branch information
anagainaru committed Nov 28, 2023
1 parent fd111d4 commit 50ae02f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion source/adios2/core/ADIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ ADIOS::ADIOS(const std::string configFile, helper::Comm comm, const std::string
static bool perfstubsInit(false);
if (!perfstubsInit)
{
PERFSTUBS_INITIALIZE(m_Comm.Rank());
PERFSTUBS_INITIALIZE();
perfstubsInit = true;
atexit(ps_finalize_);
}
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/perfstubs/adios2-perfstubs-interface.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#else

#define PERFSTUBS_INITIALIZE(rank)
#define PERFSTUBS_INITIALIZE()
#define PERFSTUBS_FINALIZE()
#define PERFSTUBS_PAUSE_MEASUREMENT()
#define PERFSTUBS_RESUME_MEASUREMENT()
Expand Down
9 changes: 4 additions & 5 deletions thirdparty/perfstubs/perfstubs/perfstubs_api/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,15 @@ PS_WEAK_PRE void ps_tool_free_counter_data(ps_tool_counter_data_t *) PS_WEAK_POS
PS_WEAK_PRE void ps_tool_free_metadata(ps_tool_metadata_t *) PS_WEAK_POST;
#endif

void initialize_library(const int rank) {
void initialize_library() {
#ifdef PERFSTUBS_USE_STATIC
/* The initialization function is the only required one */
initialize_functions[0] = &ps_tool_initialize;
if (initialize_functions[0] == NULL) {
perfstubs_initialized = PERFSTUBS_FAILURE;
return;
}
if (rank == 0)
printf("Found ps_tool_initialize(), registering tool\n");
printf("Found ps_tool_initialize(), registering tool\n");
finalize_functions[0] = &ps_tool_finalize;
pause_measurement_functions[0] = &ps_tool_pause_measurement;
resume_measurement_functions[0] = &ps_tool_resume_measurement;
Expand Down Expand Up @@ -219,13 +218,13 @@ static inline void ps_register_thread_internal(void) {
}

/* Initialization */
void ps_initialize_(const int rank) {
void ps_initialize_(void) {
int i;
/* Only do this once */
if (perfstubs_initialized != PERFSTUBS_UNKNOWN) {
return;
}
initialize_library(rank);
initialize_library();
for (i = 0 ; i < num_tools_registered ; i++) {
initialize_functions[i]();
}
Expand Down
6 changes: 3 additions & 3 deletions thirdparty/perfstubs/perfstubs/perfstubs_api/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern int perfstubs_initialized;
extern "C" {
#endif

void ps_initialize_(const int rank);
void ps_initialize_(void);
void ps_finalize_(void);
void ps_pause_measurement_(void);
void ps_resume_measurement_(void);
Expand Down Expand Up @@ -93,7 +93,7 @@ char* ps_make_timer_name_(const char * file, const char * func, int line);
* line or in a config.h file, however your project does it
*/

#define PERFSTUBS_INITIALIZE(rank) ps_initialize_(rank);
#define PERFSTUBS_INITIALIZE() ps_initialize_();

#define PERFSTUBS_FINALIZE() ps_finalize_();

Expand Down Expand Up @@ -170,7 +170,7 @@ char* ps_make_timer_name_(const char * file, const char * func, int line);

#else // defined(PERFSTUBS_USE_TIMERS)

#define PERFSTUBS_INITIALIZE(rank)
#define PERFSTUBS_INITIALIZE()
#define PERFSTUBS_FINALIZE()
#define PERFSTUBS_PAUSE_MEASUREMENT()
#define PERFSTUBS_RESUME_MEASUREMENT()
Expand Down

0 comments on commit 50ae02f

Please sign in to comment.