Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Locally store the process rank.
authorpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 7 Jan 2011 16:54:18 +0000 (16:54 +0000)
committerpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 7 Jan 2011 16:54:18 +0000 (16:54 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9383 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/smpi/smpif2c.in

index 296ca19..ce1272a 100755 (executable)
@@ -20,7 +20,8 @@ foreach my $fortran (@ARGV) {
    print $tmp "#define INTEGER_STAR_8\n";
    print $tmp "#endif\n";
    print $tmp "#include <stdlib.h>\n";
-   print $tmp "#include <smpif.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";
    while(<F2C>) {
       chomp;
       if(/\/\* Common Block Declarations \*\//) {
@@ -30,7 +31,7 @@ foreach my $fortran (@ARGV) {
          if(/^} (.*?);/) {
             $_ = "}* __attribute__((weak)) $1 = NULL;\n";
          } elsif(/^#define\s*(\S*)\s*\(?([^.]*)(\..*?)?\)?$/) {
-            $_ = "#define $1 $2\[smpi_global_rank()\]";
+            $_ = "#define $1 $2\[__rank()\]";
             if(defined $3) {
                $_ .= $3;
             }