      program test
      implicit none
#include "mafdecls.fh"
#include "global.fh"
#include "tcgmsg.fh"
      logical status
      call pbeginf
      status = ma_init(MT_DBL, 50000, 90000/nnodes())
      if (.not. status) print *, 'ma_init failed'
      call ga_initialize()
      call dpatch_test()
c
      call ga_terminate()
      call pend
      end


      subroutine dpatch_test()
      implicit none
#include "mafdecls.fh"
#include "global.fh"
#include "tcgmsg.fh"
      integer i,n, m, g_a, ilo,ihi,jlo,jhi,me
      logical status
      n = 3
      m=10
      me = ga_nodeid()
      status = ga_create(MT_DBL, n, m, 'a', n, 0, g_a)
      if (.not. status) then
         write(6,*) ' ga_create failed'
         call ffflush(6)
         call ga_error('... exiting ',0)
      endif 
      call ga_distribution(g_a, me,ilo,ihi,jlo,jhi)
      call ga_sync()
      do i =1, ga_nnodes()
         if(me .eq.i)then
           print * ,'me=',me, ilo,ihi,jlo,jhi
           call ffflush(6)
         endif
         call ga_sync()
      enddo
c
      call ga_fill_patch(g_a, 1, 3, 1,10, 0d0)
      call ga_sync()
      end
      
