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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
/**
* @file src/api.c
* @brief ROFI APIs
*
* This file implements all the ROFI APIs, including initialization and
* finalization of the runtime library.
*
*/
/**
* @brief ROFI Initialization function.
*
* Calling this function is necessary to initialize ROFI internal
* state and to start the underlying OFI and runtime layer. Using any other APIs
* without prior call to rofi_init() may result in failure and unexpected behavior.
*
* @param provs A priority list of providers to try and be used.
* @param domains A priority list of domains to try and be used.
*
*
* @return 0 on success, -1 in case of errors
*
* \b blocking: yes
* \b thread-safe: no
*
*/
int
/**
* @brief ROFI Get workgroup size
*
* This function return the number of processes (locales) that are part of the
* job. This fucntion behaves similarly to `MPI_Comm_size()`.`
*
* @return The number of processes in the job
*
* \b blocking: no
* \b thread-safe: yes
*
*/
unsigned int
/**
* @brief ROFI Get process ID
*
* This function return the ID of the calling process within the job.
* This fucntion behaves similarly to `MPI_Comm_rank()`.`
*
* @return The process ID within the job
*
* \b blocking: no
* \b thread-safe: yes
*
*/
unsigned int
/**
* @brief ROFI Finalization
*
* This function should be called at the end of a program. This function
* releases all computing and memory resources acquired by the process and
* make sure that communcation is properly re-routed. Users should not call
* additional ROFI calls after this function.
*
* @return 0 on success
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Flush
*
* This function flushes any completion queue events (from previous communcation calls), ensuring progress can continue.
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Asynchronous PUT
*
* This fucntion transfer \p size bytes starting at address \p src in the current
* process virtual address space to process \p id at address \p dst at destination
* asynchronously. Users are supposed to either check that the transfer has been
* completed or issue a `rofi_wait()`. It is expected that an heap has been
* establisehd. Buffers should not be re-used before the
* transfer is completed.
*
* @param[out] dst address at destiantion (output at destination, not used at source)
* @param[in] src address at source (input at source, not used at destination)
* @param[in] size size of the entire buffer in bytes (no padding)
* @param[in] id the ID of the remote node
* @param[in] flags (not used at this time)
* @return 0 on success
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Synchronous PUT
*
* Similar to `rofi_put()` but blocks until the transfer has completed. Users are
* free to re-used buffers after returning from this call.
*
* @param[out] dst address at destiantion (output at destination, not used at source)
* @param[in] src address at source (input at source, not used at destination)
* @param[in] size size of the entire buffer in bytes (no padding)
* @param[in] id the ID of the remote node
* @param[in] flags (dot used at this time.
* @return 0 on success
*
* \b blocking: yes
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Asynchronous GET
*
* This fucntion transfer \p size bytes starting at address \p src in the remote
* process virtual address space \p id to the current process at address \p dst
* asynchronously. Users are supposed to either check that the transfer has been
* completed or issue a `rofi_wait()`. It is expected that an heap has been
* establisehd. Buffers should not be re-used before the
* transfer is completed.
*
* @param[out] dst address at destiantion (output at destination, not used at source)
* @param[in] src address at source (input at source, not used at destination)
* @param[in] size size of the entire buffer in bytes (no padding)
* @param[in] id the ID of the remote node
* @param[in] flags (not used at this time)
* @return 0 on success
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Synchronous PUT
*
* Similar to `rofi_put()` but blocks until the transfer has completed. Users are
* free to re-used buffers after returning from this call.
*
* @param[out] dst address at destiantion (output at destination, not used at source)
* @param[in] src address at source (input at source, not used at destination)
* @param[in] size size of the entire buffer in bytes (no padding)
* @param[in] id the ID of the remote node
* @param[in] flags (not used at this time)
* @return 0 on success
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Synchronous SEND
*
* Similar to `rofi_send()` blocks until a message has been transmitted to the specified PE
* (users should embed this information in their messages if the recieving node needs to know where a message came from).
* Users are free to re-use buffers after returning from this call.
*
* @param[in] pe the ID of the remote node
* @param[in] buf address of buffer to receive the message
* @param[in] size size of the entire buffer in bytes (no padding)
* @param[in] flags (not used at this time)
* @return 0 on success
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Synchronous RECV
*
* Similar to `rofi_recv()` blocks until a message has been received from any PE (users should embed this information in their messages). Users are
* free to re-used buffers after returning from this call.
*
* @param[in] buf address of buffer to receive the message
* @param[in] size size of the entire buffer in bytes (no padding)
* @param[in] flags (not used at this time)
* @return 0 on success
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Global Barrier
*
* This function blocks until all processes in the job have called `rofi_barrier()`. All
* processes involved in the barrier will be released when the last process enters the
* barrier.
*
* \b blocking: no
* \b thread-safe: yes
*
*/
void
/**
* @brief ROFI Memory Region allocation
*
* This function allocates a memory region of \p size bytes and registers it to be accessible
* remotely from other compute nodes (RDMA). This function will block until all processes in
* the job have also called it.
* Multiple Memory Regions can be allocated at any given time.
*
* @param[in] size size of the memory region
* @param[in] flags (not used at this time)
* @param[out] addr initial address of the allocated memory region
* @return 0 on success, -1 on failure
*
* \b blocking: yes (collective accross all PEs)
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Memory Region subset allocation
*
* This function allocates a memory region of \p size bytes and registers it to be accessible
* remotely from a subset of compute nodes (RDMA). The calling PE must be in the subset, and
* all processes in the subset call this function collectively to proceed.
* Multiple Memory Regions can be allocated at any given time.
*
* @param[in] size size of the memory region
* @param[in] flags (not used at this time)
* @param[out] addr initial address of the allocated memory region
* @param[in] pes the sub set of pes it was allocated on
* @param[in] num_pes the number of pes in the sub set
* @return 0 on success, -1 on failure
*
* \b blocking: yes (collective accross the subset of PEs)
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Memory Region release
*
* This function releases a remote-accessible memory region previously allocated through `rofi_alloc()`.
* The function will fail if no memory region has been allocated yet.
*
* @param[in] addr the memory region to release
* @return 0 on success, -1 on failure
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Memory Region subset release
*
* This function releases a remote-accessible memory region previously allocated on a subset of pes through `rofi_sub_alloc()`.
* The function will fail if no memory region has been allocated yet. The calling pe must exist in the subset
*
* @param[in] addr the memory region to release
* @param[in] pes the sub set of pes it was allocated on
* @param[in] num_pes the number of pes in the sub set
* @return 0 on success, -1 on failure
*
* \b blocking: no
* \b thread-safe: yes
*
*/
int
/**
* @brief ROFI Wait
*
* This function blocks until outstanding remote memory operations have completed. The function is
* meant to be used in conjuction with `rofi_put()` and `rofi_get()` API families to guarantee that
* all transfers are completed. Note that users can employ different application-specific methods to
* understand that a particular transfer is completed.
*
* \b blocking: yes
* \b thread-safe: yes
*
*/
int
/**
* @brief Compute the virtual address corresponding to /p addr on node /p id.
*
* When allocating a symmetric memory region, ROFI does not require that the virutal
* addresses be aligned. In a sense, the virtual addresses are not symmetric, only the
* offsets are. This function maps a certain address /p addr on the current node to the
* corresponding virtual address on the remote node /p id.
*
* @return A valide virtual address on success, NULL on failure
*
* \b blocking: yes
* \b thread-safe: no
*
*/
void *
/**
* @brief Compute the local virtual address corresponding to /p addr on node /p id.
*
* When allocating a symmetric memory region, ROFI does not require that the virutal
* addresses be aligned. In a sense, the virtual addresses are not symmetric, only the
* offsets are. This function maps a certain address /p addr on the remote node /p id to the
* corresponding virtual address on the local node .
*
* @return A valid virtual address on success, NULL on failure
*
* \b blocking: yes
* \b thread-safe: no
*
*/
void *