From 6e0fada8c7781fc70023066302e0915cf91969ae Mon Sep 17 00:00:00 2001 From: pini Date: Fri, 7 Jan 2011 16:54:18 +0000 Subject: [PATCH] Locally store the process rank. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9383 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/smpi/smpif2c.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/smpi/smpif2c.in b/src/smpi/smpif2c.in index 296ca198b0..ce1272a111 100755 --- a/src/smpi/smpif2c.in +++ b/src/smpi/smpif2c.in @@ -20,7 +20,8 @@ foreach my $fortran (@ARGV) { print $tmp "#define INTEGER_STAR_8\n"; print $tmp "#endif\n"; print $tmp "#include \n"; - print $tmp "#include \n"; + print $tmp "#include \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() { 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; } -- 2.20.1