Log In | Get Help   
Home My Page Projects Code Snippets Project Openings UPC Operations Microbenchmarking Suite
Summary Activity Tracker Lists Docs News SCM Files
[uoms] Annotation of /trunk/uoms/src/utils/data_print.upc
[uoms] / trunk / uoms / src / utils / data_print.upc Repository:
ViewVC logotype

Annotation of /trunk/uoms/src/utils/data_print.upc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (view) (download)

1 : dalvarez 1 /*****************************************************************************/
2 :     /* */
3 :     /* Copyright (c) 2008, 2009, 2010 */
4 :     /* Computer Architecture Group (CAG) */
5 :     /* University of A Coruña, Spain */
6 :     /* (http://gac.des.udc.es) */
7 :     /* Galicia Supercomputing Center (CESGA) */
8 :     /* (http://www.cesga.es) */
9 :     /* Hewlett-Packard Spain (HP) */
10 :     /* (http://www.hp.es) */
11 :     /* */
12 :     /* This file is part of UPC Operations Microbenchmarking Suite (UOMS). */
13 :     /* */
14 :     /* UOMS is free software: you can redistribute it and/or modify */
15 :     /* it under the terms of the GNU Lesser General Public License as published */
16 :     /* by the Free Software Foundation, either version 3 of the License, or */
17 :     /* (at your option) any later version. */
18 :     /* */
19 :     /* UOMS is distributed in the hope that it will be useful, */
20 :     /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21 :     /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22 :     /* GNU Lesser General Public License for more details. */
23 :     /* */
24 :     /* You should have received a copy of the GNU Lesser General Public License */
25 :     /* along with UOMS. If not, see <http://www.gnu.org/licenses/>. */
26 :     /* */
27 :     /*****************************************************************************/
28 :    
29 :     /*****************************************************************************/
30 :     /* */
31 :     /* FUNDING: This development has been funded by Hewlett-Packard Spain */
32 :     /* */
33 :     /* Project Name: */
34 :     /* UPCHACO (2008-2011) */
35 :     /* Subproject: */
36 :     /* Improving UPC Usability and Performance in Constellation Systems: */
37 :     /* Implementation/Extensions of UPC Libraries. */
38 :     /* (UPCPU­Project -> UPC Performance and Usability Project) */
39 :     /* */
40 :     /*****************************************************************************/
41 :    
42 :     /*****************************************************************************
43 :    
44 :     For further documentation, see
45 :    
46 :     [1] Files under doc/
47 :    
48 :     ******************************************************************************/
49 :    
50 :     #include <stdio.h>
51 :     #include <time.h>
52 :     #include <sys/utsname.h>
53 :     #include "defines.h"
54 :     #include "headers.h"
55 :     #include "timers/timers.h"
56 :    
57 :     extern FILE* unit;
58 :     extern int cache_invalidation;
59 :     extern int warmup;
60 :     extern char * char_reduce_op;
61 :     extern char * char_sync_mode;
62 :     extern int num_sizes;
63 :     extern long *sizes;
64 :     extern char * valid_bms[NUM_BMS];
65 :     extern int num_bms;
66 :     extern int *bm_list;
67 :    
68 :     /*
69 :     Gets the aggreated bandwidth factor
70 :     */
71 :     double fAggreatedBw(int operation_code){
72 :    
73 :     double factor=1.0;
74 :    
75 :     switch (operation_code) {
76 :     case BROADCAST:
77 :     factor = THREADS;
78 :     break;
79 :     case EXCHANGE:
80 :     factor = THREADS*THREADS;
81 :     break;
82 :     case GATHERALL:
83 :     factor = THREADS+THREADS*THREADS;
84 :     break;
85 :     case SCATTER:
86 :     factor = THREADS;
87 :     break;
88 :     case GATHER:
89 :     factor = THREADS;
90 :     break;
91 :     case PERMUTE:
92 :     factor = THREADS;
93 :     break;
94 :     default:
95 :     factor = 1.0;
96 :     break;
97 :     }
98 :     return factor;
99 :     }
100 :    
101 :     /*
102 :     Prints usage
103 :     */
104 :     void print_usage(char *appname){
105 :     printf("\nUOMS usage:\n");
106 :     printf("[Your UPC runtime launch command] %s [-help | -version | [-off_cache] [-warmup] [-reduce_op OP] [-sync_mode MODE] [-msglen FILE | [-minsize SIZE] [-maxsize SIZE] ] [-input FILE] [output_file]]\n",appname);
107 :     printf("Where:\n");
108 :     printf("-help: Print this usage information and exits\n");
109 :     printf("-version: Print UOMS version and exits\n");
110 :     printf("-off_cache: Enable cache invalidation\n");
111 :     printf("-warmup: Enable a warmup iteration\n");
112 :     printf("-reduce_op OP: Choose the reduce operation to be performed by upc_all_reduce and upc_all_prefix_reduce\n");
113 :     printf("Valid operations are:\n");
114 :     printf(" - UPC_ADD (default)\n");
115 :     printf(" - UPC_MULT\n");
116 :     printf(" - UPC_AND\n");
117 :     printf(" - UPC_OR\n");
118 :     printf(" - UPC_XOR\n");
119 :     printf(" - UPC_LOGAND\n");
120 :     printf(" - UPC_LOGOR\n");
121 :     printf(" - UPC_MIN\n");
122 :     printf(" - UPC_MAX\n");
123 :     printf("-sync_mode MODE: Choose the synchronization mode for the collective operations\n");
124 :     printf("Valid modes are:\n");
125 :     printf(" - UPC_IN_ALLSYNC|UPC_OUT_ALLSYNC (default)\n");
126 :     printf(" - UPC_IN_ALLSYNC|UPC_OUT_MYSYNC\n");
127 :     printf(" - UPC_IN_ALLSYNC|UPC_OUT_NOSYNC\n");
128 :     printf(" - UPC_IN_MYSYNC|UPC_OUT_ALLSYNC\n");
129 :     printf(" - UPC_IN_MYSYNC|UPC_OUT_MYSYNC\n");
130 :     printf(" - UPC_IN_MYSYNC|UPC_OUT_NOSYNC\n");
131 :     printf(" - UPC_IN_NOSYNC|UPC_OUT_ALLSYNC\n");
132 :     printf(" - UPC_IN_NOSYNC|UPC_OUT_MYSYNC\n");
133 :     printf(" - UPC_IN_NOSYNC|UPC_OUT_NOSYNC\n");
134 :     printf("-msglen FILE: Read user defined block sizes from FILE (in bytes). If specified it will override -minsize and -maxsize\n");
135 :     printf("-minsize SIZE: Specifies the minimum block size (in bytes). Sizes will increase by a factor of 2\n");
136 :     printf("-maxsize SIZE: Specifies the maximum block size (in bytes)\n");
137 :     printf("-input FILE: Read user defined list of benchmarks to run from FILE\n");
138 :     printf("Valid benchmark names are:\n");
139 :     for(int i = 0; i < NUM_BMS; i++){
140 :     printf(" - %s\n",valid_bms[i]);
141 :     }
142 :     printf("output_file: Alternative output file (rather than stdout)\n\n");
143 :     }
144 :    
145 :     /*
146 :     Prints performance data acording to the header type
147 :     */
148 :     void print_performance_data(int operation_code, int cursize,int niterations,uint64_t minTime, uint64_t maxTime, uint64_t totalTime) {
149 :     if (operation_header(operation_code)==1) {
150 :     if (!MYTHREAD)
151 :     fprintf(unit,"%14d %13llu %13llu %10.2lf\n",
152 :     niterations,ticksToNS(minTime),ticksToNS(maxTime),(((double)ticksToNS(totalTime))/niterations));
153 :     }
154 :     else if (operation_header(operation_code)==2) {
155 :     if (!MYTHREAD)
156 :     fprintf(unit,"%13d %13d %13llu %13llu %12.2lf\n",
157 :     cursize,niterations,ticksToNS(minTime),ticksToNS(maxTime),(((double)ticksToNS(totalTime))/niterations));
158 :     }
159 :     else if (operation_header(operation_code)==3) {
160 :     if (!MYTHREAD) {
161 :     double opBw = (((double)fAggreatedBw(operation_code)*cursize)/((double) ticksToNS(minTime)/1000));
162 :     fprintf(unit,"%13d %13d %13llu %13llu %12.2lf %12.2lf \n",
163 :     cursize,niterations,ticksToNS(minTime),ticksToNS(maxTime),(((double)ticksToNS(totalTime))/niterations),opBw);
164 :     }
165 :     }
166 :     fflush(unit);
167 :     return;
168 :     }
169 :    
170 :     /*
171 :     Prints UOMS version
172 :     */
173 :     void print_version(){
174 :     printf("UPC Operations Microbenchmarking Suite (UOMS) version: %s\n",VERSION);
175 :     }
176 :    
177 :     /*
178 :     Prints general benchmark info
179 :     */
180 :     void UOMS_general_info(){
181 :    
182 :     time_t T;
183 :     struct utsname info;
184 :    
185 :     time(&T);
186 :     uname( &info );
187 :    
188 :    
189 :     fprintf(unit,"#---------------------------------------------------\n");
190 :     fprintf(unit,"# UPC Operations Microbenchmark Suite V%s \n",VERSION);
191 :     fprintf(unit,"#---------------------------------------------------\n");
192 :     fprintf(unit,"# Date : %s",asctime(localtime(&T)));
193 :     fprintf(unit,"# Machine : %s\n",info.machine);
194 :     fprintf(unit,"# System : %s\n",info.sysname);
195 :     fprintf(unit,"# Release : %s\n",info.release);
196 :     fprintf(unit,"\n");
197 :     if(cache_invalidation == 1)
198 :     fprintf(unit,"# Cache invalidation : Enabled\n");
199 :     else
200 :     fprintf(unit,"# Cache invalidation : Disabled\n");
201 :     fprintf(unit,"\n");
202 :     if(warmup == 1)
203 :     fprintf(unit,"# Warmup iteration : Enabled\n");
204 :     else
205 :     fprintf(unit,"# Warmup iteration : Disabled\n");
206 :     fprintf(unit,"\n");
207 :     fprintf(unit,"# Problem sizes:\n");
208 :     for(int i = 0; i < num_sizes; i++){
209 :     fprintf(unit,"# %ld\n",sizes[i]);
210 :     }
211 :     fprintf(unit,"\n");
212 :     fprintf(unit,"# Synchronization mode : %s \n",char_sync_mode);
213 :     fprintf(unit,"\n");
214 :     fprintf(unit,"# Reduce Op : %s \n",char_reduce_op);
215 :     fprintf(unit,"\n");
216 :     fprintf(unit,"\n");
217 :     fprintf(unit,"# List of Benchmarks to run:\n");
218 :     fprintf(unit,"\n");
219 :     for(int i = 0; i < num_bms; i++){
220 :     fprintf(unit,"# %s\n",valid_bms[bm_list[i]]);
221 :     }
222 :     fprintf(unit,"\n");
223 :     }
224 :    
225 :    
226 :     void UOMS_function_info(int operation,int nthreads,int headertype){
227 :    
228 :     char *funcname;
229 :    
230 :     switch (operation) {
231 :     case BROADCAST:
232 :     case SCATTER:
233 :     case GATHER:
234 :     case GATHERALL:
235 :     case EXCHANGE:
236 :     case PERMUTE:
237 :     case BARRIER:
238 :     case MEMGET:
239 :     case MEMPUT:
240 :     case MEMCPY:
241 :     case LMEMGET:
242 :     case LMEMPUT:
243 :     case LMEMCPY:
244 :     case SMEMCPY:
245 :     case MEMMOVE:
246 :     case ALLALLOC:
247 :     case FREE:
248 :     case REDUCE_C:
249 :     case PREFIX_REDUCE_C:
250 :     case REDUCE_UC:
251 :     case PREFIX_REDUCE_UC:
252 :     case REDUCE_S:
253 :     case PREFIX_REDUCE_S:
254 :     case REDUCE_US:
255 :     case PREFIX_REDUCE_US:
256 :     case REDUCE_I:
257 :     case PREFIX_REDUCE_I:
258 :     case REDUCE_UI:
259 :     case PREFIX_REDUCE_UI:
260 :     case REDUCE_L:
261 :     case PREFIX_REDUCE_L:
262 :     case REDUCE_UL:
263 :     case PREFIX_REDUCE_UL:
264 :     case REDUCE_F:
265 :     case PREFIX_REDUCE_F:
266 :     case REDUCE_D:
267 :     case PREFIX_REDUCE_D:
268 :     case REDUCE_LD:
269 :     case PREFIX_REDUCE_LD:
270 :     #ifdef ASYNC_MEM_TEST
271 :     case AMEMGET:
272 :     case AMEMPUT:
273 :     case AMEMCPY:
274 :     case ALMEMGET:
275 :     case ALMEMPUT:
276 :     case ALMEMCPY:
277 :     #endif
278 : dalvarez 7 #ifdef ASYNCI_MEM_TEST
279 :     case AIMEMGET:
280 :     case AIMEMPUT:
281 :     case AIMEMCPY:
282 :     case AILMEMGET:
283 :     case AILMEMPUT:
284 :     case AILMEMCPY:
285 :     #endif
286 : dalvarez 1 funcname = valid_bms[operation];
287 :     break;
288 :     default: funcname = "Not yet defined";
289 :     }
290 :    
291 :    
292 :     fprintf(unit,"\n");
293 :     fprintf(unit,"#---------------------------------------------------\n");
294 :     fprintf(unit,"# Benchmarking %s \n",funcname);
295 :     fprintf(unit,"# #processes = %d \n",nthreads);
296 :     fprintf(unit,"#---------------------------------------------------\n");
297 :     if (headertype==1)
298 :     fprintf(unit," #repetitions t_min[nsec] t_max[nsec] t_avg[nsec]\n");
299 :     else if (headertype==2)
300 :     fprintf(unit," #bytes #repetitions t_min[nsec] t_max[nsec] t_avg[nsec]\n");
301 :     else if (headertype==3)
302 :     fprintf(unit," #bytes #repetitions t_min[nsec] t_max[nsec] t_avg[nsec] Bw_aggregated[MB/sec]\n");
303 :    
304 :     }
305 :    
306 :    

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge