File: lam.h

package info (click to toggle)
xmpi 2.2-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,232 kB
  • ctags: 1,656
  • sloc: ansic: 13,738; sh: 1,799; makefile: 233
file content (171 lines) | stat: -rw-r--r-- 3,830 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 * Copyright 1998-1999, University of Notre Dame.
 * Authors: Brian W. Barrett, Arun F. Rodrigues, Jeffrey M. Squyres,
 * 	 and Andrew Lumsdaine
 *
 * This file is part of XMPI
 *
 * You should have received a copy of the License Agreement for XMPI 
 * along with the software; see the file LICENSE.  If not, contact 
 * Office of Research, University of Notre Dame, Notre Dame, IN 46556.
 *
 * Permission to modify the code and to distribute modified code is
 * granted, provided the text of this NOTICE is retained, a notice that
 * the code was modified is included with the above COPYRIGHT NOTICE and
 * with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
 * file is distributed with the modified code.
 *
 * LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
 * By way of example, but not limitation, Licensor MAKES NO
 * REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
 * PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
 * OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
 * OR OTHER RIGHTS.
 *
 * Additional copyrights may follow.

 *
 *	$Id: lam.h,v 1.5 1999/11/08 06:20:20 bbarrett Exp $
 *
 */

#ifndef _LAM_H
#define _LAM_H

#include "xmpi_config.h"

#include <errno.h>
#include <string.h>

/*
 * LAM constants used in portable code.
 */
#define	LAMERROR	(-1)
#define ERROR		(-1)
#define LOCAL		0x80000001	/* on the local node */
#define NOTNODEID	0x80000000	/* not a valid node ID */
#define HOST2ALL	0x80000002	/* origin otb to all nodes */
#define HOST2ITB	0x80000003	/* origin otb to all ITB nodes */
#define HOST2OTB	0x80000005	/* origin otb to all OTB nodes */
#define HOST2COMP	0x80000006	/* origin otb to all compute nodes */
#define NT_CAST		0x02		/* a multicast of nodes */
#define NT_ME		0x80		/* my local node */

typedef unsigned int	unint;

/*
 * errors
 */
#define XMPI_ERR_LOW	1024

#define EUSAGE		1024
#define EDELETE		1025
#define EMAGIC		1026
#define EBADIDSPEC	1027
#define EIMPOSSIBLE	1028

#define XMPI_ERR_HIGH	1028

/*
 * Path name separator.
 */
#ifndef DOS
#define STRDIR		'/'
#define STRSDIR		"/"
#else
#define STRDIR		'\\'
#define STRSDIR		"\\"
#endif

/*
 * To const or not to const.
 */
#ifndef XMPI_CONST
#if __STDC__ || defined(c_plusplus) || defined(__cplusplus)
#define XMPI_CONST const
#else
#define XMPI_CONST
#endif
#endif

/*
 * macros
 */
#define max(a,b)	(((a) > (b)) ? (a) : (b))
#define min(a,b)	(((a) < (b)) ? (a) : (b))


/*
 * Portable datatypes.
 */
#if SIZEOF_INT == 4
typedef int		int4;
#elif SIZEOF_SHORT == 4
typedef short		int4;
#endif

#if SIZEOF_FLOAT == 8
typedef float		float8;
#elif SIZEOF_DOUBLE == 8
typedef double		float8;
#endif

/*
 * Integer conversions.
 */
#if WORDS_BIGENDIAN

#define ltoti4(x, y)	*((int4 *) (y)) = *((int4 *) (x))
#define ttoli4(x, y)	*((int4 *) (y)) = *((int4 *) (x))
#define mltoti4(x, l)
#define mttoli4(x, l)

#else /* not WORDS_BIGENDIAN */

#define ltoti4(x, y)	rev4(x, y)
#define ttoli4(x, y)	rev4(x, y)
#define mltoti4(x, l)	mrev4(x, l)
#define mttoli4(x, l)	mrev4(x, l)

#endif /* not WORDS_BIGENDIAN */

/*
 * Floating point conversions.
 */
#if WORDS_BIGENDIAN

#define ltotf8(x, y)	*((float8 *) (y)) = *((float8 *) (x))
#define ttolf8(x, y)	*((float8 *) (y)) = *((float8 *) (x))
#define mltotf8(x, l)
#define mttolf8(x, l)

#else /* not WORDS_BIGENDIAN */

#define ltotf8(x, y)	rev8(x, y)
#define ttolf8(x, y)	rev8(x, y)
#define mltotf8(x, l)	mrev8(x, l)
#define mttolf8(x, l)	mrev8(x, l)

#endif /* not WORDS_BIGENDIAN */

#define __ARGS(a)	a

/*
 * prototypes
 */
#ifdef __cplusplus
extern "C" {
#endif

void rev4(void *src, void *dest);
void rev8(void *src, void *dest);
void mrev4(void *array, int num);
void mrev8(void *array, int num);

int4 stoi(unsigned char *);

#ifdef __cplusplus
}
#endif

#endif	/* _LAM_H */