1 /*****************************************************************************
2  *                                                                           *
3  * Copyright (c) 2003-2006 Intel Corporation.                                *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  *****************************************************************************
7 
8 This code is covered by the Community Source License (CPL), version
9 1.0 as published by IBM and reproduced in the file "license.txt" in the
10 "license" subdirectory. Redistribution in source and binary form, with
11 or without modification, is permitted ONLY within the regulations
12 contained in above mentioned license.
13 
14 Use of the name and trademark "Intel(R) MPI Benchmarks" is allowed ONLY
15 within the regulations of the "License for Use of "Intel(R) MPI
16 Benchmarks" Name and Trademark" as reproduced in the file
17 "use-of-trademark-license.txt" in the "license" subdirectory.
18 
19 THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
20 CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
21 LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
22 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
23 solely responsible for determining the appropriateness of using and
24 distributing the Program and assumes all risks associated with its
25 exercise of rights under this Agreement, including but not limited to
26 the risks and costs of program errors, compliance with applicable
27 laws, damage to or loss of data, programs or equipment, and
28 unavailability or interruption of operations.
29 
30 EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
31 ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
32 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
33 WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
34 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
36 DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
37 HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
38 
39 EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
40 YOUR JURISDICTION. It is licensee's responsibility to comply with any
41 export regulations applicable in licensee's jurisdiction. Under
42 CURRENT U.S. export regulations this software is eligible for export
43 from the U.S. and can be downloaded by or otherwise exported or
44 reexported worldwide EXCEPT to U.S.  embargoed destinations which
45 include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
46 Afghanistan and any other country to which the U.S. has embargoed
47 goods and services.
48 
49  ***************************************************************************
50 
51 For more documentation than found here, see
52 
53 [1] doc/ReadMe_IMB.txt
54 
55 [2] Intel (R) MPI Benchmarks
56     Users Guide and Methodology Description
57     In
58     doc/IMB_ug.pdf
59 
60  ***************************************************************************/
61 
62 
63 
64 #ifndef _DECLARE_H
65 #define _DECLARE_H
66 
67 #include <mpi.h>
68 #include <math.h>
69 #include <stdio.h>
70 #include <stdlib.h>
71 #include <string.h>
72 #include <stddef.h>
73 #include "IMB_appl_errors.h"
74 #include "IMB_err_check.h"
75 
76 /* THERE IS INCOSISTENT DEFINITION OF MPI_Type_Size arguments */
77 typedef int Type_Size;          /*correct MPI standard  */
78 /*typedef MPI_Aint Type_Size;*/ /*on SGI, HITACHI SR2201*/
79 
80 #ifdef MPIIO
81 #include "IMB_settings_io.h"
82 #else
83 #include "IMB_settings.h"
84 #endif
85 
86 #include "IMB_comm_info.h"
87 
88 #define nDEBUG
89 
90 #ifdef DEBUG
91 
92 #define DIAGNOSTICS(text,c_info,buf,loclen,totlen,j_sample,pos) {if(j_sample == 0) show((text),(c_info),(buf),(loclen),(totlen),(j_sample),(pos));}
93 
94 extern FILE* dbg_file;
95 extern char* dbgf_name;
96 
97 #define DBG_I1(text,i1) {fprintf(unit,"%s %d\n",(text),(i1));fflush(unit);}
98 #define DBG_I2(text,i1,i2) {fprintf(unit,"%s %d %d\n",(text),(i1),(i2));fflush(unit);}
99 #define DBG_I3(text,i1,i2,i3) {fprintf(unit,"%s %d %d %d\n",(text),(i1),(i2),(i3));fflush(unit);}
100 
101 #define DBGF_I1(text,i1) {fprintf(dbg_file,"%s %d\n",(text),(i1));fflush(dbg_file);}
102 #define DBGF_I2(text,i1,i2) {fprintf(dbg_file,"%s %d %d\n",(text),(i1),(i2));fflush(dbg_file);}
103 #define DBGF_I3(text,i1,i2,i3) {fprintf(dbg_file,"%s %d %d\n",(text),(i1),(i2),(i3));fflush(dbg_file);}
104 
105 #define DBGF_IARR(text,N,ia)\
106 {int i; fprintf(dbg_file,"%s ",text);for(i=0; i<N; i++) {fprintf(dbg_file,"%d ",(ia)[i]);};fprintf(dbg_file,"\n");fflush(dbg_file);}
107 
108 #else
109 
110 #define DIAGNOSTICS(text,c_info,buf,loclen,totlen,j_sample,pos)
111 
112 #define DBG_I1(text,i1)
113 #define DBG_I2(text,i1,i2)
114 #define DBG_I3(text,i1,i2,i3)
115 
116 #define DBGF_I1(text,i1)
117 #define DBGF_I2(text,i1,i2)
118 #define DBGF_I3(text,i1,i2,i3)
119 
120 #define DBGF_IARR(text,N,ia)
121 
122 #endif
123 
124 #ifdef CHECK
125 #define CHK_DIFF(text,\
126              c_info, RECEIVED, buf_pos,\
127              Locsize, Totalsize, unit_size,\
128              mode, pos,\
129              n_sample, j_sample,\
130              source, diff )\
131         IMB_chk_diff(\
132              (text),\
133              (c_info), (RECEIVED), (buf_pos), \
134              (Locsize), (Totalsize), (unit_size), \
135              (mode), (pos),\
136              (n_sample), (j_sample),\
137              (source), (diff) )\
138 
139 
140 #define CHK_STOP {if(err_flag) return;}
141 #define CHK_BRK  {if(err_flag) {IMB_err_hand(0,1); break;}}
142 
143 extern long   IMB_compute_crc (char* buf, int size);
144 extern long   r_check,s_check;
145 extern double defect;
146 extern double *all_defect;
147 
148 
149 #else
150 #define CHK_DIFF(text,\
151              c_info, RECEIVED, buf_pos,\
152              Locsize, Totalsize, unit_size,\
153              mode, pos,\
154              n_sample, j_sample,\
155              source, diff )
156 #define CHK_STOP
157 #define CHK_BRK
158 #endif
159 
160 /*   Filename for results output; insert empty string for stdout */
161 #define OUTPUT_FILENAME  ""
162 
163 #define SCALE 1000000
164 
165 /*   WIDTH OF OUTPUT TABLE */
166 #define ow_format 13
167 #define out_fields 8
168 
169 #define min(a,b) ((a)<(b)?(a):(b))
170 #define max(a,b) ((a)>(b)?(a):(b))
171 
172 #ifdef BUFFERS_INT
173 #define A_ABS(i) abs((i))
174 #endif
175 
176 #ifdef BUFFERS_FLOAT
177 #define A_ABS(x) fabs((x))
178 #endif
179 
180 static int asize = sizeof(assign_type);
181 static int ierr;
182 
183 #define MAX_TIMINGS 2
184 extern double *all_times;
185 
186 /* STRING FOR OUTPUT    */
187 extern char aux_string[out_fields*ow_format];
188 
189 /* FORMAT FOR OUTPUT    */
190 extern char format    [out_fields*7];
191 
192 /* I/O unit                  */
193 extern FILE* unit;
194 
195 /* Error message headers*/
196 
197 extern int err_flag;
198 
199 extern void* AUX;
200 extern int AUX_LEN;
201 
202 extern int    do_nonblocking;
203 extern double tCPU;    /* CPU time for overlap benchmarks */
204 extern double MFlops;
205 
206 
207 #define TOL 1.e-2
208 
209 #endif
210 
211 extern int mpi_thread_environment;
212