Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relocatable LIKWID installation #480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,8 @@ $(L_APPS): $(addprefix $(SRC_DIR)/applications/,$(addsuffix .lua,$(L_APPS)))
-e s/'<RELEASE>'/$(RELEASE)/g \
-e s/'<MINOR>'/$(MINOR)/g \
-e s/'<GITCOMMIT>'/$(GITCOMMIT)/g \
-e s/'<LIKWID_LUA_INTERPRETER>'/$(LIKWID_LUA_INTERPRETER)/g \
$(addprefix $(SRC_DIR)/applications/,$(addsuffix .lua,$@)) > $@
@if [ "$(LUA_INTERNAL)" = "false" ]; then \
sed -i -e s+"$(subst /,\\/,$(INSTALLED_BINPREFIX))/likwid-lua"+"$(LUA_BIN)/$(LUA_LIB_NAME)"+ $@; \
fi
@if [ "$(ACCESSMODE)" = "direct" ]; then sed -i -e s/"access_mode = 0"/"access_mode = 1"/g $(SRC_DIR)/applications/$@.lua;fi

$(L_HELPER):
Expand Down Expand Up @@ -705,7 +703,7 @@ local: $(L_APPS) likwid.lua
@echo "===> Setting Lua scripts to run from current directory"
@PWD=$(shell pwd)
@for APP in $(L_APPS); do \
sed -i -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" -e "s/<RELEASE>/$(RELEASE)/g" -e "s/<GITCOMMIT>/$(GITCOMMIT)/g" -e "s/<MINOR>/$(MINOR)/g" -e "s+$(PREFIX)/bin/likwid-lua+$(PWD)/ext/lua/lua+" -e "s+$(PREFIX)/share/lua/?.lua+$(PWD)/?.lua+" -e "s+$(PREFIX)/bin/likwid-pin+$(PWD)/likwid-pin+" -e "s+$(PREFIX)/bin/likwid-perfctr+$(PWD)/likwid-perfctr+" $$APP; \
sed -i -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" -e "s/<RELEASE>/$(RELEASE)/g" -e "s/<GITCOMMIT>/$(GITCOMMIT)/g" -e "s/<MINOR>/$(MINOR)/g" -e "s+$/usr/bin/env $(LIKWID_LUA_INTERPRETER)+$(PWD)/ext/lua/lua+" -e "s+$(PREFIX)/share/lua/?.lua+$(PWD)/?.lua+" -e "s+$(PREFIX)/bin/likwid-pin+$(PWD)/likwid-pin+" -e "s+$(PREFIX)/bin/likwid-perfctr+$(PWD)/likwid-perfctr+" $$APP; \
chmod +x $$APP; \
done
@sed -i -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" -e "s/<RELEASE>/$(RELEASE)/g" -e "s+$(PREFIX)/lib+$(PWD)+g" -e "s+$(PREFIX)/share/likwid/perfgroups+$(PWD)/groups+g" -e "s/<GITCOMMIT>/$(GITCOMMIT)/g" -e "s/<MINOR>/$(MINOR)/g" likwid.lua;
Expand Down
4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
COMPILER = GCC#NO SPACE

# Path were to install likwid
PREFIX ?= /usr/local#NO SPACE
PREFIX ?= /home/unrz139/.modules/likwid-master#NO SPACE

# Set the default mode for MSR access.
# This can usually be overriden on the commandline.
Expand Down Expand Up @@ -104,7 +104,7 @@ INSTALL_CHOWN = -g root -o root#NO SPACE
SHARED_LIBRARY = true#NO SPACE

# Build LIKWID with debug flags
DEBUG = false#NO SPACE
DEBUG = true#NO SPACE

