Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / smpi / smpi_global.c
index bc190ba..572cdda 100644 (file)
@@ -13,6 +13,7 @@
 #include "mc/mc.h"
 #include "surf/surf.h"
 #include "simix/smx_private.h"
+#include "simgrid/sg_config.h"
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi,
@@ -288,18 +289,24 @@ void smpi_global_destroy(void)
 /* With smpiff, the following weak symbols are replaced by those in libf2c */
 int __attribute__((weak)) xargc;
 char** __attribute__((weak)) xargv;
-
-int __attribute__((weak)) smpi_simulated_main(int argc, char** argv) {
+void __attribute__((weak)) user_main__(){
   xbt_die("Should not be in this smpi_simulated_main");
-  return 1;
+  return;
+}
+
+int __attribute__((weak)) smpi_simulated_main__(int argc, char** argv) {
+  smpi_process_init(&argc, &argv);
+  user_main__();
+  //xbt_die("Should not be in this smpi_simulated_main");
+  return 0;
 }
 
 int __attribute__((weak)) main(int argc, char** argv) {
-   return smpi_main(smpi_simulated_main,argc,argv);
+   return smpi_main(smpi_simulated_main__,argc,argv);
 }
 
 int __attribute__((weak)) MAIN__(){
-  return smpi_main(smpi_simulated_main,xargc, xargv);
+  return smpi_main(smpi_simulated_main__,xargc, xargv);
 };
 
 int smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[])
@@ -352,7 +359,7 @@ int smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[])
   else
     SIMIX_run();
 
-  if (surf_cfg_get_int("smpi/display_timing"))
+  if (sg_cfg_get_int("smpi/display_timing"))
     XBT_INFO("Simulation time: %g seconds.", SIMIX_get_clock());
 
   smpi_global_destroy();