SWDEV-387026: using gethostid instead of depending on libsystemd
Change-Id: If576eec4abee1a52dfe7cc5bce507420bc8a4d07
Этот коммит содержится в:
@@ -52,7 +52,7 @@ file(GLOB ROCPROFILER_UTIL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/utils/helper.cpp)
|
||||
set_source_files_properties(profiler/application_replay_sample.cpp PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
||||
hip_add_executable(profiler_application_replay profiler/application_replay_sample.cpp ${ROCPROFILER_UTIL_SRC_FILES})
|
||||
target_include_directories(profiler_application_replay PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/common)
|
||||
target_link_libraries(profiler_application_replay PRIVATE ${ROCPROFILER_TARGET} systemd amd_comgr)
|
||||
target_link_libraries(profiler_application_replay PRIVATE ${ROCPROFILER_TARGET} amd_comgr)
|
||||
target_link_options(profiler_application_replay PRIVATE "-Wl,--build-id=md5")
|
||||
add_dependencies(samples profiler_application_replay)
|
||||
install(TARGETS profiler_application_replay RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/samples COMPONENT samples)
|
||||
@@ -61,7 +61,7 @@ install(TARGETS profiler_application_replay RUNTIME DESTINATION ${CMAKE_INSTALL_
|
||||
set_source_files_properties(profiler/kernel_replay_sample.cpp PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
||||
hip_add_executable(profiler_kernel_replay profiler/kernel_replay_sample.cpp ${ROCPROFILER_UTIL_SRC_FILES})
|
||||
target_include_directories(profiler_kernel_replay PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/common)
|
||||
target_link_libraries(profiler_kernel_replay PRIVATE ${ROCPROFILER_TARGET} systemd amd_comgr)
|
||||
target_link_libraries(profiler_kernel_replay PRIVATE ${ROCPROFILER_TARGET} amd_comgr)
|
||||
target_link_options(profiler_kernel_replay PRIVATE "-Wl,--build-id=md5")
|
||||
add_dependencies(samples profiler_kernel_replay)
|
||||
install(TARGETS profiler_kernel_replay RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/samples COMPONENT samples)
|
||||
@@ -71,7 +71,7 @@ set_source_files_properties(profiler/user_replay_sample.cpp PROPERTIES HIP_SOURC
|
||||
hip_add_executable(profiler_user_replay profiler/user_replay_sample.cpp ${ROCPROFILER_UTIL_SRC_FILES})
|
||||
target_include_directories(profiler_user_replay PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/common)
|
||||
target_link_options(profiler_user_replay PRIVATE "-Wl,--build-id=md5")
|
||||
target_link_libraries(profiler_user_replay PRIVATE ${ROCPROFILER_TARGET} systemd amd_comgr)
|
||||
target_link_libraries(profiler_user_replay PRIVATE ${ROCPROFILER_TARGET} amd_comgr)
|
||||
add_dependencies(samples profiler_user_replay)
|
||||
install(TARGETS profiler_user_replay RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/samples COMPONENT samples)
|
||||
|
||||
@@ -79,7 +79,7 @@ install(TARGETS profiler_user_replay RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROO
|
||||
set_source_files_properties(profiler/device_profiling_sample.cpp PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
||||
hip_add_executable(profiler_device_profiling profiler/device_profiling_sample.cpp ${ROCPROFILER_UTIL_SRC_FILES})
|
||||
target_include_directories(profiler_device_profiling PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/common)
|
||||
target_link_libraries(profiler_device_profiling PRIVATE ${ROCPROFILER_TARGET} systemd amd_comgr)
|
||||
target_link_libraries(profiler_device_profiling PRIVATE ${ROCPROFILER_TARGET} amd_comgr)
|
||||
target_link_options(profiler_device_profiling PRIVATE "-Wl,--build-id=md5")
|
||||
add_dependencies(samples profiler_device_profiling)
|
||||
install(TARGETS profiler_device_profiling RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/samples COMPONENT samples)
|
||||
@@ -112,7 +112,7 @@ install(TARGETS xgmi_counters_sampler RUNTIME DESTINATION ${CMAKE_INSTALL_DATARO
|
||||
set_source_files_properties(tracer/sample.cpp PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
||||
hip_add_executable(tracer_hip_hsa tracer/sample.cpp ${ROCPROFILER_UTIL_SRC_FILES})
|
||||
target_include_directories(tracer_hip_hsa PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/common)
|
||||
target_link_libraries(tracer_hip_hsa PRIVATE ${ROCPROFILER_TARGET} systemd amd_comgr)
|
||||
target_link_libraries(tracer_hip_hsa PRIVATE ${ROCPROFILER_TARGET} amd_comgr)
|
||||
target_link_options(tracer_hip_hsa PRIVATE "-Wl,--build-id=md5")
|
||||
add_dependencies(samples tracer_hip_hsa)
|
||||
install(TARGETS tracer_hip_hsa RUNTIME DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/samples COMPONENT samples)
|
||||
|
||||
@@ -3,7 +3,7 @@ ROCPROFILER_LIBS_PATH ?=$(ROCM_PATH)/lib
|
||||
ROCM_INCLUDES=-I$(ROCM_PATH)/include
|
||||
ROCPROFILER_INCLUDES=-I$(ROCM_PATH)/include/rocprofiler/
|
||||
|
||||
LIBS=-L$(ROCPROFILER_LIBS_PATH) -lrocprofiler64 -lamd_comgr -lsystemd
|
||||
LIBS=-L$(ROCPROFILER_LIBS_PATH) -lrocprofiler64 -lamd_comgr
|
||||
|
||||
ifndef ROCPROFILER_LIBS_PATH
|
||||
$(warning You may need to set ROCPROFILER_LIBS_PATH to the path of the rocprofiler source)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <systemd/sd-id128.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
@@ -61,14 +60,7 @@ __global__ void kernelF() { printf("\nKernel F\n"); }
|
||||
}
|
||||
|
||||
[[maybe_unused]] uint64_t GetMachineID() {
|
||||
char hostname[1023] = "\0";
|
||||
gethostname(hostname, 1023);
|
||||
sd_id128_t ret;
|
||||
char machine_id[SD_ID128_STRING_MAX];
|
||||
[[maybe_unused]] int status = sd_id128_get_machine(&ret);
|
||||
assert(status == 0 && "Error: Couldn't get machine id!");
|
||||
if (sd_id128_to_string(ret, machine_id)) return std::hash<std::string>{}(machine_id);
|
||||
return std::rand();
|
||||
return gethostid();
|
||||
}
|
||||
|
||||
std::ofstream output_file;
|
||||
|
||||
Ссылка в новой задаче
Block a user