Research Article

Parallel Numerical Simulations of Three-Dimensional Electromagnetic Radiation with MPI-CUDA Paradigms

Algorithm 2

 MPI_Init(&argc, &argv); //MPI parallel environment initialization
 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 MPI_Comm_size(MPI_COMM_WORLD, &size);
 MPI_Get_processor_name(processor_name, &namelen);
 MPI_Barrier(MPI_COMM_WORLD);
 node.init(_size/size, _szie, _size); //Grid data initialization
 UPMLcompute(); //Set up the absorbing boundary
 for (int ; < max_step; ++) //Iterating over the time step
 {
 #pragma omp parallel for schedule(static)
  for ( = 1; _tot; ++)
  {
   …Compute; //Calculating the electric field and magnetic field values
  }
 MPI_Send(datasend_right, data_size, MPI_DOUBLE, NodeRank + 1, 1,
 MPI_COMM_WORLD); //Send data to the neighboring node
 MPI_Recv(datarecv_right, data_size, MPI_DOUBLE, NodeRank + 1, 1, MPI_COMM_WORLD,
&status); //Accept the adjacent node data
 MPI_Barrier(MPI_COMM_WORLD);
 }
 MPI_Finalize();
 Out(EHdate); //Output the results