title: the use of MPI_Init()
body: <p>I encountered a question about the use of <strong>MPI_Init()</strong>. </p>
  
  <p>I want to initialize random number "<strong>randv</strong>" only on the root processor with the code in the context below. To see if my goal is fulfilled, I have the program print out the array "<strong>randv</strong>" by placing a do loop immediately after the line "<strong>call RANDOM_NUMBER(randv)</strong>." </p>
  
  <p>However, what is shown on the outcome screen is the repetition of the random number array by 8 times (given the number of processors is 8). My question is why the processors other than the root one are initialized before call <strong>MPI_Init()</strong>. If all the processors are awaken and have the same random number array before evoking <strong>MPI_Init</strong>, why bother to place call <strong>MPI_Init()</strong> for initialization? Thanks.</p>
  
  <p>Lee</p>
  
  <p>Here is the example I use:   </p>
  
  <pre><code>program main
    include 'mpif.h'
    integer :: i
    integer :: ierr
    integer :: irank
    integer :: nrow, ncol
    real, dimension(:,:), allocatable :: randv
    nrow = 4
    ncol = 2
    allocate(randv(nrow,ncol))   
    call RANDOM_SEED
    call RANDOM_NUMBER(randv)
    do i = 1, nrow
      write(*,'(2(f5.2,x))') randv(i,:)    
    enddo   
    call MPI_Init ( ierr )
    allocate(row_list(ncol), col_list(nrow))  
    call MPI_Comm_rank ( MPI_COMM_WORLD, irank, ierr )
    if( irank == 0 )then
      do i = 1, nrow
        write(*,'(2(f5.2,x))') randv(i,:)    
      enddo          
    endif
    call MPI_Finalize ( ierr ) 
    deallocate( randv )
  end program
  </code></pre>