Skip to content

Commit b929b44

Browse files
author
Robert McLay
committed
issue #383: Setting LUA_PATH so that the Lmod version can be determined
1 parent fe35145 commit b929b44

File tree

10 files changed

+33
-77
lines changed

10 files changed

+33
-77
lines changed

Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ifeq ($(PATH_TO_SRC),@$(path_to_src)@)
55
PATH_TO_SRC := .
66
endif
77
PATH_TO_LUA := @PATH_TO_LUA@
8-
version := $(shell cd $(srcdir)/src; $(PATH_TO_LUA)/lua -e "V=require('Version'); print(V.tag())")
8+
version := $(shell LUA_PATH="$(srcdir)/src/?.lua;" $(PATH_TO_LUA)/lua -e "V=require('Version'); print(V.tag())")
99
SITE_CONTROLLED_PREFIX := @SITE_CONTROLLED_PREFIX@
1010
MY_PACKAGE := $(prefix)/$(package)/$(version)
1111
MY_PKG_PACKAGE := $(prefix)/$(package)/$(package)

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -4020,7 +4020,7 @@ else
40204020
lmodV=$($luaprog -e "v=require('Version'); s=v.git():gsub(' .*','');print(s)")
40214021
fi
40224022
4023-
IntLuaV=$( $luaprog -e "_,_,M,m=_VERSION:gsub('Lua%s+',''):find('(%d+)%.(%d)'); print(math.floor(M*1000+m))")
4023+
IntLuaV=$( $luaprog -e "_,_,M,m=_VERSION:gsub('Lua%s+',''):find('(%d+)%.(%d)'); print(math.floor(tonumber(M)*1000+tonumber(m)))")
40244024
40254025
if test $IntLuaV -lt 5001 -o $IntLuaV -gt 5003; then
40264026
echo "Error: Lmod requires versions 5.1 or 5.2 or 5.3, You have: $LuaV"

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ else
544544
lmodV=$($luaprog -e "v=require('Version'); s=v.git():gsub(' .*','');print(s)")
545545
fi
546546

547-
IntLuaV=$( $luaprog -e "_,_,M,m=_VERSION:gsub('Lua%s+',''):find('(%d+)%.(%d)'); print(math.floor(M*1000+m))")
547+
IntLuaV=$( $luaprog -e "_,_,M,m=_VERSION:gsub('Lua%s+',''):find('(%d+)%.(%d)'); print(math.floor(tonumber(M)*1000+tonumber(m)))")
548548

549549
if test $IntLuaV -lt 5001 -o $IntLuaV -gt 5003; then
550550
echo "Error: Lmod requires versions 5.1 or 5.2 or 5.3, You have: $LuaV"

rt/mgrload_func/a.mt.txt

-42
This file was deleted.

