//MPIInitialize, the program starts in parallel MPI_Init(&argc,&argv); //MPI is initialized and the program starts in parallel MPI_Comm_size(MPI_COMM_WORLD,&group_size);//Get the current process ID MPI_Comm_rank(MPI_COMM_WORLD,&my_rank);//Gets the total number of running processes //Each process enters data for the 1 / group_size block of source data for(int i = 0; i < 576 /group_size; i++) { //Inverse function of the product, 5 minutes of data read and projection, etc., to get local results VpwdPrjProcess(); } if(my_rank!=0)//Non-master process { MPI_Send(tempResult); //The non-master process sends the local projection calculation processing result to the main process } else //Main process { MPI_Recv( tempResult);//The main process receives the local processing results from each child process WriteFile();//The main process generates precipitation products VpwdDelete();//Release memory } MPI_Finalize();// MPI parallelization ends |