Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
re-start smpi from scratch to use SIMIX.
[simgrid.git] / src / smpi / scripts / smpicc
index 87700d6..62435f4 100755 (executable)
@@ -21,7 +21,7 @@ function modsource {
   cat > ${TMPSOURCE} <<HEADER
 #define SEED ${SEED}
 #include "smpi.h"
-#include "msg/msg.h"
+#include "simix/simix.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/asserts.h"
@@ -29,25 +29,12 @@ function modsource {
 #define gettimeofday(x, y) smpi_gettimeofday(x, y)
 HEADER
   # very simplistic transform, will probably want full parser for next version
-  grep -v "mpi.h" < ${SOURCE} | perl -pe 's/main/smpi_main/;' >> ${TMPSOURCE}
-  grep -q "smpi_main" ${TMPSOURCE}
+  grep -v "mpi.h" < ${SOURCE} | perl -pe 's/main/smpi_simulated_main/;' >> ${TMPSOURCE}
+  grep -q "smpi_simulated_main" ${TMPSOURCE}
   if [ $? -eq 0 ]; then
     cat >> ${TMPSOURCE} <<FOOTER
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_simulation, "Messages specific to this simulation");
-int main(int argc, char *argv[]) {
-  MSG_error_t result;
-  srand(SEED);
-  MSG_global_init(&argc, argv);
-  MSG_set_channel_number(MAX_CHANNEL);
-  MSG_function_register("smpi_main",     smpi_main);
-  MSG_function_register("smpi_sender",   smpi_sender);
-  MSG_function_register("smpi_receiver", smpi_receiver);
-  MSG_create_environment(argv[1]);
-  MSG_launch_application(argv[2]);
-  result = MSG_main();
-  INFO1("simulation time %g", MSG_get_clock());
-  MSG_clean();
-  return (MSG_OK != result);
+int main(int argc, char **argv) {
+    return smpi_run_simulation(&argc, argv);
 }
 FOOTER
   fi
@@ -64,7 +51,7 @@ while [ -n "$1" ]; do
       LINKARGS=""
       CMDLINE="${CMDLINE} -c "
   elif [ "${ARG%.c}" != "${ARG}" ]; then
-    INCLUDEARGS="-I${SMPI_INCLUDE} -I${SIMGRID_INCLUDE} "
+    INCLUDEARGS="-I ../include -I${SMPI_INCLUDE} -I${SIMGRID_INCLUDE} "
     SRCFILE="$(realpath ${ARG})"
     modsource ${SRCFILE}
     CMDLINE="${CMDLINE} ${TMPDIR}${SRCFILE} "