rt/mgrload_func/err.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ _ModuleTable_ = {
6868
step 6
6969
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load avx
7070
===========================
71-
Unloading: A/1.0
72-
Unloading: C/1.0
71+
Unloading: A
72+
Unloading: C
7373
Unloading: TACC
74-
loading: A/1.0
75-
loading: C/1.0
74+
loading: A
75+
loading: C
7676
loading: TACC
7777
===========================
7878
step 7
@@ -96,6 +96,7 @@ _ModuleTable_ = {
9696
["fullName"] = "A/1.0",
9797
["loadOrder"] = 1,
9898
propT = {},
99+
["ref_count"] = 1,
99100
["stackDepth"] = 1,
100101
["status"] = "active",
101102
["userName"] = "A",
@@ -105,6 +106,7 @@ _ModuleTable_ = {
105106
["fullName"] = "C/1.0",
106107
["loadOrder"] = 2,
107108
propT = {},
109+
["ref_count"] = 1,
108110
["stackDepth"] = 1,
109111
["status"] = "active",
110112
["userName"] = "C",
@@ -114,7 +116,7 @@ _ModuleTable_ = {
114116
["fullName"] = "TACC",
115117
["loadOrder"] = 3,
116118
propT = {},
117-
["stackDepth"] = 1,
119+
["stackDepth"] = 0,
118120
["status"] = "active",
119121
["userName"] = "TACC",
120122
},

rt/mgrload_func/mf/Core/avx.lua

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
if (mode() == "load") then
22
local required = false
3-
local a = loaded_modules()
3+
local activeA = loaded_modules()
44

5-
for i = 1,#a do
6-
io.stderr:write("Unloading: ",a[i].fullName,"\n")
7-
unload(a[i].userName)
5+
for i = 1,#activeA do
6+
io.stderr:write("Unloading: ",activeA[i].userName,"\n")
7+
unload(activeA[i].userName)
88
end
99
setenv("RSNT_ARCH","avx")
10-
for i = 1,#a do
11-
io.stderr:write("loading: ",a[i].fullName,"\n")
12-
mgrload(required, a[i].userName)
10+
for i = 1,#activeA do
11+
io.stderr:write("loading: ",activeA[i].userName,"\n")
12+
mgrload(required, activeA[i])
1313
end
1414
end

rt/mgrload_func/out.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ __LMOD_REF_COUNT__LMFILES_=ProjectDIR/rt/mgrload_func/mf/Core/A/1.0.lua:1\;Proje
7575
export __LMOD_REF_COUNT__LMFILES_;
7676
_LMFILES_=ProjectDIR/rt/mgrload_func/mf/Core/A/1.0.lua:ProjectDIR/rt/mgrload_func/mf/Core/C/1.0.lua:ProjectDIR/rt/mgrload_func/mf/Core/TACC.lua:ProjectDIR/rt/mgrload_func/mf/Core/avx.lua;
7777
export _LMFILES_;
78-
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/A/1.0.lua",["fullName"]="A/1.0",["loadOrder"]=1,propT={},["stackDepth"]=1,["status"]="active",["userName"]="A",},C={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/C/1.0.lua",["fullName"]="C/1.0",["loadOrder"]=2,propT={},["stackDepth"]=1,["status"]="active",["userName"]="C",},TACC={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/TACC.lua",["fullName"]="TACC",["loadOrder"]=3,propT={},["stackDepth"]=1,["status"]="active",["userName"]="TACC",},avx={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/avx.lua",["fullName"]="avx",["loadOrder"]=4,propT={},["stackDepth"]=0,["status"]="active",["userName"]="avx",},},mpathA={"ProjectDIR/rt/mgrload_func/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/mgrload_func/mf/Core",}';
78+
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/A/1.0.lua",["fullName"]="A/1.0",["loadOrder"]=1,propT={},["ref_count"]=1,["stackDepth"]=1,["status"]="active",["userName"]="A",},C={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/C/1.0.lua",["fullName"]="C/1.0",["loadOrder"]=2,propT={},["ref_count"]=1,["stackDepth"]=1,["status"]="active",["userName"]="C",},TACC={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/TACC.lua",["fullName"]="TACC",["loadOrder"]=3,propT={},["stackDepth"]=0,["status"]="active",["userName"]="TACC",},avx={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/avx.lua",["fullName"]="avx",["loadOrder"]=4,propT={},["stackDepth"]=0,["status"]="active",["userName"]="avx",},},mpathA={"ProjectDIR/rt/mgrload_func/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/mgrload_func/mf/Core",}';
7979
export _ModuleTable_;
8080
===========================
8181
step 7
8282
lua ProjectDIR/src/lmod.in.lua bash --regression_testing list
8383
===========================
8484
MODULEPATH=ProjectDIR/rt/mgrload_func/mf/Core;
8585
export MODULEPATH;
86-
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/A/1.0.lua",["fullName"]="A/1.0",["loadOrder"]=1,propT={},["stackDepth"]=1,["status"]="active",["userName"]="A",},C={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/C/1.0.lua",["fullName"]="C/1.0",["loadOrder"]=2,propT={},["stackDepth"]=1,["status"]="active",["userName"]="C",},TACC={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/TACC.lua",["fullName"]="TACC",["loadOrder"]=3,propT={},["stackDepth"]=1,["status"]="active",["userName"]="TACC",},avx={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/avx.lua",["fullName"]="avx",["loadOrder"]=4,propT={},["stackDepth"]=0,["status"]="active",["userName"]="avx",},},mpathA={"ProjectDIR/rt/mgrload_func/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/mgrload_func/mf/Core",}';
86+
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/A/1.0.lua",["fullName"]="A/1.0",["loadOrder"]=1,propT={},["ref_count"]=1,["stackDepth"]=1,["status"]="active",["userName"]="A",},C={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/C/1.0.lua",["fullName"]="C/1.0",["loadOrder"]=2,propT={},["ref_count"]=1,["stackDepth"]=1,["status"]="active",["userName"]="C",},TACC={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/TACC.lua",["fullName"]="TACC",["loadOrder"]=3,propT={},["stackDepth"]=0,["status"]="active",["userName"]="TACC",},avx={["fn"]="ProjectDIR/rt/mgrload_func/mf/Core/avx.lua",["fullName"]="avx",["loadOrder"]=4,propT={},["stackDepth"]=0,["status"]="active",["userName"]="avx",},},mpathA={"ProjectDIR/rt/mgrload_func/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/mgrload_func/mf/Core",}';
8787
export _ModuleTable_;
8888
===========================
8989
step 8

src/Master.lua

+6-7
Original file line numberDiff line numberDiff line change
@@ -250,20 +250,19 @@ end
250250

251251
local s_stk = {}
252252

253-
function M.mgrload(self, mA)
254-
if (dbg.active()) then
255-
local s = mAList(mA)
256-
dbg.start{"Master:mgrload(mA={"..s.."})"}
257-
end
253+
function M.mgrload(self, active)
254+
dbg.start{"Master:mgrload(",active.userName,")"}
258255

259256
local mcp_old = mcp
260257
mcp = MasterControl.build("mgrload","load")
261258
dbg.print{"Setting mcp to ", mcp:name(),"\n"}
262-
local a = MCP.load(mcp,mA)
259+
local mname = MName:new("load", active.userName)
260+
mname:setRefCount(active.ref_count)
261+
mname:setStackDepth(active.stackDepth)
262+
local a = MCP.load(mcp,{mname})
263263
mcp = mcp_old
264264
dbg.print{"Setting mcp to ", mcp:name(),"\n"}
265265

266-
267266
dbg.fini("Master:mgrload")
268267
return a
269268

src/MasterControl.lua

+4-5
Original file line numberDiff line numberDiff line change
@@ -987,10 +987,9 @@ end
987987

988988

989989

990-
function M.mgrload(self, required, mA)
990+
function M.mgrload(self, required, active)
991991
if (dbg.active()) then
992-
local s = mAList(mA)
993-
dbg.start{"MasterControl:mgrload(required: ",required,", mA={"..s.."})"}
992+
dbg.start{"MasterControl:mgrload(required: ",required,", active=",active.userName,")"}
994993
end
995994

996995
if (not required) then
@@ -999,10 +998,10 @@ function M.mgrload(self, required, mA)
999998
activateWarning()
1000999
end
10011000

1002-
local a = Master:singleton():mgrload(mA)
1001+
local status = Master:singleton():mgrload(active)
10031002

10041003
dbg.fini("MasterControl:mgrload")
1005-
return a
1004+
return status
10061005
end
10071006

10081007

src/modfuncs.lua

+4-6
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,12 @@ function load_module(...)
195195
return b
196196
end
197197

198-
function mgrload(required, ...)
199-
dbg.start{"mgrload(",required, concatTbl({...},", "),")"}
200-
if (not validateModules("mgrload",...)) then return {} end
198+
function mgrload(required, active)
199+
dbg.start{"mgrload(",required,", activeA)"}
201200

202-
dbg.print{"mcp:name(): ",mcp:name(),"\n"}
203-
local b = mcp:mgrload(required, MName:buildA(mcp:MNameType(), ...))
201+
local status = mcp:mgrload(required, active)
204202
dbg.fini("mgrload")
205-
return b
203+
return status
206204
end
207205

208206

0 commit comments

Comments
 (0)