#include <mpi.h>
#include <stdio.h>
#include <windows.h>
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
char processor_name[MPI_MAX_PROCESSOR_NAME];
int name_len;
MPI_Get_processor_name(processor_name, &name_len);
double timer_resolution = MPI_Wtick();
double start_time = MPI_Wtime();
Sleep(1000);
double end_time = MPI_Wtime();
double avg_time = (end_time - start_time);
printf("Process %d is running on CPU: %s\n", rank
, processor_name
); printf("MPI timer resolution: %0.10f\n", timer_resolution
); printf("Average execution time: %0.10f seconds\n\n", avg_time
);
MPI_Finalize();
return 0;
}
I2luY2x1ZGUgPG1waS5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHdpbmRvd3MuaD4gCgppbnQgbWFpbihpbnQgYXJnYywgY2hhcioqIGFyZ3YpIHsKCiAgICBNUElfSW5pdCgmYXJnYywgJmFyZ3YpOwoKICAgIGludCByYW5rOwogICAgTVBJX0NvbW1fcmFuayhNUElfQ09NTV9XT1JMRCwgJnJhbmspOwoKICAgIGludCBzaXplOwogICAgTVBJX0NvbW1fc2l6ZShNUElfQ09NTV9XT1JMRCwgJnNpemUpOwoKICAgIGNoYXIgcHJvY2Vzc29yX25hbWVbTVBJX01BWF9QUk9DRVNTT1JfTkFNRV07CiAgICBpbnQgbmFtZV9sZW47CiAgICBNUElfR2V0X3Byb2Nlc3Nvcl9uYW1lKHByb2Nlc3Nvcl9uYW1lLCAmbmFtZV9sZW4pOwoKICAgIGRvdWJsZSB0aW1lcl9yZXNvbHV0aW9uID0gTVBJX1d0aWNrKCk7CgogICAgZG91YmxlIHN0YXJ0X3RpbWUgPSBNUElfV3RpbWUoKTsKCiAgICBTbGVlcCgxMDAwKTsgIAoKICAgIGRvdWJsZSBlbmRfdGltZSA9IE1QSV9XdGltZSgpOwogICAgZG91YmxlIGF2Z190aW1lID0gKGVuZF90aW1lIC0gc3Rh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