Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[examples,smpi] remove warnings and resolve a bug (I hope I amn't sure)
[simgrid.git] / examples / smpi / NAS / LU / read_input.f
1
2 c---------------------------------------------------------------------
3 c---------------------------------------------------------------------
4
5       subroutine read_input
6
7 c---------------------------------------------------------------------
8 c---------------------------------------------------------------------
9
10       implicit none
11
12       include 'mpinpb.h'
13       include 'applu.incl'
14
15       integer IERROR, fstatus, nnodes
16
17
18 c---------------------------------------------------------------------
19 c    only root reads the input file
20 c    if input file does not exist, it uses defaults
21 c       ipr = 1 for detailed progress output
22 c       inorm = how often the norm is printed (once every inorm iterations)
23 c       itmax = number of pseudo time steps
24 c       dt = time step
25 c       omega 1 over-relaxation factor for SSOR
26 c       tolrsd = steady state residual tolerance levels
27 c       nx, ny, nz = number of grid points in x, y, z directions
28 c---------------------------------------------------------------------
29       ROOT = 0
30       if (id .eq. ROOT) then
31
32          write(*, 1000)
33
34          open (unit=3,file='inputlu.data',status='old',
35      >         access='sequential',form='formatted', iostat=fstatus)
36          if (fstatus .eq. 0) then
37
38             write(*, *) 'Reading from input file inputlu.data'
39
40             read (3,*)
41             read (3,*)
42             read (3,*) ipr, inorm
43             read (3,*)
44             read (3,*)
45             read (3,*) itmax
46             read (3,*)
47             read (3,*)
48             read (3,*) dt
49             read (3,*)
50             read (3,*)
51             read (3,*) omega
52             read (3,*)
53             read (3,*)
54             read (3,*) tolrsd(1),tolrsd(2),tolrsd(3),tolrsd(4),tolrsd(5)
55             read (3,*)
56             read (3,*)
57             read (3,*) nx0, ny0, nz0
58             close(3)
59          else
60             ipr = ipr_default
61             inorm = inorm_default
62             itmax = itmax_default
63             dt = dt_default
64             omega = omega_default
65             tolrsd(1) = tolrsd1_def
66             tolrsd(2) = tolrsd2_def
67             tolrsd(3) = tolrsd3_def
68             tolrsd(4) = tolrsd4_def
69             tolrsd(5) = tolrsd5_def
70             nx0 = isiz01
71             ny0 = isiz02
72             nz0 = isiz03
73          endif
74
75 c---------------------------------------------------------------------
76 c   check problem size
77 c---------------------------------------------------------------------
78          call MPI_COMM_SIZE(MPI_COMM_WORLD, nnodes, ierror)
79          if (nnodes .ne. nnodes_compiled) then
80             write (*, 2000) nnodes, nnodes_compiled
81  2000       format (5x,'Warning: program is running on',i3,' processors'
82      >             /5x,'but was compiled for ', i3)
83          endif
84
85          if ( ( nx0 .lt. 4 ) .or.
86      >        ( ny0 .lt. 4 ) .or.
87      >        ( nz0 .lt. 4 ) ) then
88
89             write (*,2001)
90  2001       format (5x,'PROBLEM SIZE IS TOO SMALL - ',
91      >           /5x,'SET EACH OF NX, NY AND NZ AT LEAST EQUAL TO 5')
92             CALL MPI_ABORT( MPI_COMM_WORLD, MPI_ERR_OTHER, IERROR )
93
94          end if
95
96          if ( ( nx0 .gt. isiz01 ) .or.
97      >        ( ny0 .gt. isiz02 ) .or.
98      >        ( nz0 .gt. isiz03 ) ) then
99
100             write (*,2002)
101  2002       format (5x,'PROBLEM SIZE IS TOO LARGE - ',
102      >           /5x,'NX, NY AND NZ SHOULD BE LESS THAN OR EQUAL TO ',
103      >           /5x,'ISIZ01, ISIZ02 AND ISIZ03 RESPECTIVELY')
104             CALL MPI_ABORT( MPI_COMM_WORLD, MPI_ERR_OTHER, IERROR )
105
106          end if
107
108
109          write(*, 1001) nx0, ny0, nz0
110          write(*, 1002) itmax
111          write(*, 1003) nnodes
112
113  1000 format(//, ' NAS Parallel Benchmarks 3.3 -- LU Benchmark',/)
114  1001    format(' Size: ', i4, 'x', i4, 'x', i4)
115  1002    format(' Iterations: ', i4)
116  1003    format(' Number of processes: ', i5, /)
117          
118
119
120       end if
121
122       call bcast_inputs
123
124       return
125       end
126
127