我正在Linux上使用openMPI版本4.0.1编译以下代码,并且MPI_Wtime()
返回0。我正在使用mpicc -o testCode myfile.c
#include <stdio.h>
#include <time.h>
#include <mpi.h>
int main(int argc, char* argv[])
{
// Initialize MPI
MPI_Init(&argc, &argv);
// printf("%d\n",MPI_UNIVERSE_SIZE);
// Get the clock precision and start the clock.
double precision = MPI_Wtick();
double starttime = MPI_Wtime();
// Get this processor's rank and the size of the world.
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (rank ==0)
printf("start time = %g\n", starttime);
MPI_Finalize();
return 0;
}