integer ( 4 ) error, id, p
! Initialize MPI.
!
call MPI_Init ( error )
! Get the number of processes.
call MPI_Comm_size ( MPI_COMM_WORLD, p, error )
! Get the rank of this processor.
call MPI_Comm_rank ( MPI_COMM_WORLD, id, error )
! Print a message.
print *, 'Process ', id, ' of ', p, ' is alive'
if ( id == 0 ) then
!код для первого ядра
else if (id == 1) then
!код для второго ядра
end if
!Terminate MPI.
call MPI_Finalize ( error )