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

Fix printing issue in perfstub thirdparty code #3913

Merged
merged 1 commit into from
Nov 13, 2023
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
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();
PERFSTUBS_INITIALIZE(m_Comm.Rank());
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()
#define PERFSTUBS_INITIALIZE(rank)
#define PERFSTUBS_FINALIZE()
#define PERFSTUBS_PAUSE_MEASUREMENT()
#define PERFSTUBS_RESUME_MEASUREMENT()
Expand Down
9 changes: 5 additions & 4 deletions thirdparty/perfstubs/perfstubs/perfstubs_api/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,16 @@ 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() {
void initialize_library(const int rank) {
#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;
}
printf("Found ps_tool_initialize(), registering tool\n");
if (rank == 0)
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 @@ -218,13 +219,13 @@ static inline void ps_register_thread_internal(void) {
}

/* Initialization */
void ps_initialize_(void) {
void ps_initialize_(const int rank) {
int i;
/* Only do this once */
if (perfstubs_initialized != PERFSTUBS_UNKNOWN) {
return;
}
initialize_library();
initialize_library(rank);
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_(void);
void ps_initialize_(const int rank);
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() ps_initialize_();
#define PERFSTUBS_INITIALIZE(rank) ps_initialize_(rank);

#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()
#define PERFSTUBS_INITIALIZE(rank)
#define PERFSTUBS_FINALIZE()
#define PERFSTUBS_PAUSE_MEASUREMENT()
#define PERFSTUBS_RESUME_MEASUREMENT()
Expand Down
Loading