/[MITgcm]/MITgcm_contrib/PCL/pcl_events.F
ViewVC logotype

Annotation of /MITgcm_contrib/PCL/pcl_events.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue May 9 16:11:33 2006 UTC (16 years, 9 months ago) by ce107
Branch: MAIN
CVS Tags: HEAD
Instruction (in README) and utility to generate a valid data.pcl file.

1 ce107 1.1 PROGRAM TESTPCLEVENTS
2     #include <pclh.f>
3     INTEGER nmaxevents
4     PARAMETER (nmaxevents = 61)
5     INTEGER flags, res, nevents
6     INTEGER*8 descr
7     CHARACTER*22 pcl_counter_name(0:nmaxevents-1)
8     #ifdef USE_PCL
9     INTEGER pcl_counter_list(nmaxevents)
10     INTEGER valid_counter_list(nmaxevents)
11     LOGICAL use_counter_list(nmaxevents)
12     INTEGER*8 i_result(nmaxevents)
13     INTEGER*8 i_result1(nmaxevents)
14     INTEGER*8 i_result2(nmaxevents)
15     REAL*8 fp_result(nmaxevents)
16     INTEGER pclunit
17     #else
18     INTEGER pcl_counter_list(5), alt_counter_list(5)
19     INTEGER*8 i_result(5), i_result1(5), i_result2(5)
20     REAL*8 fp_result(5)
21     SAVE alt_counter_list
22     DATA alt_counter_list /PCL_MFLOPS, PCL_IPC, PCL_L1DCACHE_MISSRATE,
23     $ PCL_L2DCACHE_MISSRATE, PCL_MEM_FP_RATIO/
24     #endif
25     COMMON /pclvars/ i_result, descr, fp_result, pcl_counter_list,
26     $ flags, nevents
27     COMMON /pclnames/ pcl_counter_name
28    
29     REAL*4 f, df, arg, PI
30     INTEGER i, valid_counters
31    
32     PI=4.0E0*ATAN(1.0)
33     f=0.0
34    
35     res = PCLinit(descr)
36    
37     #ifdef USE_PCL
38     pclunit=99
39     OPEN(UNIT=pclunit,FILE='data.pcl',STATUS='OLD')
40     read(pclunit,*) nevents
41    
42     C reset to reasonable values
43     if (nevents .gt. nmaxevents) then
44     nevents = nmaxevents
45     WRITE(*,*)
46     $ "resetting the number of PCL events to the maximum"
47     endif
48    
49     do i = 1,nevents
50     read(pclunit,*) pcl_counter_list(i)
51     if ((pcl_counter_list(i) .ge. PCL_MFLOPS) .or.
52     $ (pcl_counter_list(i) .lt. 0)) then
53     if ((pcl_counter_list(i) .ge. PCL_MFLOPS) .and.
54     $ (pcl_counter_list(i) .le. nmaxevents-1)) then
55     WRITE(*,*)
56     $ "Error! Rate events are not relevant:",
57     $ pcl_counter_name(pcl_counter_list(i))
58     else
59     WRITE(*,*)
60     $ "Error! Events are not defined:",
61     $ pcl_counter_list(i)
62     endif
63     use_counter_list(i) = .false.
64     else
65     use_counter_list(i) = .true.
66     endif
67     enddo
68     close(pclunit)
69    
70     valid_counters = 0
71     do i = 1,nevents
72     if (use_counter_list(i) .ne. .false.) then
73     valid_counter_list(valid_counters + 1) = pcl_counter_list(i)
74     valid_counters = valid_counters + 1
75     endif
76     enddo
77    
78     do i = 1,valid_counters
79     CCE107 check to see that event are supported at all
80     res = PCLquery(descr, valid_counter_list(i), 1, flags)
81     IF(res .NE. PCL_SUCCESS) THEN
82     WRITE(*,*) "Error! No support for event: "
83     $ , pcl_counter_name(valid_counter_list(i))
84     use_counter_list(i) = .false.
85     else
86     use_counter_list(i) = .true.
87     endif
88     enddo
89    
90     nevents = 0
91     do i = 1,valid_counters
92     if (use_counter_list(i) .ne. .false.) then
93     pcl_counter_list(nevents + 1) = valid_counter_list(i)
94     nevents = nevents + 1
95     endif
96     enddo
97    
98     do i = 1,nevents
99     CCE107 check to see that event are supported in the order asked
100     res = PCLquery(descr, pcl_counter_list, i, flags)
101     IF(res .NE. PCL_SUCCESS) THEN
102     WRITE(*,*) "Error! No support when adding event: "
103     $ , pcl_counter_name(pcl_counter_list(i))
104     use_counter_list(i) = .false.
105     else
106     use_counter_list(i) = .true.
107     endif
108     enddo
109    
110     valid_counters = 0
111     do i = 1,nevents
112     if (use_counter_list(i) .ne. .false.) then
113     valid_counter_list(valid_counters + 1) = pcl_counter_list(i)
114     valid_counters = valid_counters + 1
115     endif
116     enddo
117    
118     WRITE(*,*) 'Counting Events enabled:'
119     do i = 1,valid_counters
120     WRITE (*,'(I2,xA)') valid_counter_list(i),
121     $ pcl_counter_name(valid_counter_list(i))
122     enddo
123    
124     c redefine
125     nevents = valid_counters
126     do i = 1, nevents
127     pcl_counter_list(i) = valid_counter_list(i)
128     enddo
129    
130     #else
131     do i = 1,5
132     CCE107 check to see which rate events are supported.
133     res = PCLquery(descr, pcl_counter_list, nevents+1, flags)
134     if ((res .ne. PCL_SUCCESS) .and. (i .lt. 5)) then
135     pcl_counter_list(nevents+1) = alt_counter_list(i+1)
136     else
137     if (i .lt. 5) then
138     nevents = nevents + 1
139     endif
140     endif
141     enddo
142     if (nevents .eq. 0) then
143     WRITE(*,*)
144     $ "No PCL rate events supported: Please recompile!"
145     STOP
146     else
147     WRITE(*,*) 'Rate Events enabled:'
148     do i = 1,nevents
149     WRITE (*,*) pcl_counter_name(pcl_counter_list(i))
150     enddo
151     endif
152     #endif
153    
154     CCE107 - Start counting events
155     res = PCLstart(descr, pcl_counter_list, nevents, flags)
156     IF(res .NE. PCL_SUCCESS) THEN
157     WRITE(*,*) "PCL counting failed - please recompile!"
158     STOP
159     ENDIF
160    
161     CCE107 - Read event counts
162     res = PCLread(descr, i_result1, fp_result, nevents)
163    
164     do i=1,100000
165     arg = PI/1000.0*i*nevents
166     df = tan(arg)
167     f = f + df
168     WRITE (10,*) f, df, arg
169     enddo
170    
171     CCE107 - Read event counts
172     res = PCLread(descr, i_result2, fp_result, nevents)
173    
174     do i=1,valid_counters
175     i_result(i) = i_result2(i) - i_result1(i)
176     enddo
177    
178     WRITE (*,*) "f = ", f
179    
180     #ifdef USE_PCL
181     do i = 1,nevents
182     WRITE(*,*) pcl_counter_name(pcl_counter_list(i)), i_result(i),
183     $ i_result2(i), i_result1(i)
184     enddo
185     #else
186     do i = 1,nevents
187     WRITE(*,*) pcl_counter_name(pcl_counter_list(i)), fp_result(i)
188     enddo
189     #endif
190     end
191    
192     CCE107 Initialization of common block for PCL event names
193     BLOCK DATA setpclnames
194     INTEGER nmaxevents
195     PARAMETER (nmaxevents = 61)
196     CHARACTER*22 pcl_counter_name(0:nmaxevents-1)
197     COMMON /pclnames/ pcl_counter_name
198     DATA pcl_counter_name(0) /'PCL_L1CACHE_READ'/
199     DATA pcl_counter_name(1) /'PCL_L1CACHE_WRITE'/
200     DATA pcl_counter_name(2) /'PCL_L1CACHE_READWRITE'/
201     DATA pcl_counter_name(3) /'PCL_L1CACHE_HIT'/
202     DATA pcl_counter_name(4) /'PCL_L1CACHE_MISS'/
203     DATA pcl_counter_name(5) /'PCL_L1DCACHE_READ'/
204     DATA pcl_counter_name(6) /'PCL_L1DCACHE_WRITE'/
205     DATA pcl_counter_name(7) /'PCL_L1DCACHE_READWRITE'/
206     DATA pcl_counter_name(8) /'PCL_L1DCACHE_HIT'/
207     DATA pcl_counter_name(9) /'PCL_L1DCACHE_MISS'/
208     DATA pcl_counter_name(10) /'PCL_L1ICACHE_READ'/
209     DATA pcl_counter_name(11) /'PCL_L1ICACHE_WRITE'/
210     DATA pcl_counter_name(12) /'PCL_L1ICACHE_READWRITE'/
211     DATA pcl_counter_name(13) /'PCL_L1ICACHE_HIT'/
212     DATA pcl_counter_name(14) /'PCL_L1ICACHE_MISS'/
213     DATA pcl_counter_name(15) /'PCL_L2CACHE_READ'/
214     DATA pcl_counter_name(16) /'PCL_L2CACHE_WRITE'/
215     DATA pcl_counter_name(17) /'PCL_L2CACHE_READWRITE'/
216     DATA pcl_counter_name(18) /'PCL_L2CACHE_HIT'/
217     DATA pcl_counter_name(19) /'PCL_L2CACHE_MISS'/
218     DATA pcl_counter_name(20) /'PCL_L2DCACHE_READ'/
219     DATA pcl_counter_name(21) /'PCL_L2DCACHE_WRITE'/
220     DATA pcl_counter_name(22) /'PCL_L2DCACHE_READWRITE'/
221     DATA pcl_counter_name(23) /'PCL_L2DCACHE_HIT'/
222     DATA pcl_counter_name(24) /'PCL_L2DCACHE_MISS'/
223     DATA pcl_counter_name(25) /'PCL_L2ICACHE_READ'/
224     DATA pcl_counter_name(26) /'PCL_L2ICACHE_WRITE'/
225     DATA pcl_counter_name(27) /'PCL_L2ICACHE_READWRITE'/
226     DATA pcl_counter_name(28) /'PCL_L2ICACHE_HIT'/
227     DATA pcl_counter_name(29) /'PCL_L2ICACHE_MISS'/
228     DATA pcl_counter_name(30) /'PCL_TLB_HIT'/
229     DATA pcl_counter_name(31) /'PCL_TLB_MISS'/
230     DATA pcl_counter_name(32) /'PCL_ITLB_HIT'/
231     DATA pcl_counter_name(33) /'PCL_ITLB_MISS'/
232     DATA pcl_counter_name(34) /'PCL_DTLB_HIT'/
233     DATA pcl_counter_name(35) /'PCL_DTLB_MISS'/
234     DATA pcl_counter_name(36) /'PCL_CYCLES'/
235     DATA pcl_counter_name(37) /'PCL_ELAPSED_CYCLES'/
236     DATA pcl_counter_name(38) /'PCL_INTEGER_INSTR'/
237     DATA pcl_counter_name(39) /'PCL_FP_INSTR'/
238     DATA pcl_counter_name(40) /'PCL_LOAD_INSTR'/
239     DATA pcl_counter_name(41) /'PCL_STORE_INSTR'/
240     DATA pcl_counter_name(42) /'PCL_LOADSTORE_INSTR'/
241     DATA pcl_counter_name(43) /'PCL_INSTR'/
242     DATA pcl_counter_name(44) /'PCL_JUMP_SUCCESS'/
243     DATA pcl_counter_name(45) /'PCL_JUMP_UNSUCCESS'/
244     DATA pcl_counter_name(46) /'PCL_JUMP'/
245     DATA pcl_counter_name(47) /'PCL_ATOMIC_SUCCESS'/
246     DATA pcl_counter_name(48) /'PCL_ATOMIC_UNSUCCESS'/
247     DATA pcl_counter_name(49) /'PCL_ATOMIC'/
248     DATA pcl_counter_name(50) /'PCL_STALL_INTEGER'/
249     DATA pcl_counter_name(51) /'PCL_STALL_FP'/
250     DATA pcl_counter_name(52) /'PCL_STALL_JUMP'/
251     DATA pcl_counter_name(53) /'PCL_STALL_LOAD'/
252     DATA pcl_counter_name(54) /'PCL_STALL_STORE'/
253     DATA pcl_counter_name(55) /'PCL_STALL'/
254     DATA pcl_counter_name(56) /'PCL_MFLOPS'/
255     DATA pcl_counter_name(57) /'PCL_IPC'/
256     DATA pcl_counter_name(58) /'PCL_L1DCACHE_MISSRATE'/
257     DATA pcl_counter_name(59) /'PCL_L2DCACHE_MISSRATE'/
258     DATA pcl_counter_name(60) /'PCL_MEM_FP_RATIO'/
259     END
260    
261     #ifdef USE_PCL
262     CCE107 Initialization of common block for PCL summary performance
263     BLOCK DATA setpcls
264     INTEGER maxTimers
265     PARAMETER (maxTimers = 40)
266     INTEGER nmaxevents
267     PARAMETER (nmaxevents = 61)
268     INTEGER size
269     PARAMETER (size = nmaxevents)
270     INTEGER PCL_CYCLES, PCL_MODE_USER_SYSTEM
271     PARAMETER (PCL_CYCLES=36, PCL_MODE_USER_SYSTEM=3)
272     INTEGER pcl_counter_list(nmaxevents)
273     INTEGER flags, nevents
274     INTEGER*8 i_result(nmaxevents)
275     INTEGER*8 i_result1(nmaxevents)
276     INTEGER*8 i_result2(nmaxevents)
277     INTEGER*8 descr
278     REAL*8 fp_result(nmaxevents)
279     COMMON /pclvars/ i_result, descr, fp_result, pcl_counter_list,
280     $ flags, nevents
281     DATA fp_result /size*0.0D0/
282     DATA i_result /size*0/
283     DATA i_result1 /size*0/
284     DATA i_result2 /size*0/
285     DATA descr /0/
286     DATA nevents /nmaxevents/
287     DATA pcl_counter_list /nmaxevents*PCL_CYCLES/
288     DATA flags /PCL_MODE_USER_SYSTEM/
289     END
290     #else
291     CCE107 Initialization of common block for PCL summary performance
292     BLOCK DATA setpcls
293     #include <pclh.f>
294     INTEGER pcl_counter_list(5), flags, nevents
295     INTEGER*8 i_result(5), descr
296     REAL*8 fp_result(5)
297     COMMON /pclvars/ i_result, descr, fp_result, pcl_counter_list,
298     $ flags, nevents
299     DATA fp_result /5*0.0D0/
300     DATA i_result /5*0/
301     DATA descr /0/
302     DATA nevents /0/
303     DATA pcl_counter_list /PCL_MFLOPS, PCL_IPC, PCL_L1DCACHE_MISSRATE,
304     $ PCL_L2DCACHE_MISSRATE, PCL_MEM_FP_RATIO/
305     DATA flags /PCL_MODE_USER_SYSTEM/
306     END
307     #endif

  ViewVC Help
Powered by ViewVC 1.1.22