After the development of a serial
code one can parallelize the code by MPI or OpenMP or by both of
them.
Compile the code wth the option
-D_MPI_PARALLEL
Start your main function as follows:
int my_rank;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
Use the a grid constructor as follows:
Grid grid(...,MPI_COMM_WORLD);
End the code with
MPI_Finalize();
A special construction is required for the Print function. Open the data file only for the processor with rank 0 as follows:
if(my_rank==0) DATEI.open("u.dx",std::ios :: out);
u.Print_Dx(&DATEI);
if(my_rank==0) DATEI.close();
Be carefull with using the if condition. Do not write something like:
if(my_rank==0) cout << L_infty(u);
Last modified: Wed Jun 6 10:15:36 PDT 2001