Skip to content

Commit

Permalink
likwid-mpirun: get abspath only once for given command line. Remove i…
Browse files Browse the repository at this point in the history
…ntermediate output files
  • Loading branch information
TomTheBear committed Nov 10, 2023
1 parent 99528e2 commit 8fc5517
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/applications/likwid-mpirun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ local executeCommand = nil
local mpiexecutable = nil
local hostpattern = "([%.%a%d_-]+)"
local pid = likwid.getpid()
local pwd = os.getenv("PWD")
local hostfilename = string.format(".hostfile_%s.txt", pid)
local scriptfilename = string.format(".likwidscript_%s.txt", pid)
local outfilename = string.format(os.getenv("PWD").."/.output_%s_%%r_%%h.csv", pid)
local outfilename = string.format("%s/.output_%s_%%r_%%h.csv", pwd, pid)
local filelist = {}

local function mpirun_exit(exitcode)
Expand All @@ -150,6 +151,7 @@ local function mpirun_exit(exitcode)
os.remove(file)
end
end
os.execute(string.format("rm --force %s/.output_%s*", pwd, pid)
os.exit(exitvalue)
end

Expand Down Expand Up @@ -2235,11 +2237,16 @@ if use_marker and #perf == 0 then
mpirun_exit(1)
end

local gotCommand = false
for i = 1, #arg do
if i > 0 then
local x = arg[i]
local t = abspath(x) or x
if string.find(x, " ") then
local t = x
if not gotCommand then
t = abspath(x) or x
end
if t ~= x then gotCommand = true end
if string.find(t, " ") then
table.insert(execList, "\""..t.."\"")
else
table.insert(execList, t)
Expand Down

0 comments on commit 8fc5517

Please sign in to comment.