Fortran

Guide To Learn

Using Fortran with MPI (Message Passing Interface)

This example demonstrates how to use MPI for parallel computing.

 codeprogram mpi_example
    use mpi
    implicit none

    integer :: ierr, rank, size
    integer :: i

    call MPI_Init(ierr)
    call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
    call MPI_Comm_size(MPI_COMM_WORLD, size, ierr)

    print *, 'Hello from process ', rank, ' of ', size

    call MPI_Finalize(ierr)
end program mpi_example
Using Fortran with MPI (Message Passing Interface)

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top