From 456f6c4158ca16a3239d2eb709349f7af59b412e Mon Sep 17 00:00:00 2001 From: Colleen Bertoni Date: Mon, 16 Feb 2026 17:43:08 +0000 Subject: [PATCH 1/3] adding robustness to the hostname indexing --- xprof/xprof.rb.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xprof/xprof.rb.in b/xprof/xprof.rb.in index ede27ab9..28fd2316 100755 --- a/xprof/xprof.rb.in +++ b/xprof/xprof.rb.in @@ -255,7 +255,13 @@ module MPITopo # (e.g. x4117c4s4b0n0.hsn.cm.aurora.alcf.anl.gov) and the Socket.gethostname is just x4117c4s4b0n0 hostnames = File.readlines(hostfile).map { |el| el.split('.', 2).first } # find index of hostname_string in list_hostnames - hostname_id = hostnames.find_index(Socket.gethostname) + hostname_id = hostnames.find_index{ |host| host.start_with?(Socket.gethostname) } + # without "start_with" this could fail if something happens like on sunspot + # where Socket.gethostname returns x1921c1s2b0n0 but the hostfile contains + # x1921c1s2b0n0-hsn0.hsn.cm.sunspot.alcf.anl.gov. + if hostname_id.nil? + raise "Trying to find the index of each hostname in the hostfile list did not work." + end # compute the offset, based on splitting MAX_UINT64_VALUE by the number of hosts [hostnames.length, hostname_id] end From d94c2a9e946bc0fa4a3974494703893bb3481cbf Mon Sep 17 00:00:00 2001 From: Colleen Bertoni Date: Mon, 16 Feb 2026 18:13:50 +0000 Subject: [PATCH 2/3] removing split from hostfile read --- xprof/xprof.rb.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xprof/xprof.rb.in b/xprof/xprof.rb.in index 28fd2316..62864cc4 100755 --- a/xprof/xprof.rb.in +++ b/xprof/xprof.rb.in @@ -253,7 +253,7 @@ module MPITopo else # splitting by "." in case the hostfile contains full hostnames with address # (e.g. x4117c4s4b0n0.hsn.cm.aurora.alcf.anl.gov) and the Socket.gethostname is just x4117c4s4b0n0 - hostnames = File.readlines(hostfile).map { |el| el.split('.', 2).first } + hostnames = File.readlines(hostfile) # find index of hostname_string in list_hostnames hostname_id = hostnames.find_index{ |host| host.start_with?(Socket.gethostname) } # without "start_with" this could fail if something happens like on sunspot From eeb9db934f0f29de6478aaba691826d17b7937b4 Mon Sep 17 00:00:00 2001 From: Colleen Bertoni Date: Mon, 16 Feb 2026 18:15:01 +0000 Subject: [PATCH 3/3] removing split from hostfile read --- xprof/xprof.rb.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/xprof/xprof.rb.in b/xprof/xprof.rb.in index 62864cc4..e9040c3b 100755 --- a/xprof/xprof.rb.in +++ b/xprof/xprof.rb.in @@ -251,8 +251,6 @@ module MPITopo number_hostname, hostname_index = if hostfile.nil? [10_000, rank_id / local_size] else - # splitting by "." in case the hostfile contains full hostnames with address - # (e.g. x4117c4s4b0n0.hsn.cm.aurora.alcf.anl.gov) and the Socket.gethostname is just x4117c4s4b0n0 hostnames = File.readlines(hostfile) # find index of hostname_string in list_hostnames hostname_id = hostnames.find_index{ |host| host.start_with?(Socket.gethostname) }