它的回傳值是double, 並且需要確定你的系統環境是MPI_WTIME_IS_GLOBAL是有被定義的.
/* C Example */
#include <mpi.h>
#include <stdio.h>
int main (int argc, char* argv[]){
int rank, size;
double t1;
void *v;
int flag;
MPI_Init (&argc, &argv); /* starts MPI */
MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */
MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */
t1 = MPI_Wtime();
MPI_Attr_get( MPI_COMM_WORLD, MPI_WTIME_IS_GLOBAL, &v, &flag );
printf( "Hello world from process %d of %d, time = %f, global time = %d\n", rank, size, MPI_Wtime() - t1, flag);
MPI_Finalize();
return 0;
}
沒有留言:
張貼留言