+++ /dev/null
-cmake_minimum_required(VERSION 2.6)
-
-set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
-
-add_executable(replay replay_MPI.c)
-
-### Add definitions for compile
-target_link_libraries(replay simgrid m )
-
-### Get our action files in the archive
-#set(EXTRA_DIST ${EXTRA_DIST}
-# examples/msg/actions/actions_allReduce.txt
-# examples/msg/actions/actions_barrier.txt
-# examples/msg/actions/actions_bcast.txt
-# examples/msg/actions/actions_reduce.txt
-# examples/msg/actions/actions_split_p0.txt
-# examples/msg/actions/actions_split_p1.txt
-# examples/msg/actions/actions.txt
-# examples/msg/actions/actions_with_isend.txt
-# )
\ No newline at end of file
+++ /dev/null
-/* Specific user API allowing to replay traces without context switches */
-
-/* Copyright (c) 2010. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid_config.h" /* getline */
-#include "replay.h"
-#include "simix/simix.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(replay,"trace replaying");
-
-replay_init_func_t replay_func_init=NULL;
-replay_run_func_t replay_func_run=NULL;
-replay_fini_func_t replay_func_fini=NULL;
-
-static int replay_get_PID(void);
-static int replay_get_PID(void) {
- /* FIXME: implement it */
- return 0;
-}
-
-static int replay_wrapper(int argc, char*argv[]) {
- THROW_UNIMPLEMENTED;
-}
-/** \brief initialize the replay mechanism */
-void SG_replay_init(int *argc, char **argv) {
- factory_initializer_to_use = statem_factory_init;
- xbt_getpid = replay_get_PID;
- SIMIX_global_init(argc, argv);
-
- /* Restore the default exception handlers: we have no real processes */
- __xbt_running_ctx_fetch = &__xbt_ex_ctx_default;
- __xbt_ex_terminate = &__xbt_ex_terminate_default;
-
- SIMIX_function_register_default(replay_wrapper);
-}
-void SG_replay_set_functions(replay_init_func_t init, replay_run_func_t run,replay_fini_func_t fini) {
- replay_func_init =init;
- replay_func_run =run;
- replay_func_fini =fini;
-}
-
-/** \brief Loads a platform and deployment from the given file. Trace must be loaded from deployment */
-void SG_replay(const char *environment_file, const char *deploy_file) {
- SIMIX_create_environment(environment_file);
- SIMIX_launch_application(deploy_file);
-
- SIMIX_run();
-}
+++ /dev/null
-/* Specific user API allowing to replay traces without context switches */
-
-/* Copyright (c) 2010. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef TRACE_REPLAY_H_
-#define TRACE_REPLAY_H_
-
-#include "xbt/dynar.h"
-#include "simix/simix.h"
-#include "simix/context.h"
-
-/* function used in each process */
-int replay_runner(int argc, char *argv[]);
-/* initialize my factory */
-void statem_factory_init(smx_context_factory_t * factory);
-
-void SG_replay_init(int *argc, char **argv);
-
-typedef void *(*replay_init_func_t)(int argc, char *argv[]);
-typedef void (*replay_run_func_t)(void* data,void *syscall_result);
-typedef void (*replay_fini_func_t)(void* data);
-
-replay_init_func_t replay_func_init;
-replay_run_func_t replay_func_run;
-replay_fini_func_t replay_func_fini;
-void SG_replay_set_functions(replay_init_func_t init, replay_run_func_t run,replay_fini_func_t fini);
-
-void SG_replay(const char *environment_file, const char *deploy_file);
-
-
-/* Trace parsing logic */
-typedef struct s_replay_trace_reader *replay_trace_reader_t;
-
-replay_trace_reader_t replay_trace_reader_new(const char*filename);
-const char * const *replay_trace_reader_get(replay_trace_reader_t reader);
-void replay_trace_reader_free(replay_trace_reader_t *reader);
-const char *replay_trace_reader_position(replay_trace_reader_t reader);
-
-
-#endif /* TRACE_REPLAY_H_ */
+++ /dev/null
-/* Example of traces replay without context switches, running MPI actions */
-
-/* Copyright (c) 2010. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "replay.h"
-#include "xbt/log.h"
-#include "xbt/str.h"
-#include "xbt/dynar.h"
-#include "simix/smurf_private.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(mpi_replay,"MPI replayer");
-
-
-/* Helper function */
-static double parse_double(const char *string) {
- double value;
- char *endptr;
-
- value = strtod(string, &endptr);
- if (*endptr != '\0')
- THROW1(unknown_error, 0, "%s is not a double", string);
- return value;
-}
-static int get_rank (const char *process_name){
- return atoi(&(process_name[1]));
-}
-
-const char *state_name[] = {
- "pump",
- "compute0", "compute1", "compute2",
- "send0","send1","send2","send3",
- "irecv0",
- "recv0",
- "wait0",
- "init0", "init1"
-};
-typedef enum {
- e_mpi_pump_evt_trace=0,
- e_mpi_compute0,e_mpi_compute1,e_mpi_compute2,
- e_mpi_send0,e_mpi_send1,e_mpi_send2,e_mpi_send3,
- e_mpi_irecv0,
- e_mpi_recv0,
- e_mpi_wait0,
- e_mpi_init0,e_mpi_init1
-} e_mpi_replay_state_t;
-
-typedef struct {
- /* Myself */
- char *procname;
- smx_host_t myhost;
- e_mpi_replay_state_t state;
- /* Parsing logic */
- replay_trace_reader_t reader;
- const char * const*evt;
- /* simix interface */
- smx_action_t act;
-
- xbt_dynar_t isends; /* of msg_comm_t, cleaned up automatically on send event */
-} s_mpi_replay_t, *mpi_replay_t;
-
-static void *mpi_replay_init(int argc, char *argv[]) {
-
- mpi_replay_t res = xbt_new0(s_mpi_replay_t,1);
- res->procname = xbt_strdup(argv[0]);
- res->state = e_mpi_pump_evt_trace;
-
- res->reader = replay_trace_reader_new(argv[1]);
- return res;
-}
-
-static void mpi_replay_run(void*data,void *syscall_res) {
- mpi_replay_t g = (mpi_replay_t)data; /* my globals */
-
- new_event:
- INFO2("mpi_replay_run, state=%s (%d)",state_name[g->state],g->state);
-
- switch(g->state){
-
- case e_mpi_pump_evt_trace: { /* nothing to do, parse next event and call function again */
-
- g->evt = replay_trace_reader_get(g->reader);
- if (strcmp(g->procname, g->evt[0])) {
- WARN1("Ignore trace element not for me at %s",
- replay_trace_reader_position(g->reader));
- goto new_event;
- }
-
- if (!strcmp(g->evt[1],"send")) {
- g->state = e_mpi_send0;
- goto new_event;
- } else if (!strcmp(g->evt[1],"recv")) {
- g->state = e_mpi_recv0;
- goto new_event;
- } else if (!strcmp(g->evt[1],"irecv")||!strcmp(g->evt[1],"Irecv")) {
- g->state = e_mpi_irecv0;
- goto new_event;
- } else if (!strcmp(g->evt[1],"wait")) {
- g->state = e_mpi_wait0;
- goto new_event;
- } else if (!strcmp(g->evt[1],"compute")) {
- g->state = e_mpi_compute0;
- goto new_event;
- } else if (!strcmp(g->evt[1],"init")) {
- g->state = e_mpi_init0;
- goto new_event;
- } else {
- WARN2("Ignoring unrecognized trace element at %s: %s",
- replay_trace_reader_position(g->reader),g->evt[1]);
- goto new_event;
- }
- } THROW_IMPOSSIBLE;
-
- /* *** Send *** */
- case e_mpi_send0: {
- char to[250];
- sprintf(to, "%s_%s", g->procname, g->evt[2]);
-
- DEBUG2("Entering Send at %s (size: %lg)",
- replay_trace_reader_position(g->reader), parse_double(g->evt[3]));
- g->state = e_mpi_send1;
- SIMIX_req_rdv_create(to);
- } THROW_IMPOSSIBLE;
-
- case e_mpi_send1:
- g->state = e_mpi_send2;
- SIMIX_req_comm_isend(syscall_res, parse_double(g->evt[3]),-1,
- NULL,0,//void *src_buff, size_t src_buff_size,
- NULL,NULL);//int (*match_fun)(void *, void *), void *data)
- THROW_IMPOSSIBLE;
- case e_mpi_send2:
- if (parse_double(g->evt[3])<65536) {
- xbt_dynar_push(g->isends,&syscall_res);
- g->state = e_mpi_pump_evt_trace;
- goto new_event;
- }
- g->act = syscall_res;
- g->state=e_mpi_send3;
- SIMIX_req_comm_wait(g->act,-1);
- case e_mpi_send3:
- g->state=e_mpi_pump_evt_trace;
- SIMIX_req_comm_destroy(g->act);
-
- /* *** Computation *** */
- case e_mpi_compute0:
- g->state = e_mpi_compute1;
- SIMIX_req_host_execute(replay_trace_reader_position(g->reader),
- g->myhost,parse_double(g->evt[2]));
- THROW_IMPOSSIBLE;
- case e_mpi_compute1:
- g->act = syscall_res;
- g->state = e_mpi_compute2;
- SIMIX_req_host_execution_wait(g->act);
- THROW_IMPOSSIBLE;
- case e_mpi_compute2:
- g->state = e_mpi_pump_evt_trace;
- SIMIX_req_host_execution_destroy(g->act);
- THROW_IMPOSSIBLE;
-
- case e_mpi_irecv0: xbt_die("irecv0 unimplemented");
- case e_mpi_recv0: xbt_die("recv0 unimplemented");
- case e_mpi_wait0: xbt_die("wait0 unimplemented");
- case e_mpi_init0:
- g->state = e_mpi_init1;
- SIMIX_req_process_get_host(SIMIX_process_self());
- THROW_IMPOSSIBLE;
- case e_mpi_init1:
- g->myhost = syscall_res;
- g->state = e_mpi_pump_evt_trace;
- goto new_event;
-
- }
- THROW_IMPOSSIBLE;
-}
-static void mpi_replay_fini(void *data) {
- mpi_replay_t g = (mpi_replay_t)data;
- replay_trace_reader_free(&g->reader);
- free(data);
-}
-
-int main(int argc, char *argv[]) {
- SG_replay_init(&argc,argv);
- if (argc<3) {
- fprintf(stderr,"USAGE: replay platform_file deployment_file\n");
- exit(1);
- }
- SG_replay_set_functions(mpi_replay_init,mpi_replay_run,mpi_replay_fini);
- SG_replay(argv[1],argv[2]);
-
- return 0;
-}
+++ /dev/null
-/* Copyright (c) 2010. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include <setjmp.h>
-#include "replay.h"
-
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(replay);
-typedef struct s_statem_context {
- s_smx_ctx_base_t base;
- void *user_data;
- jmp_buf jump;
- int syscall_id; /* Identifier of previous syscall to SIMIX */
-} s_statem_context_t,*statem_context_t;
-
-static smx_context_t
-statem_create_context(xbt_main_func_t code, int argc, char **argv,
- void_pfn_smxprocess_t cleanup_func, void *data);
-
-static void statem_ctx_free(smx_context_t context);
-static void statem_ctx_suspend(smx_context_t context);
-static void statem_ctx_resume(smx_context_t new_context);
-static void statem_ctx_runall(xbt_dynar_t processes);
-static smx_context_t statem_ctx_self(void);
-
-void statem_factory_init(smx_context_factory_t * factory) {
- /* instantiate the context factory */
- smx_ctx_base_factory_init(factory);
-
- (*factory)->create_context = statem_create_context;
- (*factory)->free = statem_ctx_free;
- (*factory)->suspend = statem_ctx_suspend;
- (*factory)->runall = statem_ctx_runall;
- (*factory)->name = "State Machine context factory";
-}
-
-static smx_context_t
-statem_create_context(xbt_main_func_t code, int argc, char **argv,
- void_pfn_smxprocess_t cleanup_func, void *data){
- if(argc>0 && !replay_func_init) {
- fprintf(stderr,"variable replay_initer_function not set in replay_create_context. Severe issue!");
- }
-
- statem_context_t res = (statem_context_t)
- smx_ctx_base_factory_create_context_sized(sizeof(s_statem_context_t),
- code, argc, argv,
- cleanup_func,
- data);
-
- if (argc>0) /* not maestro */
- res->user_data = replay_func_init(argc,argv);
- return (smx_context_t)res;
-}
-
-static void statem_ctx_free(smx_context_t context) {
- if (replay_func_fini)
- replay_func_fini(((statem_context_t)context)->user_data);
- else if (((statem_context_t)context)->user_data)
- free(((statem_context_t)context)->user_data);
-
- smx_ctx_base_free(context);
-}
-/*static void replay_ctx_stop(smx_context_t context) {
- THROW_UNIMPLEMENTED;
-}*/
-static void statem_ctx_suspend(smx_context_t context) {
- statem_context_t ctx = (statem_context_t)context;
- ctx->syscall_id = SIMIX_request_last_id();
- longjmp(ctx->jump,1);
-}
-static void statem_ctx_resume(smx_context_t new_context) {
- THROW_UNIMPLEMENTED;
-}
-static void statem_ctx_runall(xbt_dynar_t processes) {
- smx_context_t old_context;
- smx_process_t process;
- unsigned int cursor;
-
- INFO0("Run all");
-
- xbt_dynar_foreach(processes, cursor, process) {
- statem_context_t ctx = (statem_context_t)SIMIX_process_get_context(process);
- old_context = smx_current_context;
- smx_current_context = SIMIX_process_get_context(process);
- if (!setjmp(ctx->jump))
- replay_func_run(((statem_context_t)smx_current_context)->user_data,
- ctx->syscall_id==0?NULL:SIMIX_request_get_result(ctx->syscall_id));
- smx_current_context = old_context;
- }
- xbt_dynar_reset(processes);
-}
-
-This directory constitutes an attempt to code a new trace replayer for
-MPI actions, aiming at maximal performances. Modifying it is not for
-faint of heart, since it could be compared to a mixure of the assembly
-and basic programming philosophy (in worse) reserved to SimGrid experts.
+This file was the README in a directory constituting an attempt to
+code a new trace replayer for MPI actions, aiming at maximal
+performances. Modifying it is not for faint of heart, since it could
+be compared to a mixure of the assembly and basic programming
+philosophy (in worse) reserved to SimGrid experts.
+
+It was so difficult to use that this has been removed from the SVN.
+This file is thus mainly for history.
Shiny side: glance at interface
===============================