Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
hit_pattern.h
Go to the documentation of this file.
1 
15 /*
16  * <license>
17  *
18  * Hitmap v1.2
19  *
20  * This software is provided to enhance knowledge and encourage progress in the scientific
21  * community. It should be used only for research and educational purposes. Any reproduction
22  * or use for commercial purpose, public redistribution, in source or binary forms, with or
23  * without modifications, is NOT ALLOWED without the previous authorization of the copyright
24  * holder. The origin of this software must not be misrepresented; you must not claim that you
25  * wrote the original software. If you use this software for any purpose (e.g. publication),
26  * a reference to the software package and the authors must be included.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
29  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
31  * THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  * Copyright (c) 2007-2015, Trasgo Group, Universidad de Valladolid.
39  * All rights reserved.
40  *
41  * More information on http://trasgo.infor.uva.es/
42  *
43  * </license>
44 */
45 
46 #ifndef _HitPattern_
47 #define _HitPattern_
48 
49 #include <stdio.h>
50 #include "hit_com.h"
51 
52 #ifdef __cplusplus
53  extern "C" {
54 #endif
55 
56 /* Hit COMMUNICATION PATTERN STRUCTURE */
61 typedef struct HitPatS {
63  struct HitPatS *next;
64 } HitPatS;
65 
66 
71 typedef struct {
72  int numComm;
76 } HitPattern;
77 
79 #define HIT_PAT_ORDERED 0
80 
81 #define HIT_PAT_UNORDERED 1
82 
83 /* Hit PATTERN: NULL VALUE */
84 #define HIT_PATTERN_NULL_STATIC { 0, HIT_PAT_ORDERED, NULL, NULL }
86 
87 /* Hit PATTERN: INITIALIZE */
93 static inline HitPattern hit_pattern( int defaultMode ) {
94  HitPattern newPat = { 0, defaultMode, NULL, NULL };
95  return newPat;
96 }
97 
98 /* Hit PATTERN: ADD COMM */
105 void hit_patternAdd( HitPattern *pattern, HitCom comm );
106 
107 /* Hit PATTERN: COMPOSE PATTERN */
114 void hit_patternCompose( HitPattern *pattern, HitPattern *pattern2 );
115 
116 
117 /* Hit PATTERN: FREE */
122 void hit_patternFree( HitPattern *pattern );
123 
124 /* Hit PATTERN: EXECUTE ORDERED */
129 void hit_patternDoOrdered( HitPattern pattern );
130 
131 /* Hit PATTERN: EXECUTE UNORDERED */
136 void hit_patternDoUnordered( HitPattern pattern );
137 
138 /* Hit PATTERN: START ASYNC SEND/RECV */
143 void hit_patternStartAsync( HitPattern pattern );
144 
145 /* Hit PATTERN: END ASYNC SEND/RECV */
150 void hit_patternEndAsync( HitPattern pattern );
151 
152 /* Hit PATTERN: EXECUTE IN DEFAULT MODE */
157 #define hit_patternDo( pattern ) { \
158  if ( pattern.defaultMode == HIT_PAT_ORDERED ) \
159  hit_patternDoOrdered( pattern ); \
160  else \
161  hit_patternDoUnordered( pattern ); \
162  }
163 
164 
165 /* Hit PATTERN: EXECUTE AND FREE A PATTERN */
170 #define hit_patternDoOnce( pat ) { HitPattern __HIT_PAT__ = pat; hit_patternDo( __HIT_PAT__ ); hit_patternFree( &__HIT_PAT__ ); }
171 
172 
173 
174 /* Hit PATTERN: SPECIFIC PATTERNS FOR SPECIAL COMPLEX COMMUNICATIONS */
185 HitPattern hit_patternLayRedistribute( HitLayout lay1, HitLayout lay2, void * tileP1, void *tileP2, HitType baseType );
186 
196 HitPattern hit_patternRedistribute( HitLayout lay, void * tileP1, void *tileP2, HitType baseType, int flagCompact );
197 
198 
210 #define hit_patMatMult(pattern, lay, origin_matrix, matrix, tilePSend, tilePRecv, baseType) hit_patMatMultInternal(pattern, lay, origin_matrix, matrix, tilePSend, tilePRecv, baseType,__FILE__, __LINE__);
211 void hit_patMatMultInternal(HitPattern *pattern, HitLayout lay, HitShape origin_matrix, HitShape matrix, const void * tilePSend, const void * tilePRecv, HitType baseType, const char * file, int line);
212 
213 
225 #define hit_patMatMultBitmap(pattern, lay, origin_matrix, matrix, tilePSend, tilePRecv, baseType) hit_patMatMultBitmapInternal(pattern, lay, origin_matrix, matrix, tilePSend, tilePRecv, baseType,__FILE__, __LINE__);
226 void hit_patMatMultBitmapInternal(HitPattern *pattern, HitLayout lay, HitShape origin_matrix, HitShape matrix, const void * tilePSend, const void * tilePRecv, HitType baseType, const char * file, int line);
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 /* END OF HEADER FILE _HitPattern_ */
241 #endif
HitCom commSpec
Definition: hit_pattern.h:62
void hit_patternEndAsync(HitPattern pattern)
Definition: hit_pattern.c:200
HitPatS * last
Definition: hit_pattern.h:75
void hit_patternDoOrdered(HitPattern pattern)
Definition: hit_pattern.c:107
HitPattern hit_patternLayRedistribute(HitLayout lay1, HitLayout lay2, void *tileP1, void *tileP2, HitType baseType)
Definition: hit_pattern.c:533
HitPattern HIT_PATTERN_NULL
Definition: hit_pattern.c:57
HitPatS * first
Definition: hit_pattern.h:74
void hit_patMatMultInternal(HitPattern *pattern, HitLayout lay, HitShape origin_matrix, HitShape matrix, const void *tilePSend, const void *tilePRecv, HitType baseType, const char *file, int line)
Definition: hit_pattern.c:1003
struct HitPatS HitPatS
void hit_patternAdd(HitPattern *pattern, HitCom comm)
Definition: hit_pattern.c:61
MPI_Comm comm
Definition: SWpar_ref.c:193
MPI_Datatype HitType
Definition: hit_com.h:70
void hit_patternFree(HitPattern *pattern)
Definition: hit_pattern.c:94
struct HitPatS * next
Definition: hit_pattern.h:63
HitPattern hit_patternRedistribute(HitLayout lay, void *tileP1, void *tileP2, HitType baseType, int flagCompact)
Definition: hit_pattern.c:653
void hit_patMatMultBitmapInternal(HitPattern *pattern, HitLayout lay, HitShape origin_matrix, HitShape matrix, const void *tilePSend, const void *tilePRecv, HitType baseType, const char *file, int line)
Definition: hit_pattern.c:1182
void hit_patternDoUnordered(HitPattern pattern)
Definition: hit_pattern.c:117
void hit_patternCompose(HitPattern *pattern, HitPattern *pattern2)
Definition: hit_pattern.c:85
int defaultMode
Definition: hit_pattern.h:73
void hit_patternStartAsync(HitPattern pattern)
Definition: hit_pattern.c:187
HitLayout lay
Definition: heat.c:107