Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI: Pass the rank from smpirun to processes through their command line in deploymen...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:55:52 +0000 (19:55 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:55:52 +0000 (19:55 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6347 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
src/smpi/private.h
src/smpi/smpi_base.c
src/smpi/smpi_global.c
src/smpi/smpi_mpi.c
src/smpi/smpirun.in

index 53cfbfa..f461518 100644 (file)
--- 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
index 109ce23..a7b2e85 100644 (file)
@@ -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);
 
index dd3353e..6f2a25f 100644 (file)
@@ -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;
index 49f57b6..931fc72 100644 (file)
@@ -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);
index 4853744..5fa4121 100644 (file)
@@ -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;
 }
index 9ad2663..df12da4 100755 (executable)
@@ -54,7 +54,6 @@ shift
 ##-------------------------------- DEFAULT or SPECIFIED PLATFORM --------------------------------------
 if [ -z "${PLATFORM}" ]; then  
        PLATFORMTMP="$(mktemp tmpXXXXXX)"
-       #PLATFORMTMP="pla.xml"
 
        cat > ${PLATFORMTMP} <<PLATFORMHEAD
 <?xml version='1.0'?>
@@ -117,6 +116,7 @@ for (( i=${NUMPROCS}; $i ; i=$i-1 )) do
        host="${hostnames[$j]}"
   fi
   echo "  <process host=\"${host}\" function=\"smpi_simulated_main\">" >> ${APPLICATIONTMP}
+    echo "    <argument value=\"$j\"/> <!-- rank -->" >> ${APPLICATIONTMP}
   for ARG in $*; do
     echo "    <argument value=\"${ARG}\"/>" >> ${APPLICATIONTMP}
   done