      PROGRAM HOST15
C
C     PROBLEM 15
C
C  REFERENCE:  PROBLEMS TO TEST PARALLEL AND VECTOR LANGUAGES
C              CSD-TR 516, COMPUTER SCIENCE, PURDUE UNIVERSITY
C              JOHN R. RICE, MAY 1, 1985
C
C              REVISED BY JOHN R. RICE AND J. JING, OCT. 1, 1990
C
C
C      *************************************************
C      *      Adapted for FORTRAN D benchmarking       *
C      *    by  T. HAUPT  (haupt@sccs.npac.syr.edu)    *
C      *                                               *
C      *    Northeast Parallel Architectures Center    *
C      *   at Syracuse University, Syracuse, NY, USA   *
C      *************************************************
C
C
C       VERSION MIMD/iPSC860-1.00-HOST   (F77+mp)
C       ==================================================
C
      INCLUDE 'picl_def.h'
      INTEGER KASES
      PARAMETER (KASES=2)
      INTEGER N(KASES)
      DATA N /8192,16384/
      INTEGER NK,NPTS
      PARAMETER(NPTS=10)
      REAL ERRMAX(NPTS,2),DECAY(NPTS,2)
      DOUBLE PRECISION HOST_SEC, NODE_SEC, STARTTIME
      INTEGER*4 TIMESIZE, TIMETYPE
      DATA TIMESIZE,TIMETYPE /8,10/
      INTEGER*4 ME,HOST,ALLNODES
      INTEGER*4 NPROCS,TOP,ORD,DIR
      INTEGER*4 INITTYPE
      DATA INITTYPE /1/
      DATA TOP,ORD,DIR,ALLNODES /1,1,1,-1/
C -----------------------------------------------------------
C           parameters of the initial broadcast
C -----------------------------------------------------------
      INTEGER*4 MSG(1),MSGSIZE
      DATA MSGSIZE /4/
      EQUIVALENCE (MSG(1),NK)
C -----------------------------------------------------------
C      parameters of messages with partial results
C -----------------------------------------------------------
      INTEGER*4 PARTTYP1,PARTTYP2
      DATA PARTTYP1,PARTTYP2 /20,21/

      WRITE(6,*) 'enter the number of processors'
      READ(5,*) NPROCS
      CALL open0(NPROCS,ME,HOST)
      CALL load0("node15",ALLNODES)
      CALL setarc0(NPROCS, TOP, ORD, DIR)


      DO 50 K = 1, KASES

      STARTTIME=clock0()
      DO MANY=1,10
      NK=N(K)
         CALL bcast0(MSG,MSGSIZE,INITTYPE,HOST)
         CALL recv0(ERRMAX,NPTS*8,PARTTYP1)
         CALL recv0(DECAY,NPTS*8,PARTTYP2)
      ENDDO
      HOST_SEC=clock0()-STARTTIME

      CALL recv0(NODE_SEC,TIMESIZE,TIMETYPE)

      DO 170 KASE=1,2
         IF (KASE.EQ.1) THEN
            PRINT 110,NK
  110       FORMAT (4X,'PROBLEM 15 WITH NK=',I8/)
            PRINT 120
  120       FORMAT (9X,'EQUALLY SPACED POINTS'/)
            PRINT 130
  130       FORMAT (4X,'N      MAX ERROR      DECAY EXPONENT')
         ELSE
            PRINT 140
  140       FORMAT (/9X,'CHEBYSHEV SPACED POINTS'/)
            PRINT 130
         ENDIF
         DO 160 I = 2, NPTS
            PRINT 150,I,ERRMAX(I,KASE),DECAY(I,KASE)
  150       FORMAT (1X,I4,4X,E12.4,3X,F11.2)
  160    CONTINUE
C
C             PRINT OUT OF INTERPOLATION POINT ARRAY XPTS(J,N,KASE)
C             SUPPRESSED HERE TO REDUCE AMOUNT OF OUTPUT
C
  170 CONTINUE


      PRINT *, 'TIME ON NODE 0 =',NODE_SEC,' SECONDS'
      PRINT *, 'TIME ON HOST 0 =',HOST_SEC,' SECONDS'

   50 CONTINUE
C     stop processes on nodes
C
      NK=-1
      CALL bcast0(MSG,MSGSIZE,INITTYPE,HOST)
      CALL close0(1)
      STOP
      END









