From: mquinson Date: Wed, 24 Jun 2009 19:55:52 +0000 (+0000) Subject: SMPI: Pass the rank from smpirun to processes through their command line in deploymen... X-Git-Tag: SVN~1293 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/766576b6f567b257d08ac0667a2c1f63402ef9a0 SMPI: Pass the rank from smpirun to processes through their command line in deployment file; kill unused hosts global table git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6347 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/ChangeLog b/ChangeLog index 53cfbfa057..f461518e41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,10 +52,14 @@ SimGrid (3.4-svn) unstable; urgency=high Users should call xbt_ex_free() themselves. SMPI: - * Cleanup the initialization process - * Improve smpirun to accept -platform and -hostfile arguments - * Kill a whole bunch of unneeded synchronization: processes run in - exclusive manner within the simulator + * Massive internal cleanups: + - Cleanup the initialization/finalization process + - Kill a whole bunch of unneeded synchronization: + processes run in exclusive manner within the simulator + - Move queues from global tables to process data fields + * Improve smpirun: + - now accept -platform and -hostfile arguments + - Pass the right rank value to processes according on hostfile Build Chain: * Do not require doxygen in maintainer mode diff --git a/src/smpi/private.h b/src/smpi/private.h index 109ce231a5..a7b2e85743 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -84,7 +84,6 @@ typedef struct smpi_global_t { // state vars - smx_host_t *hosts; //FIXME:killme int host_count; xbt_mallocator_t request_mallocator; xbt_mallocator_t message_mallocator; @@ -122,7 +121,7 @@ typedef struct smpi_host_data_t { typedef struct smpi_host_data_t *smpi_host_data_t; // function prototypes -void smpi_process_init(void); +void smpi_process_init(int *argc,char ***argv); void smpi_process_finalize(void); int smpi_mpi_comm_rank(smpi_mpi_communicator_t comm); diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index dd3353ef75..6f2a25fa5e 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -47,10 +47,9 @@ int smpi_mpi_comm_rank(smpi_mpi_communicator_t comm) return comm->index_to_rank_map[smpi_host_index()]; } -void smpi_process_init() +void smpi_process_init(int *argc, char***argv) { smx_host_t host; - int i; smpi_host_data_t hdata; // initialize some local variables @@ -60,9 +59,14 @@ void smpi_process_init() SIMIX_host_set_data(host, hdata); SIMIX_process_set_data(SIMIX_process_self(),hdata); - for (i = 0; i < smpi_global->host_count && host != smpi_global->hosts[i]; i++); + /* get rank from command line, and remove it from argv */ + hdata->index = atoi( (*argv)[1] ); + if (*argc>2) { + memmove((*argv)[1],(*argv)[2], sizeof(char*)* (*argc-2)); + (*argv)[ (*argc)-1] = NULL; + } + (*argc)--; - hdata->index = i; hdata->mutex = SIMIX_mutex_init(); hdata->cond = SIMIX_cond_init(); hdata->finalize = 0; diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index 49f57b663e..931fc728bb 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -149,7 +149,6 @@ void smpi_global_init() // host info blank until sim starts // FIXME: is this okay? - smpi_global->hosts = NULL; smpi_global->host_count = 0; // mallocators @@ -172,7 +171,6 @@ void smpi_global_init() smpi_global->do_once_duration = NULL; smpi_global->do_once_mutex = SIMIX_mutex_init(); - smpi_global->hosts = SIMIX_host_get_table(); smpi_global->host_count = SIMIX_host_get_number(); smpi_mpi_global = xbt_new(s_smpi_mpi_global_t, 1); diff --git a/src/smpi/smpi_mpi.c b/src/smpi/smpi_mpi.c index 485374468e..5fa4121ac9 100644 --- a/src/smpi/smpi_mpi.c +++ b/src/smpi/smpi_mpi.c @@ -5,7 +5,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, int SMPI_MPI_Init(int *argc, char ***argv) { - smpi_process_init(); + smpi_process_init(argc,argv); smpi_bench_begin(); return MPI_SUCCESS; } diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 9ad26630f0..df12da4842 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -54,7 +54,6 @@ shift ##-------------------------------- DEFAULT or SPECIFIED PLATFORM -------------------------------------- if [ -z "${PLATFORM}" ]; then PLATFORMTMP="$(mktemp tmpXXXXXX)" - #PLATFORMTMP="pla.xml" cat > ${PLATFORMTMP} < @@ -117,6 +116,7 @@ for (( i=${NUMPROCS}; $i ; i=$i-1 )) do host="${hostnames[$j]}" fi echo " " >> ${APPLICATIONTMP} + echo " " >> ${APPLICATIONTMP} for ARG in $*; do echo " " >> ${APPLICATIONTMP} done