Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Access to SIMIX data without resorting to a request (and thus do not rely specificall...
authorpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 17 Jan 2011 15:54:07 +0000 (15:54 +0000)
committerpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 17 Jan 2011 15:54:07 +0000 (15:54 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9424 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/smpi/smpi.h
include/smpi/smpi_cocci.h
include/smpi/smpif.h.in
src/smpi/private.h
src/smpi/smpi_global.c
src/smpi/smpif2c.in

index b2589b8..dafc86d 100644 (file)
@@ -444,5 +444,7 @@ XBT_PUBLIC(void) smpi_shared_free(void *data);
 /* Fortran specific stuff */
 XBT_PUBLIC(int) MAIN__(void);
 
 /* Fortran specific stuff */
 XBT_PUBLIC(int) MAIN__(void);
 
+XBT_PUBLIC(int) smpi_process_index(void);
+
 SG_END_DECL()
 #endif
 SG_END_DECL()
 #endif
index cc03928..29daeec 100644 (file)
@@ -38,17 +38,6 @@ void __attribute__((weak,destructor)) __postfini_##name(void) { \
    name = NULL;                                                 \
 }
 
    name = NULL;                                                 \
 }
 
-#define SMPI_GLOBAL_VAR_LOCAL_ACCESS(name) name[__rank()]
-
-/* This function stores the rank locally, so that a request in
-   SIMIX is not created each time */
-int __attribute__((weak)) __rank(void) {
-   static __thread int rank = -1;
-
-   if(rank < 0) {
-      rank = smpi_global_rank();
-   }
-   return rank;
-}
+#define SMPI_GLOBAL_VAR_LOCAL_ACCESS(name) name[smpi_process_index()]
 
 #endif
 
 #endif
index 6f3ccb8..890712b 100644 (file)
 #endif
 
 #include <xbt/misc.h>
 #endif
 
 #include <xbt/misc.h>
+#include <smpi/smpi.h>
 #include <f2c.h>
 
 XBT_PUBLIC(int) smpi_process_argc(void);
 XBT_PUBLIC(int) smpi_process_getarg(integer* index, char* dst, ftnlen len);
 #include <f2c.h>
 
 XBT_PUBLIC(int) smpi_process_argc(void);
 XBT_PUBLIC(int) smpi_process_getarg(integer* index, char* dst, ftnlen len);
-XBT_PUBLIC(int) smpi_global_rank(void);
 XBT_PUBLIC(int) smpi_global_size(void);
 
 #endif
 XBT_PUBLIC(int) smpi_global_size(void);
 
 #endif
index eaafa49..65f4839 100644 (file)
@@ -43,7 +43,6 @@ void smpi_process_destroy(void);
 smpi_process_data_t smpi_process_data(void);
 smpi_process_data_t smpi_process_remote_data(int index);
 int smpi_process_count(void);
 smpi_process_data_t smpi_process_data(void);
 smpi_process_data_t smpi_process_remote_data(int index);
 int smpi_process_count(void);
-int smpi_process_index(void);
 smx_rdv_t smpi_process_mailbox(void);
 smx_rdv_t smpi_process_remote_mailbox(int index);
 xbt_os_timer_t smpi_process_timer(void);
 smx_rdv_t smpi_process_mailbox(void);
 smx_rdv_t smpi_process_remote_mailbox(int index);
 xbt_os_timer_t smpi_process_timer(void);
index b8938fa..bd5a5f1 100644 (file)
@@ -94,10 +94,6 @@ int smpi_process_getarg(integer* index, char* dst, ftnlen len) {
   return 0;
 }
 
   return 0;
 }
 
-int smpi_global_rank(void) {
-   return smpi_process_index();
-}
-
 int smpi_global_size(void) {
    char* value = getenv("SMPI_GLOBAL_SIZE");
 
 int smpi_global_size(void) {
    char* value = getenv("SMPI_GLOBAL_SIZE");
 
@@ -109,7 +105,7 @@ int smpi_global_size(void) {
 
 smpi_process_data_t smpi_process_data(void)
 {
 
 smpi_process_data_t smpi_process_data(void)
 {
-  return SIMIX_req_process_get_data(SIMIX_process_self());
+  return SIMIX_process_self_get_data();
 }
 
 smpi_process_data_t smpi_process_remote_data(int index)
 }
 
 smpi_process_data_t smpi_process_remote_data(int index)
@@ -227,12 +223,10 @@ void smpi_global_destroy(void)
 /* With smpiff, the following weak symbols are replaced by those in libf2c */
 int __attribute__((weak)) xargc;
 char** __attribute__((weak)) xargv;
 /* With smpiff, the following weak symbols are replaced by those in libf2c */
 int __attribute__((weak)) xargc;
 char** __attribute__((weak)) xargv;
-int fortran = 1;
 
 int __attribute__((weak)) main(int argc, char** argv) {
    xargc = argc;
    xargv = argv;
 
 int __attribute__((weak)) main(int argc, char** argv) {
    xargc = argc;
    xargv = argv;
-   fortran = 0;
    return MAIN__();
 }
 
    return MAIN__();
 }
 
@@ -258,12 +252,6 @@ int MAIN__(void)
                    xbt_cfgelm_double, &default_threshold, 1, 1, NULL,
                    NULL);
 
                    xbt_cfgelm_double, &default_threshold, 1, 1, NULL,
                    NULL);
 
-  if(fortran) {
-    /* Force thread contexts with fortran code */
-    extern void SIMIX_ctx_thread_factory_init(smx_context_factory_t *factory);
-    smx_factory_initializer_to_use = SIMIX_ctx_thread_factory_init;
-  }
-
 #ifdef HAVE_TRACING
   TRACE_global_init(&xargc, xargv);
 #endif
 #ifdef HAVE_TRACING
   TRACE_global_init(&xargc, xargv);
 #endif
index ce1272a..1d6c4d0 100755 (executable)
@@ -20,8 +20,7 @@ foreach my $fortran (@ARGV) {
    print $tmp "#define INTEGER_STAR_8\n";
    print $tmp "#endif\n";
    print $tmp "#include <stdlib.h>\n";
    print $tmp "#define INTEGER_STAR_8\n";
    print $tmp "#endif\n";
    print $tmp "#include <stdlib.h>\n";
-   print $tmp "#include <smpif.h>\n\n";
-   print $tmp "int __attribute__((weak)) __rank(void) {\n  static __thread int rank = -1;\n\n  if(rank < 0) {\n    rank = smpi_global_rank();\n  }\n  return rank;\n}\n\n";
+   print $tmp "#include <smpif.h>\n";
    while(<F2C>) {
       chomp;
       if(/\/\* Common Block Declarations \*\//) {
    while(<F2C>) {
       chomp;
       if(/\/\* Common Block Declarations \*\//) {
@@ -31,7 +30,7 @@ foreach my $fortran (@ARGV) {
          if(/^} (.*?);/) {
             $_ = "}* __attribute__((weak)) $1 = NULL;\n";
          } elsif(/^#define\s*(\S*)\s*\(?([^.]*)(\..*?)?\)?$/) {
          if(/^} (.*?);/) {
             $_ = "}* __attribute__((weak)) $1 = NULL;\n";
          } elsif(/^#define\s*(\S*)\s*\(?([^.]*)(\..*?)?\)?$/) {
-            $_ = "#define $1 $2\[__rank()\]";
+            $_ = "#define $1 $2\[smpi_process_index()\]";
             if(defined $3) {
                $_ .= $3;
             }
             if(defined $3) {
                $_ .= $3;
             }