      include 'mpif.h'
      parameter(numdat=100)
      real*8 t1,t2,tt
      call MPI_INIT(ierr)
      call MPI_COMM_RANK(MPI_COMM_WORLD,myrank,ierr)
      call MPI_COMM_SIZE(MPI_COMM_WORLD,nprocs,ierr)
      ist=((numdat-1)/nprocs+1)*myrank+1
      ied=((numdat-1)/nprocs+1)*(myrank+1)
      call MPI_BARRIER(MPI_COMM_WORLD,ierr)
      t1=MPI_WTIME()
      isum1=0
      do i=ist,ied
         isum1=isum1+i
      enddo
      call MPI_REDUCE(isum1,isum,1,MPI_INTEGER,MPI_SUM,
     &                0,MPI_COMM_WORLD,ierr)
      call MPI_BARRIER(MPI_COMM_WORLD,ierr)
      t2=MPI_WTIME()
      tt=t2-t1
      if(myrank.eq.0)write(6,*)'isum=',isum,',time=',tt
      call MPI_FINALIZE(ierr)
      stop
      end
