Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2g / mod2g.f @ 0:839f52ef7657

History | View | Annotate | Download (4.7 kB)

1
      Program mod2g
2
! **********************************************************************
3
! *** This program is part of the EuroBen Benchmark                  ***
4
! *** Copyright: EuroBen Group p/o                                   ***
5
! ***            Utrecht University, Computational Physics Dept.     ***
6
! ***            P.O. Box 80195                                      ***
7
! ***            3508 TD Utrecht                                     ***
8
! ***            The Netherlands                                     ***
9
! ***                                                                ***
10
! *** Author of this program: Aad J. van der Steen                   ***
11
! *** Contributed:            Autumn 1998                            ***
12
! *** Improved communicaton:  Spring 2005                            ***
13
! **********************************************************************
14
!  Version 2.1
15
!
16
! --- Purpose of this module
17
!     ----------------------
18
!     This program performs 2-D Haar wavelet transforms as used in data
19
!     compression. Data are generated internally and, subsequently, a
20
!     wavelet analysis and sythesis are performed. The time and Mflop/s
21
!     for an analysis/synthesis pair are determined.
22
! ----------------------------------------------------------------------
23
      Use                      numerics
24
      Use                      dist_module ! Contains # of proc.s &
25
                                           ! proc. numbers.
26
      Implicit                 None
27
      Include                 'mpif.h'
28

    
29
      Real(l_), Allocatable :: a1(:,:), a2(:,:), w1(:,:), w2(:,:)
30
      Real(l_)              :: speed, time, timeg
31
      Real(l_)              :: ctime, ctimeg, pctime
32
      Real(l_)              :: start_time, end_time
33
      Integer, Allocatable  :: actsiz(:,:), base(:,:)
34
      Integer               :: hsize, i, ierr, n1, n2, nflops, nrep,
35
     &                         vsize
36
      Logical               :: ok, okg
37
! ----------------------------------------------------------------------
38
      Call csetup
39
      start_time = MPI_Wtime()
40
      If ( me == 0 ) Call state( 'mod2g   ' )
41
      Open( 1, File = 'mod2g.in' )
42
      If ( me == 0 ) Print 1000, nodes
43
   10 Read( 1, *, End = 30 ) n1, n2, nrep
44
      Allocate( actsiz(0:nodes-1,2), base(0:nodes-1,2) )
45
      Call sizoff( n1, n2, actsiz, base )
46
      vsize  = Maxval( actsiz(:,1) )
47
      hsize  = Maxval( actsiz(:,2) )
48
      Allocate( a1(n1,hsize), a2(n2,vsize), w1(n1,hsize), w2(n2,vsize) )
49
      nflops = 5*(n2*(n1 - 1) + n1*(n2 - 1))
50
      Call gendat( a1, n1, actsiz(me,2), actsiz, base )
51
      time = MPI_Wtime()
52
      ctime = 0.0_l_
53
      Do i = 1, nrep
54
         Call anhr2d( a1, a2, w1, w2, n1, n2, vsize, hsize, ctime )
55
         Call synhr2d( a1, a2, w1, w2, n1, n2, vsize, hsize, ctime )
56
      End Do
57
      time = MPI_Wtime() - time
58
      Call MPI_Reduce( time, timeg, 1, MPI_Real8, MPI_Max, 0,
59
     &                 MPI_Comm_World, ierr )
60
      Call MPI_Reduce( ctime, ctimeg, 1, MPI_Real8, MPI_Max, 0,
61
     &                 MPI_Comm_World, ierr )
62
      pctime = 100.0_l_*(ctimeg/timeg)
63
      timeg  = timeg/Real( nrep, l_ )
64
      ctimeg = ctimeg/Real( nrep, l_ )
65
      speed = ( 1.0E-6_l_*nflops )/Max( timeg, 1.0E-9_l_ )
66
      Call gendat( w1, n1, actsiz(me,2), actsiz, base )    
67
      ok = .TRUE.
68
      Call check( w1, a1, hsize, n1, actsiz, ok )
69
      Call MPI_Reduce( ok, okg, 1, MPI_Logical, MPI_Land, 0,
70
     &                 MPI_Comm_World, ierr )
71
      If ( me == 0 ) Print 1010, n1, n2, timeg, speed, ctimeg, pctime,
72
     &                           okg    
73
      Deallocate( a1, a2, w1, w2 , actsiz, base )
74
      Go To 10
75
   30 If ( me == 0 ) Print 1020
76

    
77
      end_time =  MPI_Wtime() - start_time
78
      If (me == 0) Then
79
         Write(6,22) 'Walltime: ', end_time, " s"
80
 22      Format(A,F9.3,A)
81
      End If
82
      Call MPI_Finalize( ierr )
83
! ----------------------------------------------------------------------
84
 1000 Format( //, 'Haar wavelet transform test: No. of procs. = ', i3/
85
     &        '-------------------------------------------------------',
86
     &        '------------------------'/
87
     &        '    Order   | Exec. Time  |    Speed    | Comm. time  |',
88
     &        '  Frac.  | Correctness |'/
89
     &        '  n1 |  n2  |     (s)     |  (Mflop/s)  |     (s)     |',
90
     &        '   (%)   |      OK     |'/
91
     &        '-------------------------------------------------------',
92
     &        '------------------------' )
93
 1010 Format( i4,' | ',  i4,' |', g12.5,' |', g13.5, '|', g13.5,
94
     &        '| ', f7.3, ' |    ', l3, '      |' )
95
 1020 Format( '-------------------------------------------------------',
96
     &        '------------------------' )
97
! ----------------------------------------------------------------------
98
      End Program mod2g