# Basic configuration for some internal arrays.
# Maximal number of hardware threads
Expand Down
2 changes: 2 additions & 0 deletions make/config_defines.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ PWD ?= $(shell pwd)
# LUA:
ifdef LUA_INCLUDE_DIR
LUA_INTERNAL := false#NO SPACE
LIKWID_LUA_INTERPRETER := lua#NO SPACE
else
LUA_FOLDER := $(PWD)/ext/lua#NO SPACE
LUA_INCLUDE_DIR := $(LUA_FOLDER)/includes#NO SPACE
LUA_LIB_DIR := $(LUA_FOLDER)#NO SPACE
LUA_LIB_NAME := likwid-lua#NO SPACE
LUA_INTERNAL := true#NO SPACE
LIKWID_LUA_INTERPRETER := likwid-lua#NO SPACE
endif
SHARED_LIBLUA := lib$(LUA_LIB_NAME).so
STATIC_LIBLUA := lib$(LUA_LIB_NAME).a
Expand Down
13 changes: 11 additions & 2 deletions src/applications/likwid-features.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -28,7 +28,16 @@
*
* =======================================================================================
]]
package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path
function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path

local likwid = require("likwid")
local cpuinfo = likwid.getCpuInfo()
Expand Down
13 changes: 11 additions & 2 deletions src/applications/likwid-genTopoCfg.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -30,7 +30,16 @@
*
* =======================================================================================
]]
package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path
function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path

local likwid = require("likwid")

Expand Down
13 changes: 11 additions & 2 deletions src/applications/likwid-memsweeper.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -28,7 +28,16 @@
*
* =======================================================================================
]]
package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path
function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path
local likwid = require("likwid")

print_stdout = print
Expand Down
14 changes: 11 additions & 3 deletions src/applications/likwid-mpirun.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -29,8 +29,16 @@
*
* =======================================================================================
]]
package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path

function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path
local likwid = require("likwid")

print_stdout = print
Expand Down
13 changes: 11 additions & 2 deletions src/applications/likwid-perfctr.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -30,7 +30,16 @@
* =======================================================================================
]]

package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path
function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path

local likwid = require("likwid")

Expand Down
13 changes: 11 additions & 2 deletions src/applications/likwid-perfscope.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -30,7 +30,16 @@
* =======================================================================================
]]

package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path
function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path

local likwid = require("likwid")

Expand Down
13 changes: 11 additions & 2 deletions src/applications/likwid-pin.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -28,7 +28,16 @@
*
* =======================================================================================
]]
package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path
function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path

local likwid = require("likwid")

Expand Down
13 changes: 11 additions & 2 deletions src/applications/likwid-powermeter.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -29,7 +29,16 @@
*
* =======================================================================================
]]
package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path
function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path

local likwid = require("likwid")

Expand Down
6 changes: 3 additions & 3 deletions src/applications/likwid-setFrequencies.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -210,9 +210,9 @@ for opt,arg in likwid.getopt(arg, {"V:", "g:", "c:", "f:", "l", "p", "h", "v", "
elseif opt == "ureset" then
do_ureset = true
elseif opt == "umin" then
if arg then min_u_freq = tostring(arg) end
if arg then min_u_freq = tonumber(arg) end
elseif opt == "umax" then
if arg then max_u_freq = tostring(arg) end
if arg then max_u_freq = tonumber(arg) end
elseif (opt == "p") then
printCurFreq = true
elseif (opt == "l") then
Expand Down
14 changes: 12 additions & 2 deletions src/applications/likwid-topology.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!<INSTALLED_BINPREFIX>/likwid-lua
#!/usr/bin/env <LIKWID_LUA_INTERPRETER>
--[[
* =======================================================================================
*
Expand Down Expand Up @@ -30,7 +30,17 @@
*
* =======================================================================================
]]
package.path = '<INSTALLED_PREFIX>/share/lua/?.lua;' .. package.path

function requirePath()
local binfp = io.popen(string.format('which %s 2>/dev/null', arg[0]))
if binfp ~= nil then
local binpath = binfp:read("*a")
binfp:close()
local sharepath = string.format("%s/../share/lua/?.lua;", binpath:match("(.*/)") or ".")
return sharepath
end
end
package.path = requirePath() .. package.path

local likwid = require("likwid")

Expand Down