Skip to content

Commit 916aac1

Browse files
authored
Enable MPI tracing for Fortran (#185)
- Move the MPI gotcha functionality from Timemory to the repo. - Add the PMPI Fortran MPI functions to the existing mpi gotcha handle. [ROCm/rocprofiler-systems commit: 4fcd8cc]
1 parent 4c4fc2b commit 916aac1

File tree

13 files changed

+1576
-55
lines changed

13 files changed

+1576
-55
lines changed

projects/rocprofiler-systems/cmake/Packages.cmake

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,12 @@ set(_ROCPROFSYS_MPI_HEADERS_ALLOW_MPICH ${MPI_HEADERS_ALLOW_MPICH})
210210
if(ROCPROFSYS_USE_MPI)
211211
find_package(MPI ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
212212
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX)
213-
rocprofiler_systems_target_compile_definitions(
214-
rocprofiler-systems-mpi INTERFACE TIMEMORY_USE_MPI=1 ROCPROFSYS_USE_MPI)
213+
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
214+
INTERFACE ROCPROFSYS_USE_MPI)
215215
elseif(ROCPROFSYS_USE_MPI_HEADERS)
216216
find_package(MPI-Headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
217-
rocprofiler_systems_target_compile_definitions(
218-
rocprofiler-systems-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS=1
219-
ROCPROFSYS_USE_MPI_HEADERS)
217+
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
218+
INTERFACE ROCPROFSYS_USE_MPI_HEADERS)
220219
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_HEADERS)
221220
endif()
222221

@@ -543,9 +542,6 @@ set(TIMEMORY_QUIET_CONFIG
543542
CACHE BOOL "Make timemory configuration quieter")
544543

545544
# timemory feature settings
546-
set(TIMEMORY_USE_MPI
547-
${ROCPROFSYS_USE_MPI}
548-
CACHE BOOL "Enable MPI support in timemory" FORCE)
549545
set(TIMEMORY_USE_GOTCHA
550546
ON
551547
CACHE BOOL "Enable GOTCHA support in timemory")

projects/rocprofiler-systems/examples/transpose/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if((NOT CMAKE_CXX_COMPILER_IS_HIPCC OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang
4141
return()
4242
endif()
4343

44-
option(TRANSPOSE_USE_MPI "Enable MPI support in transpose exe" ${TIMEMORY_USE_MPI})
44+
option(TRANSPOSE_USE_MPI "Enable MPI support in transpose exe" ${ROCPROFSYS_USE_MPI})
4545

4646
find_package(Threads REQUIRED)
4747
if(TRANSPOSE_USE_MPI)

projects/rocprofiler-systems/source/bin/rocprof-sys-instrument/rocprof-sys-instrument.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,8 +1711,10 @@ main(int argc, char** argv)
17111711
{ "rocprofsys_user_stop_thread_trace" });
17121712
#if ROCPROFSYS_USE_MPI > 0 || ROCPROFSYS_USE_MPI_HEADERS > 0
17131713
// if any of the below MPI functions are found, enable MPI support
1714-
for(const auto* itr : { "MPI_Init", "MPI_Init_thread", "MPI_Finalize",
1715-
"MPI_Comm_rank", "MPI_Comm_size" })
1714+
for(const auto* itr :
1715+
{ "MPI_Init", "MPI_Init_thread", "MPI_Finalize", "MPI_Comm_rank", "MPI_Comm_size",
1716+
"MPI_INIT", "mpi_init", "mpi_init_", "mpi_init__", "MPI_INIT_THREAD",
1717+
"mpi_init_thread", "mpi_init_thread_", "mpi_init_thread__" })
17161718
{
17171719
if(find_function(app_image, itr) != nullptr)
17181720
{

projects/rocprofiler-systems/source/lib/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ set(core_headers
3131
${CMAKE_CURRENT_LIST_DIR}/exception.hpp
3232
${CMAKE_CURRENT_LIST_DIR}/gpu.hpp
3333
${CMAKE_CURRENT_LIST_DIR}/locking.hpp
34+
${CMAKE_CURRENT_LIST_DIR}/mpi.hpp
3435
${CMAKE_CURRENT_LIST_DIR}/mproc.hpp
3536
${CMAKE_CURRENT_LIST_DIR}/perf.hpp
3637
${CMAKE_CURRENT_LIST_DIR}/perfetto.hpp

projects/rocprofiler-systems/source/lib/core/config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ configure_settings(bool _init)
10461046
settings::use_output_suffix() = _config->get<bool>("ROCPROFSYS_USE_PID");
10471047
if(settings::use_output_suffix())
10481048
settings::default_process_suffix() = process::get_id();
1049-
#if !defined(TIMEMORY_USE_MPI) && defined(TIMEMORY_USE_MPI_HEADERS)
1049+
#if !defined(ROCPROFSYS_USE_MPI) && defined(ROCPROFSYS_USE_MPI_HEADERS)
10501050
if(tim::dmp::is_initialized()) settings::default_process_suffix() = tim::dmp::rank();
10511051
#endif
10521052

@@ -1367,7 +1367,7 @@ configure_disabled_settings(const std::shared_ptr<settings>& _config)
13671367
_config->find(itr)->second->set_hidden(true);
13681368
#endif
13691369

1370-
#if !defined(TIMEMORY_USE_MPI) || TIMEMORY_USE_MPI == 0
1370+
#if !defined(ROCPROFSYS_USE_MPI) || ROCPROFSYS_USE_MPI == 0
13711371
_config->disable("ROCPROFSYS_PERFETTO_COMBINE_TRACES");
13721372
_config->disable("ROCPROFSYS_COLLAPSE_PROCESSES");
13731373
_config->find("ROCPROFSYS_PERFETTO_COMBINE_TRACES")->second->set_hidden(true);
@@ -1991,7 +1991,7 @@ get_perfetto_buffer_size()
19911991
bool
19921992
get_perfetto_combined_traces()
19931993
{
1994-
#if defined(TIMEMORY_USE_MPI) && TIMEMORY_USE_MPI > 0
1994+
#if defined(ROCPROFSYS_USE_MPI) && ROCPROFSYS_USE_MPI > 0
19951995
static auto _v = get_config()->find("ROCPROFSYS_PERFETTO_COMBINE_TRACES");
19961996
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
19971997
#else

projects/rocprofiler-systems/source/lib/core/debug.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ as_hex<void*>(void*, size_t);
159159
#endif
160160

161161
#if !defined(ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER)
162-
# if defined(TIMEMORY_USE_MPI)
162+
# if defined(ROCPROFSYS_USE_MPI)
163163
# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER static_cast<int>(::tim::dmp::rank())
164-
# elif defined(TIMEMORY_USE_MPI_HEADERS)
164+
# elif defined(ROCPROFSYS_USE_MPI_HEADERS)
165165
# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER \
166166
(::tim::dmp::is_initialized()) ? static_cast<int>(::tim::dmp::rank()) \
167167
: static_cast<int>(::tim::process::get_id())

0 commit comments

Comments
 (0)