1TTOL(3)                       LAM NETWORK LIBRARY                      TTOL(3)
2
3
4

NAME

6       ttol, ltot, mttol, mltot - LAM data representation translation suite
7

C SYNOPSIS

9       #include <portable.h>
10       #include <t_types.h>
11
12       void ttoli4 (int4 *pvar1, int4 *pvar2);
13       void ltoti4 (int4 *pvar1, int4 *pvar2);
14       void ttoli2 (int2 *pvar1, int2 *pvar2);
15       void ltoti2 (int2 *pvar1, int2 *pvar2);
16       void ttolf4 (float4 *pvar1, float4 *pvar2);
17       void ltotf4 (float4 *pvar1, float4 *pvar2);
18       void ttolf8 (float8 *pvar1, float8 *pvar2);
19       void ltotf8 (float8 *pvar1, float8 *pvar2);
20
21       void mttoli4 (int4 *array, int num);
22       void mltoti4 (int4 *array, int num);
23       void mttoli2 (int2 *array, int num);
24       void mltoti2 (int2 *array, int num);
25       void mttolf4 (float4 *array, int num);
26       void mltotf4 (float4 *array, int num);
27       void mttolf8 (float8 *array, int num);
28       void mltotf8 (float8 *array, int num);
29

FORTRAN SYNOPSIS

31       subroutine F4LTOT (lvar, tvar)
32       subroutine F4TTOL (tvar, lvar)
33       real*4 lvar, tvar
34
35       subroutine F8LTOT (lvar, tvar)
36       subroutine F8TTOL (tvar, lvar)
37       real*8 lvar, tvar
38
39       subroutine I4LTOT (lvar, tvar)
40       subroutine I4TTOL (tvar, lvar)
41       integer*4 lvar, tvar
42
43       subroutine I2LTOT (lvar, tvar)
44       subroutine I2TTOL (tvar, lvar)
45       integer*2 tvar, lvar
46
47       subroutine F4MLTT (array, num)
48       subroutine F4MTTL (array, num)
49       real*4 array(*)
50       integer num
51
52       subroutine F8MLTT (array, num)
53       subroutine F8MTTL (array, num)
54       real*8 array(*)
55       integer num
56
57       subroutine I4MLTT (array, num)
58       subroutine I4MTTL (array, num)
59       integer*4 array(*)
60       integer num
61
62       subroutine I2MLTT (array, num)
63       subroutine I2MTTL (array, num)
64       integer*2 array(*)
65       integer num
66

DESCRIPTION

