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/utilities.upc
[uoms] / trunk / uoms / src / utils / utilities.upc Repository:
ViewVC logotype

Annotation of /trunk/uoms/src/utils/utilities.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 "../defines.h"
51 :    
52 :     extern int cache_invalidation;
53 :    
54 :     /*********************************************
55 :     Utility functions (niters...)
56 :     **********************************************/
57 :    
58 :     int niters(int msize)
59 :     {
60 :     /*
61 :     * With cache invalidation the number of buckets will be equal to the number
62 :     * of iterations, resulting in excesive memory consumption. To avoid that
63 :     * the number of iterations will be less than without cache invalidation.
64 :     */
65 :    
66 :     int iters = 0;
67 :     int factor = 1;
68 :    
69 :     if(cache_invalidation == 1){
70 :     if (msize <= 16*1024) iters=100;
71 :     else if (msize <= 512*1024) iters=50;
72 :     else if (msize <= 4*1024*1024) iters=25;
73 :     else if (msize <= 16*1024*1024) iters=10;
74 :     else iters=5;
75 :     }
76 :     else{
77 :     if (msize <= 16*1024) iters=1000;
78 :     else if (msize <= 512*1024) iters=500;
79 :     else if (msize <= 4*1024*1024) iters=250;
80 :     else if (msize <= 16*1024*1024) iters=100;
81 :     else iters=50;
82 :     }
83 :    
84 :     if(THREADS<16){
85 :     factor=1;
86 :     }
87 :     else if(THREADS<64){
88 :     factor=2;
89 :     }
90 :     else if(THREADS<256){
91 :     factor=3;
92 :     }
93 :     else if(THREADS<1024){
94 :     factor=4;
95 :     }
96 :     else{
97 :     factor=5;
98 :     }
99 :    
100 :     if(iters/factor < 1)
101 :     return 1;
102 :     else
103 :     return iters/factor;
104 :    
105 :     }
106 :    
107 :     /*
108 :     Sets the header type
109 :     */
110 :     int operation_header(int operation_code){
111 :    
112 :     int headertype=0;
113 :    
114 :     switch (operation_code) {
115 :     case BROADCAST:
116 :     case SCATTER:
117 :     case GATHER:
118 :     case GATHERALL:
119 :     case EXCHANGE:
120 :     case PERMUTE:
121 :     case MEMGET:
122 :     case MEMPUT:
123 :     case MEMCPY:
124 :     case LMEMGET:
125 :     case LMEMPUT:
126 :     case LMEMCPY:
127 :     #ifdef ASYNC_MEM_TEST
128 :     case AMEMGET:
129 :     case AMEMPUT:
130 :     case AMEMCPY:
131 :     case ALMEMGET:
132 :     case ALMEMPUT:
133 :     case ALMEMCPY:
134 :     #endif
135 : dalvarez 7 #ifdef ASYNCI_MEM_TEST
136 :     case AIMEMGET:
137 :     case AIMEMPUT:
138 :     case AIMEMCPY:
139 :     case AILMEMGET:
140 :     case AILMEMPUT:
141 :     case AILMEMCPY:
142 :     #endif
143 : dalvarez 1 case SMEMCPY:
144 :     case MEMMOVE:
145 :     headertype=3;
146 :     break;
147 :     case BARRIER:
148 :     headertype=1;
149 :     break;
150 :     default:
151 :     headertype=2;
152 :     break;
153 :     }
154 :     return headertype;
155 :     }

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

Powered By FusionForge