Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7f65236

Browse files
authoredJan 10, 2024
Merge branch 'main' into pytest-v2
2 parents c853994 + 7bc50f5 commit 7f65236

25 files changed

+444
-79
lines changed
 

‎CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE
7171
ON
7272
CACHE BOOL "Build position independent code")
7373

74+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
75+
cmake_policy(SET CMP0135 NEW)
76+
endif()
77+
7478
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
7579
set(CMAKE_BUILD_TYPE
7680
Release
@@ -366,8 +370,8 @@ if(NOT OMNITRACE_USE_ROCPROFILER)
366370
endif()
367371

368372
configure_file(
369-
${PROJECT_SOURCE_DIR}/omnitrace.cfg
370-
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/omnitrace.cfg
373+
${PROJECT_SOURCE_DIR}/perfetto.cfg
374+
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg
371375
COPYONLY)
372376

373377
configure_file(
@@ -381,7 +385,7 @@ configure_file(
381385

382386
install(
383387
FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh
384-
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/omnitrace.cfg
388+
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg
385389
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
386390
COMPONENT setup)
387391

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Enable `traced` and `perfetto` in the background:
325325
```shell
326326
pkill traced
327327
traced --background
328-
perfetto --out ./omnitrace-perfetto.proto --txt -c ${OMNITRACE_ROOT}/share/omnitrace.cfg --background
328+
perfetto --out ./omnitrace-perfetto.proto --txt -c ${OMNITRACE_ROOT}/share/perfetto.cfg --background
329329
```
330330

331331
> ***NOTE: if the perfetto tools were installed by omnitrace, replace `traced` with `omnitrace-perfetto-traced` and***

‎examples/rccl/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ if(NOT hip_FOUND)
3131
return()
3232
endif()
3333

34-
if("${CMAKE_PROJECT_NAME}" STREQUAL "omnitrace" AND "$ENV{OMNITRACE_CI}")
34+
if("${CMAKE_PROJECT_NAME}" STREQUAL "omnitrace"
35+
AND ("$ENV{OMNITRACE_CI}"
36+
OR OMNITRACE_CI
37+
OR OMNITRACE_BUILD_CI))
3538
find_package(rccl QUIET) # avoid generating warning in CI
3639
else()
3740
find_package(rccl)

‎external/pybind11

Submodule pybind11 updated 172 files

‎external/timemory

Submodule timemory updated 58 files

‎omnitrace.cfg ‎perfetto.cfg

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# perfetto --out OUTPUT_FILE --txt -c omnitrace.cfg
2-
# 5 minute trace, but can be stopped prematurely.
3-
duration_ms: 300000
1+
# perfetto --out OUTPUT_FILE --txt -c perfetto.cfg
42
write_into_file: true
53

64
# One buffer allocated within the central tracing binary for the entire trace,

‎source/bin/omnitrace-avail/avail.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "api.hpp"
3434
#include "core/config.hpp"
3535
#include "core/gpu.hpp"
36+
#include "core/hip_runtime.hpp"
3637
#include "library/rocprofiler.hpp"
3738

3839
#include <timemory/components.hpp>
@@ -62,12 +63,6 @@
6263
#include <utility>
6364
#include <vector>
6465

65-
#if defined(OMNITRACE_USE_HIP) && OMNITRACE_USE_HIP > 0
66-
# include <hip/hip_runtime.h>
67-
#elif !defined(OMNITRACE_USE_HIP)
68-
# define OMNITRACE_USE_HIP 0
69-
#endif
70-
7166
#if defined(TIMEMORY_UNIX)
7267
# include <sys/ioctl.h> // ioctl() and TIOCGWINSZ
7368
# include <unistd.h> // for STDOUT_FILENO

‎source/docs/runtime.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ OMNITRACE_KOKKOSP_KERNEL_LOGGER = false
205205
OMNITRACE_PAPI_EVENTS = PAPI_TOT_CYC
206206
OMNITRACE_PERFETTO_BACKEND = inprocess
207207
OMNITRACE_PERFETTO_BUFFER_SIZE_KB = 1024000
208-
OMNITRACE_PERFETTO_COMBINE_TRACES = true
208+
OMNITRACE_PERFETTO_COMBINE_TRACES = false
209209
OMNITRACE_PERFETTO_FILE = perfetto-trace.proto
210210
OMNITRACE_PERFETTO_FILL_POLICY = discard
211211
OMNITRACE_PERFETTO_SHMEM_SIZE_HINT_KB = 4096

‎source/lib/core/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ set(core_headers
2929
${CMAKE_CURRENT_LIST_DIR}/dynamic_library.hpp
3030
${CMAKE_CURRENT_LIST_DIR}/exception.hpp
3131
${CMAKE_CURRENT_LIST_DIR}/gpu.hpp
32+
${CMAKE_CURRENT_LIST_DIR}/hip_runtime.hpp
3233
${CMAKE_CURRENT_LIST_DIR}/locking.hpp
3334
${CMAKE_CURRENT_LIST_DIR}/mproc.hpp
3435
${CMAKE_CURRENT_LIST_DIR}/perf.hpp
3536
${CMAKE_CURRENT_LIST_DIR}/perfetto.hpp
37+
${CMAKE_CURRENT_LIST_DIR}/rccl.hpp
3638
${CMAKE_CURRENT_LIST_DIR}/redirect.hpp
3739
${CMAKE_CURRENT_LIST_DIR}/state.hpp
3840
${CMAKE_CURRENT_LIST_DIR}/timemory.hpp

‎source/lib/core/config.cpp

+27-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "perfetto.hpp"
3232
#include "utility.hpp"
3333

34+
#include <asm-generic/errno-base.h>
3435
#include <timemory/backends/capability.hpp>
3536
#include <timemory/backends/dmp.hpp>
3637
#include <timemory/backends/mpi.hpp>
@@ -650,8 +651,7 @@ configure_settings(bool _init)
650651
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_PERFETTO_COMBINE_TRACES",
651652
"Combine Perfetto traces. If not explicitly set, it will "
652653
"default to the value of OMNITRACE_COLLAPSE_PROCESSES",
653-
_config->get<bool>("collapse_processes"), "perfetto", "data",
654-
"advanced");
654+
false, "perfetto", "data", "advanced");
655655

656656
OMNITRACE_CONFIG_SETTING(
657657
bool, "OMNITRACE_PERFETTO_ROCTRACER_PER_STREAM",
@@ -2527,9 +2527,34 @@ tmp_file::fopen(const char* _mode)
25272527
return (file != nullptr && fd > 0);
25282528
}
25292529

2530+
bool
2531+
tmp_file::flush()
2532+
{
2533+
if(stream.is_open())
2534+
{
2535+
stream.flush();
2536+
}
2537+
else if(file != nullptr)
2538+
{
2539+
int _ret = fflush(file);
2540+
int _cnt = 0;
2541+
while(_ret == EAGAIN || _ret == EINTR)
2542+
{
2543+
std::this_thread::sleep_for(std::chrono::milliseconds{ 100 });
2544+
_ret = fflush(file);
2545+
if(++_cnt > 10) break;
2546+
}
2547+
return (_ret == 0);
2548+
}
2549+
2550+
return true;
2551+
}
2552+
25302553
bool
25312554
tmp_file::close()
25322555
{
2556+
flush();
2557+
25332558
if(stream.is_open())
25342559
{
25352560
stream.close();

‎source/lib/core/config.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ struct tmp_file
394394

395395
bool open(std::ios::openmode = std::ios::binary | std::ios::in | std::ios::out);
396396
bool fopen(const char* = "r+");
397+
bool flush();
397398
bool close();
398399
bool remove();
399400

0 commit comments

Comments
 (0)
Please sign in to comment.