Révision 77

Pi/C/MPI/Pi_MPI.c (revision 77)
82 82
#endif
83 83

  
84 84
  MPI_Status Stat;
85

  
85
  MPI_Request RequestSend, RequestRecv, RequestSend2, RequestRecv2;
86
     
86 87
  rc = MPI_Init(&argc,&argv);
87 88
  if (rc != MPI_SUCCESS) {
88 89
    printf ("Error starting MPI program. Terminating.\n");
......
116 117
    for (i=1;i<numtasks;i++) {
117 118
      
118 119
#ifdef LONG
119
      rc = MPI_Send(&part_iterations, 1, MPI_LONG_LONG, i, tag, 
120
                    MPI_COMM_WORLD);
120
      rc = MPI_Isend(&part_iterations, 1, MPI_LONG_LONG, i, tag, 
121
		     MPI_COMM_WORLD,&RequestSend);
121 122
#else
122
      rc = MPI_Send(&part_iterations, 1, MPI_INT, i, tag, 
123
                    MPI_COMM_WORLD);
124
#endif
123
      rc = MPI_Isend(&part_iterations, 1, MPI_INT, i, tag, 
124
		     MPI_COMM_WORLD,&RequestSend);
125
#endif      
125 126
    }
127
    MPI_Wait(&RequestSend, &Stat);
126 128
    
127 129
#ifdef TIME
128 130
    gettimeofday(&start,(struct timezone *)0);
......
145 147
    // Join part of code
146 148
      for (i=1;i<numtasks;i++) {
147 149
#ifdef LONG
148
	rc = MPI_Recv(&inside[i], 1, MPI_LONG_LONG, i, tag, 
149
		      MPI_COMM_WORLD, &Stat);
150
	rc = MPI_Irecv(&inside[i], 1, MPI_LONG_LONG, i, tag, 
151
		      MPI_COMM_WORLD, &RequestRecv2);
150 152
#else
151
	rc = MPI_Recv(&inside[i], 1, MPI_INT, i, tag, 
152
		      MPI_COMM_WORLD, &Stat);
153
	rc = MPI_Irecv(&inside[i], 1, MPI_INT, i, tag, 
154
		      MPI_COMM_WORLD, &RequestRecv2);
153 155
#endif
156
	MPI_Wait(&RequestRecv2, &Stat);
157
	
154 158
	printf("\tReceive %lu inside from rank %i\n",(unsigned long)inside[i],i);
155 159
	insides+=inside[i];
156 160
      }
......
165 169
    {
166 170
      // Receive information from master
167 171
#ifdef LONG
168
      rc = MPI_Recv(&part_iterations, 1, MPI_LONG_LONG, 0, tag, 
169
                    MPI_COMM_WORLD, &Stat);
172
      rc = MPI_Irecv(&part_iterations, 1, MPI_LONG_LONG, 0, tag, 
173
                    MPI_COMM_WORLD, &RequestRecv);
170 174
#else
171
      rc = MPI_Recv(&part_iterations, 1, MPI_INT, 0, tag, 
172
                    MPI_COMM_WORLD, &Stat);
175
      rc = MPI_Irecv(&part_iterations, 1, MPI_INT, 0, tag, 
176
                    MPI_COMM_WORLD, &RequestRecv);
173 177
#endif
178
      MPI_Wait(&RequestRecv, &Stat);
174 179
      
175 180
      printf("\tOn %s with rank %i, receive from master %lld\n",
176 181
             hostname,rank,(long long)part_iterations);
......
195 200
#endif
196 201
      
197 202
#ifdef LONG
198
      rc = MPI_Send(&part_inside, 1, MPI_LONG_LONG, 0, tag, MPI_COMM_WORLD);
203
      rc = MPI_Isend(&part_inside, 1, MPI_LONG_LONG, 0, tag, MPI_COMM_WORLD,&RequestSend2);
199 204
#else
200
      rc = MPI_Send(&part_inside, 1, MPI_INT, 0, tag, MPI_COMM_WORLD);
205
      rc = MPI_Isend(&part_inside, 1, MPI_INT, 0, tag, MPI_COMM_WORLD,&RequestSend2);
201 206
#endif
207
      MPI_Wait(&RequestSend2, &Stat);
202 208

  
203 209
    }
204 210
  
Pi/C/MPI/bench.sh (revision 77)
1 1
#!/bin/bash
2 2

  
3 3
EXE=Pi_MPI_LONG
4
ITERATIONS=10000000000
5
TIME=time
4
ITERATIONS=10000000000000
5
DATE=$(date "+%Y%m%d%H%M")
6
MyTIME=/usr/bin/time
7
export TIME="%U %S %e %P %X %D %K %M %I %O %F %R %W %c %w %r %s"
6 8

  
7
REPEAT=10
8
PROCESS=16
9
REPEAT=100
10
PROCESS=326
9 11

  
10 12
[ ! $1 == '' ] && EXE=$1
11 13
[ ! $2 == '' ] && ITERATIONS=$2
12 14
[ ! $3 == '' ] && PROCESS=$3
13 15

  
14
LOGFILE=${EXE}_${HOSTNAME}_${ITERATIONS}.log
16
LOGFILE=${EXE}_${HOSTNAME}_${ITERATIONS}_${DATE}.log
15 17

  
16 18
> $LOGFILE
17
p=1
18
while [ $p -le $PROCESS ]
19
for p in $(seq $PROCESS -1 1)
19 20
do
20
    echo -e "Process $p" >> $LOGFILE
21
    echo -e "Process $p" >>$LOGFILE
21 22
    echo -ne "Start $EXE with $ITERATIONS and $p : "
22
    i=1
23
    while [ $i -le $REPEAT ]
23

  
24
    for i in $(seq 1 1 $REPEAT)
24 25
    do 
25
        echo -ne "$i "
26
        $TIME mpirun -np $p -mca btl self,sm ./$EXE $ITERATIONS >> $LOGFILE 2>&1 
27
        i=$(($i+1))
26
	echo -ne "$i "
27
	$MyTIME mpirun.openmpi -np $p -mca btl self,openib,sm -hostfile /etc/clusters/r410.nodes -loadbalance hwloc-bind -p pu:0-7 ./$EXE $ITERATIONS >>$LOGFILE 2>&1
28 28
    done
29 29
    echo
30
    p=$(($p+1))
31 30
done

Formats disponibles : Unified diff