int main(int argc, char *argv[]) { SIMIX_global_init(&argc, argv); if (argc != 2) { printf("Usage: %s platform_and_deployment.xml\n", argv[0]); exit(EXIT_FAILURE); } SIMIX_function_register("master", master); SIMIX_create_environment(argv[1]); SIMIX_launch_application(argv[1]); SIMIX_run(); return 0; }
/** \ingroup smpi_simulation * \brief Registers a running instance of a MPI program. * * FIXME : remove MSG from the loop at some point. * \param name the reference name of the function. * \param code the main mpi function (must have a int ..(int argc, char *argv[])) prototype * \param num_processes the size of the instance we want to deploy */ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes) { SIMIX_function_register(name, code); s_smpi_mpi_instance_t* instance = (s_smpi_mpi_instance_t*)xbt_malloc(sizeof(s_smpi_mpi_instance_t)); instance->name = name; instance->size = num_processes; instance->present_processes = 0; instance->index = process_count; instance->comm_world = MPI_COMM_NULL; instance->finalization_barrier=xbt_barrier_init(num_processes); process_count+=num_processes; if(smpi_instances==nullptr){ smpi_instances = xbt_dict_new_homogeneous(xbt_free_f); } xbt_dict_set(smpi_instances, name, (void*)instance, nullptr); return; }
void Engine::register_function(const std::string& name, int (*code)(int, char**)) { SIMIX_function_register(name, code); }
void Engine::register_function(const std::string& name, void (*code)(std::vector<std::string>)) { SIMIX_function_register(name, code); }
/** \ingroup msg_easier_life * \brief Registers the main function of an agent in a global table. * * Registers a code function in a global table. * This table is then used by #MSG_launch_application. * \param name the reference name of the function. * \param code the function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[])) */ void MSG_function_register(const char *name, xbt_main_func_t code) { SIMIX_function_register(name, code); return; }