geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
geopm_pmpi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef GEOPM_PMPI_H_INCLUDE
6 #define GEOPM_PMPI_H_INCLUDE
7 
11 MPI_Fint geopm_swap_comm_world_f(MPI_Fint comm);
15 void geopm_mpi_region_enter(uint64_t func_rid);
19 void geopm_mpi_region_exit(uint64_t func_rid);
23 uint64_t geopm_mpi_func_rid(const char *func_name);
24 
25 /* Macro seems to be the best way to deal introducing per function
26  * static storage with a non-const initializer. We avoid repeating
27  * code. Note this approach is thread safe because of the underlying
28  * lock in geopm_prof_region().
29  */
30 #define GEOPM_PMPI_ENTER_MACRO(FUNC) \
31  static unsigned is_once = 1; \
32  static uint64_t func_rid = 0; \
33  if (is_once || func_rid == 0) { \
34  func_rid = geopm_mpi_func_rid(FUNC); \
35  is_once = 0; \
36  } \
37  geopm_mpi_region_enter(func_rid);
38 
39 #define GEOPM_PMPI_EXIT_MACRO geopm_mpi_region_exit(func_rid);
40 
41 int geopm_pmpi_init_thread(int *argc, char **argv[], int required, int *provided);
42 int geopm_pmpi_finalize(void);
43 MPI_Comm geopm_swap_comm_world(MPI_Comm comm);
44 #endif /* GEOPM_PMPI_H_INCLUDE */
int geopm_pmpi_finalize(void)
Definition: geopm_pmpi_helper.cpp:297
MPI_Comm geopm_swap_comm_world(MPI_Comm comm)
Definition: geopm_pmpi_helper.cpp:233
void geopm_mpi_region_enter(uint64_t func_rid)
Mark entry of a wrapped MPI region.
Definition: geopm_pmpi_helper.cpp:86
int geopm_pmpi_init_thread(int *argc, char **argv[], int required, int *provided)
Definition: geopm_pmpi_helper.cpp:261
void geopm_mpi_region_exit(uint64_t func_rid)
Mark exit of a wrapped MPI region.
Definition: geopm_pmpi_helper.cpp:93
uint64_t geopm_mpi_func_rid(const char *func_name)
Create a unique region_id from a MPI function name.
Definition: geopm_pmpi_helper.cpp:100
MPI_Fint geopm_swap_comm_world_f(MPI_Fint comm)
Swap out COMM_WORLD with our internally modified comm (fortran only)
Definition: geopm_pmpi_helper.cpp:255