MPI: Difference between revisions

99 bytes removed ,  7 years ago
no edit summary
No edit summary
No edit summary
Line 98: Line 98:
Similarly, we must call a function <code>MPI_Finalize</code> to do any clean-up that might be required before our program exits. The prototype for this function appears below:
Similarly, we must call a function <code>MPI_Finalize</code> to do any clean-up that might be required before our program exits. The prototype for this function appears below:


{| border="0" cellpadding="5" cellspacing="0" align="center"
<tabs>
! style="background:#8AA8E5;" | C API
<tab name="C">
! style="background:#ECCF98;" | FORTRAN API
<source lang="c">
|-valign="top"
|<source lang="c">
  int MPI_Finalize(void);
  int MPI_Finalize(void);
</source>
</source>
|<source lang="fortran">
</tab>
<tab name="Fortran">
<source lang="fortran">
  MPI_FINALIZE(IERR)
  MPI_FINALIZE(IERR)
  INTEGER :: IERR
  INTEGER :: IERR
</source>
</source>
|}
</tab>
</tabs>


As a rule of thumb, it is a good idea to call <code>MPI_Init</code> as the first statement of our program, and <code>MPI_Finalize</code> as its last statement.  
As a rule of thumb, it is a good idea to call <code>MPI_Init</code> as the first statement of our program, and <code>MPI_Finalize</code> as its last statement.  
Bureaucrats, cc_docs_admin, cc_staff, rsnt_translations
2,837

edits