Hi Kilian, a question on this: which version of Slurm/Lua are you running this 
against??

I don’t seem able to generate the RPM on 17.02.9/Lua 5.2 ; it throws similar 
errors to what I had seen earlier on the original files from Mark Grondo.

> rpmbuild --define "_sysconfdir /etc/opt" --define "__cc /usr/bin/cc 
> $(pkg-config --cflags slurm)" -ta slurm-spank-lua-0.38.tar.gz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.bUiy3F
+ umask 022
+ cd /users/builduser/rpmbuild/BUILD
+ cd /users/builduser/rpmbuild/BUILD
+ rm -rf slurm-spank-lua-0.38
+ /usr/bin/gzip -dc 
/users/builduser/workarea/job_environment/slurm-spank-lua-0.38.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd slurm-spank-lua-0.38
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.p3xXXA
+ umask 022
+ cd /users/builduser/rpmbuild/BUILD
+ /usr/bin/rm -rf /tmp/builduser/BUILDROOT
++ dirname /tmp/builduser/BUILDROOT
+ /usr/bin/mkdir -p /tmp/builduser
+ /usr/bin/mkdir /tmp/builduser/BUILDROOT
+ cd slurm-spank-lua-0.38
+ /usr/bin/cc -I/opt/slurm/17.02.9/include -g -o lua.o -fPIC -c lua.c
lua.c: In function ‘lua_script_create’:
lua.c:1048:31: error: ‘LUA_GLOBALSINDEX’ undeclared (first use in this function)
     lua_pushvalue (script->L, LUA_GLOBALSINDEX);
                               ^
lua.c:1048:31: note: each undeclared identifier is reported only once for each 
function it appears in
error: Bad exit status from /var/tmp/rpm-tmp.p3xXXA (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.p3xXXA (%build)

Does anybody have an idea to get this to build and work? I’ve done some 
research, but my knowledge of Lua is very basic and the things I’ve tried ([1] 
and [2]) did not help at all. In fact, I’ve changed the source to look like 
this:

> diff -Naur slurm-spank-lua-0.38-modified/lua.c slurm-spank-lua-0.38/lua.c
--- slurm-spank-lua-0.38-modified/lua.c 2018-01-23 13:33:15.808026439 +0100
+++ slurm-spank-lua-0.38/lua.c  2018-01-22 19:56:54.000000000 +0100
@@ -1045,8 +1045,7 @@
      *   table.
      */
     lua_pushstring (script->L, "__index");
-    lua_setglobal (script->L, "__index");
-    //lua_pushvalue (script->L, LUA_GLOBALSINDEX);
+    lua_pushvalue (script->L, LUA_GLOBALSINDEX);
     lua_settable (script->L, -3);

     /*  Now set metatable for the new globals table */
@@ -1055,7 +1054,7 @@
     /*  And finally replace the globals table with the (empty)  table
      *   now at top of the stack
      */
-    //lua_replace (script->L, LUA_GLOBALSINDEX);
+    lua_replace (script->L, LUA_GLOBALSINDEX);

     return script;
 }

And, although it initially builds, in the end it dies miserably:

> srun --help
PANIC: unprotected error in call to Lua API (attempt to index a nil value)
Aborted

Thanks,
M.

[1] 
https://stackoverflow.com/questions/9057943/porting-to-lua-5-2-lua-globalsindex-trouble?rq=1
 
<https://stackoverflow.com/questions/9057943/porting-to-lua-5-2-lua-globalsindex-trouble?rq=1>
[2] 
https://stackoverflow.com/questions/10087226/lua-5-2-lua-globalsindex-alternative
 
<https://stackoverflow.com/questions/10087226/lua-5-2-lua-globalsindex-alternative>

> On 23 Jan 2018, at 00:20, Kilian Cavalotti <kilian.cavalotti.w...@gmail.com> 
> wrote:
> 
> Hi all,
> 
> We (Stanford Research Computing Center) developed a SPANK plugin which
> allows users to choose the GPU compute mode [1] for their jobs.
> [1] 
> http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#compute-modes
> 
> This came from the need to give our users some control on the way GPUs
> are set, so they could run specific applications requiring a given
> mode, while providing defaults optimized for our general environment.
> 
> We figured it could be of interest to others, so we released our Slurm
> SPANK GPU Compute Mode plugin at
> https://github.com/stanford-rc/slurm-spank-gpu_cmode
> 
> Feel free to give it a try, and don't hesitate to contact us if you
> have any question.
> 
> 
> Cheers,
> -- 
> Kilian
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to