From 93346ad41b3fa3c0ff6048e3e133755a3531deed Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 17 Sep 2024 17:14:33 +0000 Subject: [PATCH] set ZES --- xprof/xprof.rb.in | 12 ++++++++---- ze/tracer_ze_helpers.include.c | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/xprof/xprof.rb.in b/xprof/xprof.rb.in index 285601d2..b8b13473 100755 --- a/xprof/xprof.rb.in +++ b/xprof/xprof.rb.in @@ -332,8 +332,7 @@ end def sampling? return false unless OPTIONS[:sample] - - env_fetch_first('LTTNG_UST_SAMPLING_MASTER_ONLY', default: '0') == '0' || mpi_local_master? + env_fetch_first('LTTNG_UST_SAMPLING_MASTER_ONLY', default: '1') == '0' || mpi_local_master? end def env_tracers @@ -386,11 +385,16 @@ def env_tracers end # Sample - if sampling? && mpi_local_master> + # Currently the same so doesn't the tracing, and the sampling + # This mean that is the local rank is not part of the `traced-ranks` + # No sampling will be performed + if sampling? LOGGER.debug('Sampling Enabled') h['LTTNG_UST_SAMPLING'] = 1 h['LTTNG_UST_SAMPLING_ENERGY'] = 1 - h['ZES_ENABLE_SYSMAN'] = 1 if OPTIONS[:'backend-names'].include?('ze') + # The current only reliable way to use zes api + # is to call zesInit and set ZES_ENABLE_SYSMAN to 0 + h['ZES_ENABLE_SYSMAN'] = 0 if OPTIONS[:'backend-names'].include?('ze') end backends = [] unless need_backend diff --git a/ze/tracer_ze_helpers.include.c b/ze/tracer_ze_helpers.include.c index 31036433..b9f8179d 100644 --- a/ze/tracer_ze_helpers.include.c +++ b/ze/tracer_ze_helpers.include.c @@ -909,9 +909,9 @@ static void intializeEngines() { static int initializeHandles() { ze_result_t res; - const char *e = getenv("ZES_ENABLE_SYSMAN"); - if (!(e && e[0] == '1')) { - fprintf(stderr,"ZES_ENABLE_SYSMAN needs to be set!\n"); + res = zesInit(0); + if (res != ZE_RESULT_SUCCESS) { + _ZE_ERROR_MSG("zesInit", res); return -1; }