diff --git a/Makefile b/Makefile index 5739bf7e8..9052bc8db 100644 --- a/Makefile +++ b/Makefile @@ -199,10 +199,8 @@ $(L_APPS): $(addprefix $(SRC_DIR)/applications/,$(addsuffix .lua,$(L_APPS))) -e s/''/$(RELEASE)/g \ -e s/''/$(MINOR)/g \ -e s/''/$(GITCOMMIT)/g \ + -e s/''/$(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): @@ -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)/g" -e "s//$(DATE)/g" -e "s//$(RELEASE)/g" -e "s//$(GITCOMMIT)/g" -e "s//$(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)/g" -e "s//$(DATE)/g" -e "s//$(RELEASE)/g" -e "s//$(GITCOMMIT)/g" -e "s//$(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)/g" -e "s//$(DATE)/g" -e "s//$(RELEASE)/g" -e "s+$(PREFIX)/lib+$(PWD)+g" -e "s+$(PREFIX)/share/likwid/perfgroups+$(PWD)/groups+g" -e "s//$(GITCOMMIT)/g" -e "s//$(MINOR)/g" likwid.lua; diff --git a/config.mk b/config.mk index d7cca2766..a82110926 100644 --- a/config.mk +++ b/config.mk @@ -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. @@ -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 diff --git a/make/config_defines.mk b/make/config_defines.mk index 990185e1f..95017bc81 100644 --- a/make/config_defines.mk +++ b/make/config_defines.mk @@ -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 diff --git a/src/applications/likwid-features.lua b/src/applications/likwid-features.lua index 9db4212b2..d0da1e84f 100644 --- a/src/applications/likwid-features.lua +++ b/src/applications/likwid-features.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -28,7 +28,16 @@ * * ======================================================================================= ]] -package.path = '/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() diff --git a/src/applications/likwid-genTopoCfg.lua b/src/applications/likwid-genTopoCfg.lua index d57413e28..018ee4aa7 100644 --- a/src/applications/likwid-genTopoCfg.lua +++ b/src/applications/likwid-genTopoCfg.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -30,7 +30,16 @@ * * ======================================================================================= ]] -package.path = '/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") diff --git a/src/applications/likwid-memsweeper.lua b/src/applications/likwid-memsweeper.lua index e7dba3b20..f481aa3d1 100644 --- a/src/applications/likwid-memsweeper.lua +++ b/src/applications/likwid-memsweeper.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -28,7 +28,16 @@ * * ======================================================================================= ]] -package.path = '/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 diff --git a/src/applications/likwid-mpirun.lua b/src/applications/likwid-mpirun.lua index 175d3cd80..57ffe4f97 100644 --- a/src/applications/likwid-mpirun.lua +++ b/src/applications/likwid-mpirun.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -29,8 +29,16 @@ * * ======================================================================================= ]] -package.path = '/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 diff --git a/src/applications/likwid-perfctr.lua b/src/applications/likwid-perfctr.lua index ccc94a29e..26f77b366 100644 --- a/src/applications/likwid-perfctr.lua +++ b/src/applications/likwid-perfctr.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -30,7 +30,16 @@ * ======================================================================================= ]] -package.path = '/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") diff --git a/src/applications/likwid-perfscope.lua b/src/applications/likwid-perfscope.lua index 6c8e7abcb..9bff19ac7 100644 --- a/src/applications/likwid-perfscope.lua +++ b/src/applications/likwid-perfscope.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -30,7 +30,16 @@ * ======================================================================================= ]] -package.path = '/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") diff --git a/src/applications/likwid-pin.lua b/src/applications/likwid-pin.lua index caedeb960..b9538df9d 100644 --- a/src/applications/likwid-pin.lua +++ b/src/applications/likwid-pin.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -28,7 +28,16 @@ * * ======================================================================================= ]] -package.path = '/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") diff --git a/src/applications/likwid-powermeter.lua b/src/applications/likwid-powermeter.lua index 3d00679e3..1ad671738 100644 --- a/src/applications/likwid-powermeter.lua +++ b/src/applications/likwid-powermeter.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -29,7 +29,16 @@ * * ======================================================================================= ]] -package.path = '/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") diff --git a/src/applications/likwid-setFrequencies.lua b/src/applications/likwid-setFrequencies.lua index f20692016..8bbd8d6d5 100644 --- a/src/applications/likwid-setFrequencies.lua +++ b/src/applications/likwid-setFrequencies.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -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 diff --git a/src/applications/likwid-topology.lua b/src/applications/likwid-topology.lua index 67d27a43b..add6014b9 100644 --- a/src/applications/likwid-topology.lua +++ b/src/applications/likwid-topology.lua @@ -1,4 +1,4 @@ -#!/likwid-lua +#!/usr/bin/env --[[ * ======================================================================================= * @@ -30,7 +30,17 @@ * * ======================================================================================= ]] -package.path = '/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")