Skip to content

Commit

Permalink
set ZES
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Applencourt committed Sep 17, 2024
1 parent f700a26 commit 93346ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions xprof/xprof.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ze/tracer_ze_helpers.include.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 93346ad

Please sign in to comment.