Cube - communication  for  MPI
C 
C  Basic-Routine for Inner-Cube-Communication
C    Send N words from X over Link NrLink
C
        SUBROUTINE Send_Chan_0(N,X,NrLink)

        INCLUDE 'include/trnet.inc'
        INCLUDE 'include/times.inc'
	INCLUDE 'mpif.h'
#ifdef SECNDS_EXTERNAL
	EXTERNAL secnds
#endif

        INTEGER   ierr
        parameter(ibyte=4)
        Integer X(*)

        IWHO=IEOR(ICH,Ishft(1,NrLink-1))
        t=secnds(0.0)

        if (n.gt.0) then
#ifdef Intel
	call MPI_Send_(x, n,MPI_INTEGER,iwho,nrlink,MPI_COMM_WORLD,ierr)
#else
	call MPI_Send (x, n,MPI_INTEGER,iwho,nrlink,MPI_COMM_WORLD,ierr)
#endif	
        endif
        Toutput=Toutput + secnds(t)
        RETURN
        END
C
C  Basic-Routine for Inner-Cube-Communication
C  Receive  N words over Link NrLink
C
        SUBROUTINE Recv_Chan_0(N,X,NrLink)

        INCLUDE 'include/trnet.inc'
        INCLUDE 'include/times.inc'
	INCLUDE 'mpif.h'
#ifdef SECNDS_EXTERNAL
	EXTERNAL secnds
#endif

        INTEGER   ierr
cpvm    Dimension X(*)
        integer X(*)
	integer status(MPI_STATUS_SIZE)
        parameter(ibyte=4)

        t=secnds(0.0)

        iwho=IEOR(ICH,Ishft(1,nrlink-1))
        if (n.gt.0) then
#ifdef Intel
	call MPI_Recv_(X, N, MPI_INTEGER, iwho, nrlink, 
     *		MPI_COMM_WORLD, status, ierr)
#else
	call MPI_Recv (X, N, MPI_INTEGER, iwho, nrlink, 
     *		MPI_COMM_WORLD, status, ierr)
#endif
        endif
        Tinput=Tinput + secnds(t)
        RETURN
        END