68       The number and order of bytes in a word may differ between nodes in any
69       LAM network.  The representation of floating  point  numbers  may  also
70       vary.   To  transfer  message  and file data correctly, both sender and
71       receiver in a LAM network must  agree  on  the  amount  of  data  being
72       exchanged and its representation.  A simple solution to these two prob‐
73       lems is to define a standard representation  and  require  senders  and
74       receivers  to  convert  their  data  from/to  the  local representation
75       to/from the standard format.  Conversion is not necessary if the commu‐
76       nicating  processes  are on the same node, but it keeps the code porta‐
77       ble.
78
79       The LAM header file <portable.h> defines fixed size C  types  for  each
80       supported  architecture.   Fortran  already  has the ability to declare
81       variable precision.
82
83       int4      4-byte wide signed integer
84
85       uint4     4-byte wide unsigned integer
86
87       int2      2-byte wide signed integer
88
89       uint2     2-byte wide unsigned integer
90
91       float4    4-byte wide floating point number
92
93       float8    8-byte wide floating point number
94
95       Programmers wishing to write portable LAM code that can run on  hetero‐
96       geneous  architectures  are urged to use these data types for all vari‐
97       ables that are communicated across node boundaries.  To gain  computing
98       speed,  programmers  may  wish to transfer the communicated data to the
99       appropriate native data type on the local CPU in order to benefit  from
100       its  faster  access  of  word-sized variables.  Following this approach
101       solves the data size problem.
102
103       The LAM header file <t_types.h>  defines  functions  that  convert  the
104       order  of  bytes  between  the local representation, regardless of what
105       that is, and a standard (LAM) representation.  The functions are  meant
106       to  be used in conjunction with the data types defined in <portable.h>.
107       If no conversion is necessary,  the  functions  will  have  no  effect.
108       These  functions  are  implemented as macros and should not be accessed
109       through pointers to functions.
110
111       When sending messages between heterogeneous  nodes,  both  the  message
112       body  (i.e.  what  is in the nh_msg field of the network message struc‐
113       ture; see nsend(2)) and the message data pouch (i.e.  what  is  in  the
114       nh_data  field  of  the  network  message structure) must be converted.
115       Other fields in the message envelope are automatically  converted  when
116       the  message  is  passed.   Data conversion functions should be used by
117       both the sending and receiving processes.   Data  should  be  converted
118       from  local to LAM representation before sending, and from LAM to local
119       representation after receiving.
120
121       As an alternative to the byte-order translation functions, the program‐
122       mer  can  set  various bits in the nh_flags field to convert the nh_msg
123       and/or  the  nh_data  data  in  other  than  the  default  manner  (see
124       nsend(2)).   The  default  assumption  is that nh_data is an array of 8
125       int4 integers and that nh_msg contains raw bytes.
126
127       File data should be converted from local to LAM  representation  before
128       writing, and from LAM to local representation after reading.
129
130       The conversion functions are:
131
132       ttoli4()  Convert an int4 from LAM to local representation.
133
134       ltoti4()  Convert an int4 from local to LAM representation.
135
136       ttoli2()  Convert an int2 from LAM to local representation.
137
138       ltoti2()  Convert an int2 from local to LAM representation.
139
140       ttolf4()  Convert a float4 from LAM to local representation.
141
142       ltotf4()  Convert a float4 from local to LAM representation.
143
144       ttolf8()  Convert a float8 from LAM to local representation.
145
146       ltotf8()  Convert a float8 from local to LAM representation.
147
148       mttoli4() Convert an array of int4s from LAM to local representation.
149
150       mltoti4() Convert an array of int4s from local to LAM representation.
151
152       mttoli2() Convert an array of int2s from LAM to local representation.
153
154       mltoti2() Convert an array of int2s from local to LAM representation.
155
156       mttolf4() Convert an array of float4s from LAM to local representation.
157
158       mltotf4() Convert an array of float4s from local to LAM representation.
159
160       mttolf8() Convert an array of float8s from LAM to local representation.
161
162       mltotf8() Convert an array of float8s from local to LAM representation.
163
164       The single element conversion functions accept two arguments:
165
166       pvar1     pointer to a variable of the required type holding the origi‐
167                 nal data to be converted
168
169       pvar2     pointer to a variable of the required type where the  result‐
170                 ing converted data is returned
171
172       The original data is not modified.  The two pointers may be the same if
173       the conversion is to be done "in place".  The multiple element  conver‐
174       sion functions accept two arguments:
175
176       array     pointer  to  the  base  of  an  array of data elements of the
177                 required type
178
179       num       the number of data elements in the array
180
181       Before the call, the array holds the data to be converted.   After  the
182       function  returns,  the array holds the converted data.  The array con‐
183       version functions can only convert data "in place".
184
185   Incompatible Word Lengths
186       Some CPUs do not support all data type  sizes.   As  an  example,  Cray
187       machines  can  access  4-byte  and  8-byte integers and 8-byte floating
188       point numbers, but do not access 2-byte  integers  or  4-byte  floating
189       point  numbers.   Until another solution is offered, when such machines
190       are used in a LAM network it is advised  to  constrain  the  data  type
191       choices to those available on all CPUs (i.e. to follow the least common
192       denominator approach).
193

SEE ALSO

195       nsend(2)
196
197
198
199LAM 7.1.2                         March, 2006                          TTOL(3)
Impressum