#pragma comment (lib, "mpichd.lib")
int main(int argc, char* argv[])
{
int myid,numprocs;
int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&myid);
MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
MPI_Get_processor_name(processor_name,&namelen);
fprintf(stderr,
"Hello World!Process %d of %d on %s\n",
myid,numprocs,processor_name);
MPI_Finalize();
if (myid == 0)
{
printf("\nPress a key and exit.\n");
getch();
}
return 0;
}
GMT+8, 2025-1-11 21:55 , Processed in 0.085618 second(s), 16 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.