1 /* SimGrid Lua bindings */
3 /* Copyright (c) 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
13 #include "simdag/simdag.h"
16 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua,bindings,"Lua Bindings");
18 #define TASK_MODULE_NAME "simgrid.Task"
19 #define HOST_MODULE_NAME "simgrid.Host"
20 // Surf ( bypass XML )
21 #define LINK_MODULE_NAME "simgrid.Link"
22 #define ROUTE_MODULE_NAME "simgrid.Route"
24 /* ********************************************************************************* */
25 /* helper functions */
26 /* ********************************************************************************* */
27 static void stackDump (const char *msg, lua_State *L) {
31 int top = lua_gettop(L);
34 p+=sprintf(p,"STACK(top=%d): ",top);
36 for (i = 1; i <= top; i++) { /* repeat for each level */
37 int t = lua_type(L, i);
40 case LUA_TSTRING: /* strings */
41 p+=sprintf(p,"`%s'", lua_tostring(L, i));
44 case LUA_TBOOLEAN: /* booleans */
45 p+=sprintf(p,lua_toboolean(L, i) ? "true" : "false");
48 case LUA_TNUMBER: /* numbers */
49 p+=sprintf(p,"%g", lua_tonumber(L, i));
53 p+=sprintf(p, "Table");
56 default: /* other values */
58 /* if ((ptr = luaL_checkudata(L,i,TASK_MODULE_NAME))) {
61 p+=printf(p,"%s", lua_typename(L, t));
66 p+=sprintf(p," "); /* put a separator */
68 INFO2("%s%s",msg,buff);
71 /** @brief ensures that a userdata on the stack is a task and returns the pointer inside the userdata */
72 static m_task_t checkTask (lua_State *L,int index) {
74 luaL_checktype(L,index,LUA_TTABLE);
75 lua_getfield(L,index,"__simgrid_task");
76 pi = (m_task_t*)luaL_checkudata(L,-1,TASK_MODULE_NAME);
78 luaL_typerror(L,index,TASK_MODULE_NAME);
81 luaL_error(L,"null Task");
85 /* ********************************************************************************* */
86 /* wrapper functions */
87 /* ********************************************************************************* */
90 * A task is either something to compute somewhere, or something to exchange between two hosts (or both).
91 * It is defined by a computing amount and a message size.
99 * Construct an new task with the specified processing amount and amount
102 * @param name Task's name
104 * @param computeDuration A value of the processing amount (in flop) needed to process the task.
105 * If 0, then it cannot be executed with the execute() method.
106 * This value has to be >= 0.
108 * @param messageSize A value of amount of data (in bytes) needed to transfert this task.
109 * If 0, then it cannot be transfered with the get() and put() methods.
110 * This value has to be >= 0.
112 static int Task_new(lua_State* L) {
113 const char *name=luaL_checkstring(L,1);
114 int comp_size = luaL_checkint(L,2);
115 int msg_size = luaL_checkint(L,3);
116 m_task_t msg_task = MSG_task_create(name,comp_size,msg_size,NULL);
117 lua_newtable (L); /* create a table, put the userdata on top of it */
118 m_task_t *lua_task = (m_task_t*)lua_newuserdata(L,sizeof(m_task_t));
119 *lua_task = msg_task;
120 luaL_getmetatable(L,TASK_MODULE_NAME);
121 lua_setmetatable(L,-2);
122 lua_setfield (L, -2, "__simgrid_task"); /* put the userdata as field of the table */
123 /* remove the args from the stack */
130 static int Task_get_name(lua_State *L) {
131 m_task_t tk = checkTask(L,-1);
132 lua_pushstring(L,MSG_task_get_name(tk));
136 static int Task_computation_duration(lua_State *L){
137 m_task_t tk = checkTask(L,-1);
138 lua_pushnumber(L,MSG_task_get_compute_duration (tk));
142 static int Task_execute(lua_State *L){
143 m_task_t tk = checkTask(L,-1);
144 int res = MSG_task_execute(tk);
145 lua_pushnumber(L,res);
149 static int Task_destroy(lua_State *L) {
150 m_task_t tk = checkTask(L,-1);
151 int res = MSG_task_destroy(tk);
152 lua_pushnumber(L,res);
156 static int Task_send(lua_State *L) {
157 //stackDump("send ",L);
158 m_task_t tk = checkTask(L,-2);
159 const char *mailbox = luaL_checkstring(L,-1);
160 lua_pop(L,1); // remove the string so that the task is on top of it
161 MSG_task_set_data(tk,L); // Copy my stack into the task, so that the receiver can copy the lua task directly
162 MSG_error_t res = MSG_task_send(tk,mailbox);
163 while (MSG_task_get_data(tk)!=NULL) // Don't mess up with my stack: the receiver didn't copy the data yet
164 MSG_process_sleep(0); // yield
166 if (res != MSG_OK) switch(res) {
168 ERROR0("MSG_task_send failed : Timeout");
170 case MSG_TRANSFER_FAILURE :
171 ERROR0("MSG_task_send failed : Transfer Failure");
173 case MSG_HOST_FAILURE :
174 ERROR0("MSG_task_send failed : Host Failure ");
177 ERROR0("MSG_task_send failed : Unexpected error , please report this bug");
183 static int Task_recv(lua_State *L) {
185 const char *mailbox = luaL_checkstring(L,-1);
186 MSG_error_t res = MSG_task_receive(&tk,mailbox);
188 lua_State *sender_stack = MSG_task_get_data(tk);
189 lua_xmove(sender_stack,L,1); // copy the data directly from sender's stack
190 MSG_task_set_data(tk,NULL);
192 if(res != MSG_OK) switch(res){
194 ERROR0("MSG_task_receive failed : Timeout");
196 case MSG_TRANSFER_FAILURE :
197 ERROR0("MSG_task_receive failed : Transfer Failure");
199 case MSG_HOST_FAILURE :
200 ERROR0("MSG_task_receive failed : Host Failure ");
203 ERROR0("MSG_task_receive failed : Unexpected error , please report this bug");
210 static const luaL_reg Task_methods[] = {
212 {"name", Task_get_name},
213 {"computation_duration", Task_computation_duration},
214 {"execute", Task_execute},
215 {"destroy", Task_destroy},
220 static int Task_gc(lua_State *L) {
221 m_task_t tk=checkTask(L,-1);
222 if (tk) MSG_task_destroy(tk);
226 static int Task_tostring(lua_State *L) {
227 lua_pushfstring(L, "Task :%p",lua_touserdata(L,1));
231 static const luaL_reg Task_meta[] = {
233 {"__tostring", Task_tostring},
240 static m_host_t checkHost (lua_State *L,int index) {
242 luaL_checktype(L,index,LUA_TTABLE);
243 lua_getfield(L,index,"__simgrid_host");
244 pi = (m_host_t*)luaL_checkudata(L,-1,HOST_MODULE_NAME);
246 luaL_typerror(L,index,HOST_MODULE_NAME);
249 luaL_error(L,"null Host");
254 static int Host_get_by_name(lua_State *L)
256 const char *name=luaL_checkstring(L,1);
257 DEBUG0("Getting Host from name...");
258 m_host_t msg_host = MSG_get_host_by_name(name);
261 luaL_error(L,"null Host : MSG_get_host_by_name failled");
263 lua_newtable (L); /* create a table, put the userdata on top of it */
264 m_host_t *lua_host = (m_host_t*)lua_newuserdata(L,sizeof(m_host_t));
265 *lua_host = msg_host;
266 luaL_getmetatable(L,HOST_MODULE_NAME);
267 lua_setmetatable(L,-2);
268 lua_setfield (L, -2, "__simgrid_host"); /* put the userdata as field of the table */
269 /* remove the args from the stack */
275 static int Host_get_name(lua_State *L) {
276 m_host_t ht = checkHost(L,-1);
277 lua_pushstring(L,MSG_host_get_name(ht));
281 static int Host_number(lua_State *L) {
282 lua_pushnumber(L,MSG_get_host_number());
286 static int Host_at(lua_State *L)
288 int index = luaL_checkinteger(L,1);
289 m_host_t host = MSG_get_host_table()[index-1]; // lua indexing start by 1 (lua[1] <=> C[0])
290 lua_newtable (L); /* create a table, put the userdata on top of it */
291 m_host_t *lua_host = (m_host_t*)lua_newuserdata(L,sizeof(m_host_t));
293 luaL_getmetatable(L,HOST_MODULE_NAME);
294 lua_setmetatable(L,-2);
295 lua_setfield (L, -2, "__simgrid_host"); /* put the userdata as field of the table */
300 /*****************************************************************************************
301 * BYPASS XML SURF Methods *
302 ***************************
303 ***************************
304 ******************************************************************************************/
305 #include "surf/surfxml_parse.h" /* to override surf_parse and bypass the parser */
306 #include "surf/surf_private.h"
307 typedef struct t_host_attr
310 // Mandatory attributes
313 // Optional attributes
315 const char *power_trace;
317 const char *state_trace;
318 //deployment attribute
319 const char* function;
320 xbt_dynar_t args_list;
321 }host_attr,*p_host_attr;
323 typedef struct t_link_attr
328 }link_attr,*p_link_attr;
330 typedef struct t_route_attr
334 xbt_dynar_t links_id;
336 }route_attr,*p_route_attr;
338 //using xbt_dynar_t :
339 static xbt_dynar_t host_list_d ;
340 static xbt_dynar_t link_list_d ;
341 static xbt_dynar_t route_list_d ;
345 * create host resource via CPU model [for MSG]
348 static void create_host(const char* id,double power_peak,double power_sc,
349 const char* power_tr,int state_init,
350 const char* state_tr)
353 double power_scale = 1.0;
354 tmgr_trace_t power_trace = NULL;
355 e_surf_resource_state_t state_initial;
356 tmgr_trace_t state_trace;
358 power_scale = power_sc;
359 if (state_init == -1)
360 state_initial = SURF_RESOURCE_OFF;
362 state_initial = SURF_RESOURCE_ON;
364 power_trace = tmgr_trace_new(power_tr);
366 power_trace = tmgr_trace_new("");
368 state_trace = tmgr_trace_new(state_tr);
370 state_trace = tmgr_trace_new("");
371 current_property_set = xbt_dict_new();
372 surf_host_create_resource(xbt_strdup(id), power_peak, power_scale,
373 power_trace, state_initial, state_trace, current_property_set);
378 *create host resource via workstation_ptask_L07 model [for SimDag]
380 static void create_host_wsL07(const char* id,double power_peak,double power_sc,
381 const char* power_tr,int state_init,
382 const char* state_tr)
384 double power_scale = 1.0;
385 tmgr_trace_t power_trace = NULL;
386 e_surf_resource_state_t state_initial;
387 tmgr_trace_t state_trace;
389 power_scale = power_sc;
390 if (state_init == -1)
391 state_initial = SURF_RESOURCE_OFF;
393 state_initial = SURF_RESOURCE_ON;
395 power_trace = tmgr_trace_new(power_tr);
397 power_trace = tmgr_trace_new("");
399 state_trace = tmgr_trace_new(state_tr);
401 state_trace = tmgr_trace_new("");
402 current_property_set = xbt_dict_new();
403 surf_wsL07_host_create_resource(xbt_strdup(id), power_peak, power_scale,
404 power_trace, state_initial, state_trace, current_property_set);
408 * add new host to platform hosts list
410 static int Host_new(lua_State *L)
413 if(xbt_dynar_is_empty(host_list_d))
414 host_list_d = xbt_dynar_new(sizeof(p_host_attr), &xbt_free_ref);
418 const char *power_trace;
419 const char *state_trace;
420 double power,power_scale;
422 //get values from the table passed as argument
423 if (lua_istable(L,-1)) {
426 lua_pushstring(L,"id");
427 lua_gettable(L, -2 );
428 id = lua_tostring(L,-1);
432 lua_pushstring(L,"power");
433 lua_gettable(L, -2 );
434 power = lua_tonumber(L,-1);
438 lua_pushstring(L,"power_scale");
439 lua_gettable(L, -2 );
440 power_scale = lua_tonumber(L,-1);
444 lua_pushstring(L,"power_trace");
445 lua_gettable(L, -2 );
446 power_trace = lua_tostring(L,-1);
450 lua_pushstring(L,"state_initial");
451 lua_gettable(L, -2 );
452 state_initial = lua_tonumber(L,-1);
456 lua_pushstring(L,"state_trace");
457 lua_gettable(L, -2 );
458 state_trace = lua_tostring(L,-1);
462 ERROR0("Bad Arguments to create host, Should be a table with named arguments");
466 host = malloc(sizeof(host_attr));
468 host->power_peak = power;
469 host->power_scale = power_scale;
470 host->power_trace = power_trace;
471 host->state_initial = state_initial;
472 host->state_trace = state_trace;
473 host->function = NULL;
474 xbt_dynar_push(host_list_d, &host);
480 * add link to platform links list
482 static int Link_new(lua_State *L) // (id,bandwidth,latency)
484 if(xbt_dynar_is_empty(link_list_d))
485 link_list_d = xbt_dynar_new(sizeof(p_link_attr), &xbt_free_ref);
488 double bandwidth,latency;
489 //get values from the table passed as argument
490 if (lua_istable(L,-1)) {
492 lua_pushstring(L,"id");
493 lua_gettable(L, -2 );
494 id = lua_tostring(L,-1);
497 // get bandwidth value
498 lua_pushstring(L,"bandwidth");
499 lua_gettable(L, -2 );
500 bandwidth = lua_tonumber(L,-1);
504 lua_pushstring(L,"latency");
505 lua_gettable(L, -2 );
506 latency = lua_tonumber(L,-1);
510 ERROR0("Bad Arguments to create link, Should be a table with named arguments");
514 p_link_attr link = malloc(sizeof(link_attr));
516 link->bandwidth = bandwidth;
517 link->latency = latency;
518 xbt_dynar_push(link_list_d,&link);
523 * add route to platform routes list
525 static int Route_new(lua_State *L) // (src_id,dest_id,links_number,link_table)
527 if(xbt_dynar_is_empty(route_list_d))
528 route_list_d = xbt_dynar_new(sizeof(p_route_attr), &xbt_free_ref);
529 const char * link_id;
530 p_route_attr route = malloc(sizeof(route_attr));
531 route->src_id = luaL_checkstring(L,1);
532 route->dest_id = luaL_checkstring(L,2);
533 route->links_id = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
535 while (lua_next(L,3) != 0) {
536 link_id = lua_tostring(L, -1);
537 xbt_dynar_push(route->links_id, &link_id);
538 DEBUG2("index = %f , Link_id = %s \n",lua_tonumber(L, -2),lua_tostring(L, -1));
543 //add route to platform's route list
544 xbt_dynar_push(route_list_d,&route);
549 * set function to process
551 static int Host_set_function(lua_State *L) //(host,function,nb_args,list_args)
553 // look for the index of host in host_list
554 const char *host_id = luaL_checkstring(L,1);
555 const char* argument;
559 xbt_dynar_foreach(host_list_d,i,p_host)
561 if(p_host->id == host_id)
563 p_host->function = luaL_checkstring(L,2);
564 p_host->args_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
565 // fill the args list
568 while (lua_next(L,3) != 0) {
569 argument = lua_tostring(L, -1);
570 xbt_dynar_push(p_host->args_list, &argument);
571 DEBUG2("index = %f , Arg_id = %s \n",lua_tonumber(L, -2),lua_tostring(L, -1));
579 ERROR1("Host : %s Not Fount !!",host_id);
584 * surf parse bypass platform
585 * through CPU/network Models
588 static int surf_parse_bypass_platform()
593 p_route_attr p_route;
596 xbt_dynar_foreach(host_list_d,i,p_host)
598 create_host(p_host->id,p_host->power_peak,p_host->power_scale,p_host->power_trace,
599 p_host->state_initial,p_host->state_trace);
600 //add to routing model host list
601 surf_route_add_host((char*)p_host->id);
605 xbt_dynar_foreach(link_list_d,i,p_link)
607 surf_link_create_resource((char*)p_link->id,p_link->bandwidth,p_link->latency);
610 xbt_dynar_foreach(route_list_d,i,p_route)
612 surf_route_set_resource((char*)p_route->src_id,(char*)p_route->dest_id,p_route->links_id,0);
616 surf_add_host_traces();
618 surf_add_link_traces();
620 return 0; // must return 0 ?!!
626 * surf parse bypass platform
627 * through workstation_ptask_L07 Model
631 static int surf_wsL07_parse_bypass_platform()
636 p_route_attr p_route;
639 xbt_dynar_foreach(host_list_d,i,p_host)
641 create_host_wsL07(p_host->id,p_host->power_peak,p_host->power_scale,p_host->power_trace,
642 p_host->state_initial,p_host->state_trace);
643 //add to routing model host list
644 surf_route_add_host((char*)p_host->id);
648 xbt_dynar_foreach(link_list_d,i,p_link)
650 surf_wsL07_link_create_resource((char*)p_link->id,p_link->bandwidth,p_link->latency);
653 xbt_dynar_foreach(route_list_d,i,p_route)
655 surf_route_set_resource((char*)p_route->src_id,(char*)p_route->dest_id,p_route->links_id,0);
659 surf_wsL07_add_traces();
666 * surf parse bypass application for MSG Module
668 static int surf_parse_bypass_application()
672 xbt_dynar_foreach(host_list_d,i,p_host)
675 MSG_set_function(p_host->id,p_host->function,p_host->args_list);
680 //***********Register Methods *******************************************//
684 static const luaL_reg Host_methods[] = {
685 {"getByName", Host_get_by_name},
686 {"name", Host_get_name},
687 {"number", Host_number},
689 // Bypass XML Methods
691 {"setFunction", Host_set_function},
695 static int Host_gc(lua_State *L)
697 m_host_t ht = checkHost(L,-1);
702 static int Host_tostring(lua_State *L)
704 lua_pushfstring(L,"Host :%p",lua_touserdata(L,1));
708 static const luaL_reg Host_meta[] = {
710 {"__tostring", Host_tostring},
717 static const luaL_reg Link_methods[] = {
724 static const luaL_reg Route_methods[] ={
730 * Environment related
733 extern lua_State *simgrid_lua_state;
735 static int run_lua_code(int argc,char **argv) {
736 DEBUG1("Run lua code %s",argv[0]);
737 lua_State *L = lua_newthread(simgrid_lua_state);
738 int ref = luaL_ref(simgrid_lua_state, LUA_REGISTRYINDEX); // protect the thread from being garbage collected
741 /* Start the co-routine */
742 lua_getglobal(L,argv[0]);
743 xbt_assert1(lua_isfunction(L,-1),
744 "The lua function %s does not seem to exist",argv[0]);
746 // push arguments onto the stack
749 lua_pushstring(L,argv[i]);
751 // Call the function (in resume)
752 xbt_assert2(lua_pcall(L, argc-1, 1, 0) == 0,
753 "error running function `%s': %s",argv[0], lua_tostring(L, -1));
755 /* retrieve result */
756 if (lua_isnumber(L, -1)) {
757 res = lua_tonumber(L, -1);
758 lua_pop(L, 1); /* pop returned value */
761 luaL_unref(simgrid_lua_state,LUA_REGISTRYINDEX,ref );
762 DEBUG1("Execution of lua code %s is over", (argv ? argv[0] : "(null)"));
765 static int launch_application(lua_State *L) {
766 const char * file = luaL_checkstring(L,1);
767 MSG_function_register_default(run_lua_code);
768 MSG_launch_application(file);
771 #include "simix/simix.h" //FIXME: KILLME when debugging on simix internals become useless
772 static int create_environment(lua_State *L) {
773 const char *file = luaL_checkstring(L,1);
774 DEBUG1("Loading environment file %s",file);
775 MSG_create_environment(file);
776 smx_host_t *hosts = SIMIX_host_get_table();
778 for (i=0;i<SIMIX_host_get_number();i++) {
779 DEBUG1("We have an host %s", SIMIX_host_get_name(hosts[i]));
785 static int debug(lua_State *L) {
786 const char *str = luaL_checkstring(L,1);
790 static int info(lua_State *L) {
791 const char *str = luaL_checkstring(L,1);
795 static int run(lua_State *L) {
799 static int clean(lua_State *L) {
809 * Register platform for MSG
811 static int msg_register_platform(lua_State *L)
813 /* Tell Simgrid we dont wanna use its parser*/
814 surf_parse = surf_parse_bypass_platform;
815 MSG_create_environment(NULL);
820 * Register platform for Simdag
823 static int sd_register_platform(lua_State *L)
825 surf_parse = surf_wsL07_parse_bypass_platform;
826 SD_create_environment(NULL);
830 * Register applicaiton for MSG
832 static int msg_register_application(lua_State *L)
834 MSG_function_register_default(run_lua_code);
835 surf_parse = surf_parse_bypass_application;
836 MSG_launch_application(NULL);
840 static const luaL_Reg simgrid_funcs[] = {
841 { "create_environment", create_environment},
842 { "launch_application", launch_application},
848 { "platform", create_environment},
849 { "application", launch_application},
850 /* methods to bypass XML parser*/
851 { "msg_register_platform",msg_register_platform},
852 { "sd_register_platform",sd_register_platform},
853 { "msg_register_application",msg_register_application},
857 /* ********************************************************************************* */
858 /* module management functions */
859 /* ********************************************************************************* */
861 extern const char*xbt_ctx_factory_to_use; /*Hack: let msg load directly the right factory */
863 #define LUA_MAX_ARGS_COUNT 10 /* maximum amount of arguments we can get from lua on command line */
865 int luaopen_simgrid(lua_State* L); // Fuck gcc: we don't need that prototype
866 int luaopen_simgrid(lua_State* L) {
868 //xbt_ctx_factory_to_use = "lua";
869 char **argv=malloc(sizeof(char*)*LUA_MAX_ARGS_COUNT);
871 argv[0] = (char*)"/usr/bin/lua"; /* Lie on the argv[0] so that the stack dumping facilities find the right binary. FIXME: what if lua is not in that location? */
872 /* Get the command line arguments from the lua interpreter */
873 lua_getglobal(L,"arg");
874 /* if arg is a null value, it means we use lua only as a script to init platform
875 * else it should be a table and then take arg in consideration
877 if(lua_istable(L,-1))
882 lua_pushinteger(L,argc-2);
884 if (lua_isnil(L,-1)) {
887 xbt_assert1(lua_isstring(L,-1),"argv[%d] got from lua is no string",argc-1);
888 xbt_assert2(argc<LUA_MAX_ARGS_COUNT,
889 "Too many arguments, please increase LUA_MAX_ARGS_COUNT in %s before recompiling SimGrid if you insist on having more than %d args on command line",
890 __FILE__,LUA_MAX_ARGS_COUNT-1);
891 argv[argc-1] = (char*)luaL_checkstring(L,-1);
893 DEBUG1("Got command line argument %s from lua",argv[argc-1]);
898 /* Initialize the MSG core */
899 MSG_global_init(&argc,argv);
900 DEBUG1("Still %d arguments on command line",argc); // FIXME: update the lua's arg table to reflect the changes from SimGrid
902 /* register the core C functions to lua */
903 luaL_register(L, "simgrid", simgrid_funcs);
904 /* register the task methods to lua */
905 luaL_openlib(L,TASK_MODULE_NAME,Task_methods,0); //create methods table,add it to the globals
906 luaL_newmetatable(L,TASK_MODULE_NAME); //create metatable for Task,add it to the Lua registry
907 luaL_openlib(L,0,Task_meta,0);// fill metatable
908 lua_pushliteral(L,"__index");
909 lua_pushvalue(L,-3); //dup methods table
910 lua_rawset(L,-3); //matatable.__index = methods
911 lua_pushliteral(L,"__metatable");
912 lua_pushvalue(L,-3); //dup methods table
913 lua_rawset(L,-3); //hide metatable:metatable.__metatable = methods
914 lua_pop(L,1); //drop metatable
916 /* register the hosts methods to lua*/
917 luaL_openlib(L,HOST_MODULE_NAME,Host_methods,0);
918 luaL_newmetatable(L,HOST_MODULE_NAME);
919 luaL_openlib(L,0,Host_meta,0);
920 lua_pushliteral(L,"__index");
923 lua_pushliteral(L,"__metatable");
928 /* register the links methods to lua*/
929 luaL_openlib(L,LINK_MODULE_NAME,Link_methods,0);
930 luaL_newmetatable(L,LINK_MODULE_NAME);
933 /*register the routes methods to lua*/
934 luaL_openlib(L,ROUTE_MODULE_NAME,Route_methods,0);
935 luaL_newmetatable(L,LINK_MODULE_NAME);
938 /* Keep the context mechanism informed of our lua world today */
939 simgrid_lua_state = L;