LCI v2.0.0-dev
For Asynchronous Multithreaded Communication
Loading...
Searching...
No Matches
lci.hpp
Go to the documentation of this file.
1// Copyright (c) 2025 The LCI Project Authors
2// SPDX-License-Identifier: MIT
3
4#ifndef LCI_API_LCI_HPP
5#define LCI_API_LCI_HPP
6
7#include <memory>
8#include <stdexcept>
9#include <vector>
10#include <string>
11#include <cstring>
12#include <functional>
13
14#include "lci_config.hpp"
15
20
25
30
35
40
45
51
56
61namespace lci
62{
69
76
77// mimic std::optional as we don't want to force c++17 for now
78template <typename T>
79struct option_t {
80 option_t() : m_value(), m_is_set(false) {}
81 option_t(T value_) : m_value(value_), m_is_set(true) {}
82 option_t(T value_, bool is_set_)
83 : m_value(value_), m_is_set(is_set_) {} // set default value
84 T get_value_or(T default_value) const
85 {
86 return m_is_set ? m_value : default_value;
87 }
88 bool get_set_value(T* value) const
89 {
90 if (m_is_set) {
91 *value = this->m_value;
92 return true;
93 }
94 return false;
95 }
96 T get_value() const { return m_value; }
97 bool is_set() const { return m_is_set; }
98 operator T() const { return m_value; }
101};
102} // namespace lci
103
104#include "lci_binding_pre.hpp"
105
106namespace lci
107{
146
152const char* get_errorcode_str(errorcode_t errorcode);
153
160struct error_t {
167 error_t(errorcode_t errorcode_) : errorcode(errorcode_) {}
176 bool is_done() const
177 {
180 }
181
185 bool is_posted() const
186 {
189 }
190
194 bool is_retry() const
195 {
198 }
199
203 const char* get_str() const { return lci::get_errorcode_str(errorcode); }
204};
205
217
224
235
242
253
260
271
278
284using net_imm_data_t = uint32_t;
285
299
304const mr_t MR_HOST = mr_t();
305
310const mr_t MR_DEVICE = mr_t(reinterpret_cast<void*>(0x1));
311
317const mr_t MR_UNKNOWN = mr_t(reinterpret_cast<void*>(0x2));
318
319inline bool mr_t::is_empty() const
320{
321 return reinterpret_cast<uintptr_t>(p_impl) < 3;
322}
323
330struct rmr_t {
331 uintptr_t base;
332 uint64_t opaque_rkey;
333 rmr_t() : base(0), opaque_rkey(0) {}
334 bool is_empty() const { return base == 0 && opaque_rkey == 0; }
335};
336
342
347using tag_t = uint64_t;
348
353enum class direction_t {
356};
357
364using rcomp_t = uint32_t;
365
370const int ANY_SOURCE = -1;
371
376const tag_t ANY_TAG = static_cast<tag_t>(-1);
377
383enum class matching_entry_type_t : unsigned {
384 send = 0,
385 recv = 1,
386};
387
392enum class matching_policy_t : unsigned {
393 none = 0,
397 max = 4,
398};
399
403using matching_entry_key_t = uint64_t;
409
422
430struct buffer_t {
431 void* base;
432 size_t size;
434 buffer_t() : base(nullptr), size(0), mr() {}
435 buffer_t(void* base_, size_t size_) : base(base_), size(size_) {}
436 buffer_t(void* base_, size_t size_, mr_t mr_)
437 : base(base_), size(size_), mr(mr_)
438 {
439 }
440};
441
446struct rbuffer_t {
447 uintptr_t
450 rbuffer_t() : disp(0) {}
451 rbuffer_t(uintptr_t disp_) : disp(disp_) {}
452 rbuffer_t(uintptr_t disp_, rmr_t rmr_) : disp(disp_), rmr(rmr_) {}
453};
454using buffers_t = std::vector<buffer_t>;
455using rbuffers_t = std::vector<rbuffer_t>;
456
462 virtual void* allocate(size_t size) = 0;
463 virtual void deallocate(void* ptr) = 0;
464 virtual ~allocator_base_t() = default;
465};
466
494struct data_t {
495 static const int MAX_SCALAR_SIZE = 23;
502 // FIXME: It is a undefined behavior to access multiple union members at the
503 // same time
504#if defined(__clang__)
505#pragma clang diagnostic push
506#pragma clang diagnostic ignored "-Wnested-anon-types"
507#endif
508 union {
509 struct {
510 // common fields
512 bool own_data : 1;
514 struct {
515 type_t type : 2;
516 bool own_data : 1;
517 uint8_t size : 5;
520 struct {
521 type_t type : 2;
522 bool own_data : 1;
523 size_t size : 61;
524 void* base;
527 struct {
528 type_t type : 2;
529 bool own_data : 1;
530 size_t count;
533 };
534#if defined(__clang__)
535#pragma clang diagnostic pop
536#endif
537 data_t();
538 data_t(buffer_t buffer_, bool own_data_ = false);
539 data_t(buffers_t buffers_, bool own_data_ = false);
540 data_t(size_t size, allocator_base_t* allocator = nullptr);
541 data_t(size_t sizes[], int count, allocator_base_t* allocator = nullptr);
542 data_t(const data_t& other);
543 data_t(data_t&& other);
544 data_t& operator=(data_t other);
545 friend void swap(data_t& first, data_t& second);
546
547 type_t get_type() const { return common.type; }
548 void set_type(type_t type_) { common.type = type_; }
549 bool get_own_data() const { return common.own_data; }
550 void set_own_data(bool own_data_) { common.own_data = own_data_; }
551
552 bool is_scalar() const { return get_type() == LCI_DATA_TYPE_SCALAR; }
553 bool is_buffer() const { return get_type() == LCI_DATA_TYPE_BUFFER; }
554 bool is_buffers() const { return get_type() == LCI_DATA_TYPE_BUFFERS; }
555
556 void copy_from(const void* data_, size_t size,
557 allocator_base_t* allocator_ = nullptr);
558 void copy_from(const buffers_t& buffers_,
559 allocator_base_t* allocator_ = nullptr);
560
566 enum class get_semantic_t {
571 };
572
579 template <typename T>
580 T get_scalar(/* always copy semantic */) const;
591 size_t get_buffers_count() const;
598};
599
604struct status_t {
606 int rank = -1;
609 void* user_context = nullptr;
610 status_t() = default;
611 status_t(errorcode_t error_) : error(error_) {}
612 explicit status_t(void* user_context_)
613 : error(errorcode_t::done), user_context(user_context_)
614 {
615 }
619 bool is_done() const { return error.is_done(); }
620 bool is_posted() const { return error.is_posted(); }
621 bool is_retry() const { return error.is_retry(); }
622 template <typename T>
623 T get_scalar() const
624 {
625 return data.get_scalar<T>();
626 }
627 buffer_t get_buffer() { return data.get_buffer(); }
628 buffers_t get_buffers() { return data.get_buffers(); }
629 bool is_scalar() const { return data.is_scalar(); }
630 bool is_buffer() const { return data.is_buffer(); }
631 bool is_buffers() const { return data.is_buffers(); }
632};
633
638const comp_t COMP_NULL = comp_t(reinterpret_cast<comp_impl_t*>(0x0));
639
645 comp_t(reinterpret_cast<comp_impl_t*>(0x0));
646
652const comp_t COMP_NULL_RETRY = comp_t(reinterpret_cast<comp_impl_t*>(0x1));
653
659 comp_t(reinterpret_cast<comp_impl_t*>(0x1));
660
661inline bool comp_t::is_empty() const
662{
663 return reinterpret_cast<uintptr_t>(p_impl) <= 1;
664}
665
673{
674 public:
676 comp_impl_t(const attr_t& attr_) : attr(attr_) {}
677 virtual ~comp_impl_t() = default;
678 virtual void signal(status_t) = 0;
680};
681
686using comp_handler_t = void (*)(status_t status);
687
693using reduce_op_t = void (*)(const void* left, const void* right, void* dst,
694 size_t n);
699using graph_node_t = void*;
700
705const graph_node_t GRAPH_START = reinterpret_cast<graph_node_t>(0x1);
706const graph_node_t GRAPH_END = reinterpret_cast<graph_node_t>(0x2);
707
713using graph_node_run_cb_t = status_t (*)(void* value);
714
722
728using graph_node_free_cb_t = void (*)(void* value);
729
734using graph_edge_run_cb_t = void (*)(status_t status, void* src_value,
735 void* dst_value);
736
737} // namespace lci
738
739#include "lci_binding_post.hpp"
740
741namespace lci
742{
743/***********************************************************************
744 * Overloading graph_add_node for functor
745 **********************************************************************/
746#if __cplusplus >= 201703L
747template <typename T>
748status_t graph_execute_op_fn(void* value)
749{
750 auto op = static_cast<T*>(value);
751 using result_t = std::invoke_result_t<T>;
752
753 if constexpr (std::is_same_v<result_t, status_t>) {
754 status_t result = (*op)();
755 return result;
756 } else if constexpr (std::is_same_v<result_t, errorcode_t>) {
757 errorcode_t result = (*op)();
758 return result;
759 } else {
760 (*op)();
761 return errorcode_t::done;
762 }
763}
764#else
765// Specialization for status_t return type
766template <typename T>
767typename std::enable_if<
768 std::is_same<typename std::result_of<T()>::type, status_t>::value,
769 status_t>::type
771{
772 auto op = static_cast<T*>(value);
773 status_t result = (*op)();
774 return result;
775}
776
777// Specialization for errorcode_t return type
778template <typename T>
779typename std::enable_if<
780 std::is_same<typename std::result_of<T()>::type, errorcode_t>::value,
781 status_t>::type
783{
784 auto op = static_cast<T*>(value);
785 errorcode_t result = (*op)();
786 return result;
787}
788
789// Specialization for all other return types
790template <typename T>
791typename std::enable_if<
792 !std::is_same<typename std::result_of<T()>::type, status_t>::value &&
793 !std::is_same<typename std::result_of<T()>::type, errorcode_t>::value,
794 status_t>::type
796{
797 auto op = static_cast<T*>(value);
798 (*op)();
799 return errorcode_t::done;
800}
801#endif
802
803template <typename T>
804void graph_free_op_fn(void* value)
805{
806 auto op = static_cast<T*>(value);
807 delete op;
808}
809
818template <typename T>
820{
822 T* fn = new T(op);
824 auto ret = graph_add_node_x(graph, wrapper)
825 .value(reinterpret_cast<void*>(fn))
826 .free_cb(free_cb)();
827 fn->user_context(ret);
828 return ret;
829}
830
831/***********************************************************************
832 * Some inline implementation
833 **********************************************************************/
835{
837 set_own_data(false);
838 static_assert(sizeof(data_t) == 24, "data_t size is not 24 bytes");
839}
840inline data_t::data_t(buffer_t buffer_, bool own_data_)
841{
843 set_own_data(own_data_);
844 buffer.base = buffer_.base;
845 buffer.size = buffer_.size;
846 buffer.mr = buffer_.mr;
847}
848inline data_t::data_t(buffers_t buffers_, bool own_data_)
849{
851 set_own_data(own_data_);
852 buffers.count = buffers_.size();
853 buffers.buffers = new buffer_t[buffers.count];
854 for (size_t i = 0; i < buffers.count; i++) {
855 buffers.buffers[i] = buffers_[i];
856 }
857}
858inline data_t::data_t(size_t size, allocator_base_t* allocator)
859{
861 set_own_data(true);
862 if (allocator) {
863 buffer.base = allocator->allocate(size);
864 } else {
865 buffer.base = malloc(size);
866 }
867 buffer.size = size;
868 buffer.mr = mr_t();
869}
870inline data_t::data_t(size_t sizes[], int count, allocator_base_t* allocator)
871{
873 set_own_data(true);
874 buffers.count = count;
875 buffers.buffers = new buffer_t[buffers.count];
876 for (int i = 0; i < count; i++) {
877 if (allocator) {
878 buffers.buffers[i].base = allocator->allocate(sizes[i]);
879 } else {
880 buffers.buffers[i].base = malloc(sizes[i]);
881 }
882 buffers.buffers[i].size = sizes[i];
883 buffers.buffers[i].mr = mr_t();
884 }
885}
886// copy constructor
887inline data_t::data_t(const data_t& other)
888{
889 set_type(other.get_type());
890 bool own_data = other.get_own_data();
892 if (own_data)
893 fprintf(stderr, "Copying buffer with own_data=true is not recommended\n");
894 if (other.is_scalar()) {
895 scalar.size = other.scalar.size;
896 memcpy(scalar.data, other.scalar.data, scalar.size);
897 } else if (other.is_buffer()) {
898 buffer = other.buffer;
899 if (own_data) {
900 buffer.base = malloc(other.buffer.size);
901 memcpy(buffer.base, other.buffer.base, other.buffer.size);
902 }
903 } else if (other.is_buffers()) {
904 buffers.count = other.buffers.count;
905 buffers.buffers = new buffer_t[buffers.count];
906 for (size_t i = 0; i < buffers.count; i++) {
907 buffers.buffers[i] = other.buffers.buffers[i];
908 if (own_data) {
909 buffers.buffers[i].base = malloc(other.buffers.buffers[i].size);
910 memcpy(buffers.buffers[i].base, other.buffers.buffers[i].base,
911 other.buffers.buffers[i].size);
912 }
913 }
914 }
915}
916// move constructor
917inline data_t::data_t(data_t&& other)
918{
919 set_type(other.get_type());
920 set_own_data(other.get_own_data());
921 if (other.is_scalar()) {
922 scalar.size = other.scalar.size;
923 memcpy(scalar.data, other.scalar.data, scalar.size);
924 } else if (other.is_buffer()) {
925 buffer = other.buffer;
926 other.set_own_data(false);
927 } else if (other.is_buffers()) {
928 buffers.count = other.buffers.count;
929 buffers.buffers = other.buffers.buffers;
930 other.set_own_data(false);
931 other.buffers.buffers = nullptr;
932 }
933}
934// generic assignment operator
936{
937 swap(*this, other);
938 return *this;
939}
940
941inline void swap(data_t& first, data_t& second)
942{
943 char* buf = (char*)malloc(sizeof(data_t));
944#if defined(__GNUC__) && !defined(__clang__) && !defined(__NVCC__)
945#pragma GCC diagnostic push
946#pragma GCC diagnostic ignored "-Wclass-memaccess"
947#endif
948 memcpy(buf, &first, sizeof(data_t));
949 memcpy(&first, &second, sizeof(data_t));
950 memcpy(&second, buf, sizeof(data_t));
951#if defined(__GNUC__) && !defined(__clang__)
952#pragma GCC diagnostic pop
953#endif
954 free(buf);
955}
956
957inline void data_t::copy_from(const void* data_, size_t size,
958 allocator_base_t* allocator)
959{
960 if (size <= MAX_SCALAR_SIZE) {
962 set_own_data(true);
963 scalar.size = size;
964 memcpy(scalar.data, data_, size);
965 } else {
967 set_own_data(true);
968 if (allocator) {
969 buffer.base = allocator->allocate(size);
970 } else {
971 buffer.base = malloc(size);
972 }
973 memcpy(buffer.base, data_, size);
974 buffer.size = size;
975 }
976}
977
978inline void data_t::copy_from(const buffers_t& buffers_,
979 allocator_base_t* allocator)
980{
982 set_own_data(true);
983 buffers.count = buffers_.size();
984 buffers.buffers = new buffer_t[buffers.count];
985 for (size_t i = 0; i < buffers.count; i++) {
986 buffers.buffers[i].size = buffers_[i].size;
987 if (allocator) {
988 buffers.buffers[i].base = allocator->allocate(buffers_[i].size);
989 } else {
990 buffers.buffers[i].base = malloc(buffers_[i].size);
991 }
992 memcpy(buffers.buffers[i].base, buffers_[i].base, buffers_[i].size);
993 }
994}
995
996template <typename T>
997T data_t::get_scalar(/* always copy semantic */) const
998{
999 // We still keep the ownership of the data
1000 if (is_buffer()) {
1001 if (buffer.size != sizeof(T)) {
1002 throw std::runtime_error("Buffer size does not match scalar size");
1003 }
1004 return *reinterpret_cast<const T*>(buffer.base);
1005 } else if (is_scalar()) {
1006 if (sizeof(T) > scalar.size) {
1007 throw std::runtime_error("No enough data to fit the scalar.");
1008 }
1009 return *reinterpret_cast<const T*>(scalar.data);
1010 } else {
1011 throw std::runtime_error("Cannot convert to a scalar");
1012 }
1013}
1014
1016{
1017 buffer_t ret;
1018 if (is_scalar()) {
1019 if (semantic == get_semantic_t::move || semantic == get_semantic_t::copy) {
1020 ret.size = scalar.size;
1021 ret.base = malloc(scalar.size);
1022 memcpy(ret.base, scalar.data, scalar.size);
1023 } else {
1024 ret = buffer_t(scalar.data, scalar.size);
1025 }
1026 } else if (is_buffer()) {
1027 if (semantic == get_semantic_t::copy && get_own_data()) {
1028 ret.size = buffer.size;
1029 ret.base = malloc(buffer.size);
1030 memcpy(ret.base, buffer.base, buffer.size);
1031 } else {
1032 ret = buffer_t(buffer.base, buffer.size, buffer.mr);
1033 }
1034 } else {
1035 throw std::runtime_error("Cannot convert to a buffer");
1036 }
1037 if (semantic == get_semantic_t::move) {
1038 set_own_data(false);
1040 }
1041 return ret;
1042}
1043
1044inline size_t data_t::get_buffers_count() const
1045{
1046 if (!is_buffers()) {
1047 throw std::runtime_error("Not a buffers");
1048 }
1049 return buffers.count;
1050}
1051
1053{
1054 if (!is_buffers()) {
1055 throw std::runtime_error("Not buffers");
1056 }
1057 if (semantic == get_semantic_t::move) {
1058 set_own_data(false);
1060 }
1061 buffers_t ret;
1062 for (size_t i = 0; i < buffers.count; i++) {
1063 if (semantic == get_semantic_t::copy && get_own_data()) {
1065 buffer.size = buffers.buffers[i].size;
1066 buffer.base = malloc(buffer.size);
1067 memcpy(buffer.base, buffers.buffers[i].base, buffer.size);
1068 ret.push_back(buffer);
1069 } else {
1070 ret.push_back(buffers.buffers[i]);
1071 }
1072 }
1073 return ret;
1074}
1075
1076} // namespace lci
1077
1078#endif // LCI_API_LCI_HPP
Completion object implementation base type.
Definition lci.hpp:673
comp_impl_t(const attr_t &attr_)
Definition lci.hpp:676
virtual ~comp_impl_t()=default
comp_attr_t attr
Definition lci.hpp:679
comp_attr_t attr_t
Definition lci.hpp:675
virtual void signal(status_t)=0
The actual implementation for RESOURCE comp.
Definition lci_binding_pre.hpp:128
bool is_empty() const
Definition lci.hpp:661
comp_impl_t * p_impl
Definition lci_binding_pre.hpp:139
The actual implementation for graph_add_node.
Definition lci_binding_post.hpp:516
graph_add_node_x && free_cb(graph_node_free_cb_t free_cb_in)
Definition lci_binding_post.hpp:532
graph_add_node_x && value(void *value_in)
Definition lci_binding_post.hpp:531
The actual implementation for RESOURCE mr.
Definition lci_binding_pre.hpp:283
mr_impl_t * p_impl
Definition lci_binding_pre.hpp:289
bool is_empty() const
Definition lci.hpp:319
graph_node_t graph_add_node_op(comp_t graph, const T &op)
Add a functor as a node to the completion graph.
Definition lci.hpp:819
broadcast_algorithm_t
The type of broadcast algorithm.
Definition lci.hpp:229
errorcode_t
The actual error code for LCI API functions.
Definition lci.hpp:119
void(*)(status_t status, void *src_value, void *dst_value) graph_edge_run_cb_t
The function signature for a edge funciton in the completion graph.
Definition lci.hpp:734
const rmr_t RMR_NULL
The NULL value of rkey_t.
Definition lci.hpp:341
uint64_t matching_entry_key_t
The type of matching engine entry key.
Definition lci.hpp:403
const mr_t MR_DEVICE
A special mr_t value for device memory.
Definition lci.hpp:310
const int ANY_SOURCE
Special rank value for any-source receive.
Definition lci.hpp:370
status_t(*)(void *value) graph_node_run_cb_t
The function signature for a node function in the completion graph.
Definition lci.hpp:713
net_opcode_t
The Type of network communication operation codes.
Definition lci.hpp:210
const mr_t MR_HOST
A special mr_t value for host memory.
Definition lci.hpp:304
direction_t
The enum class of comunication direction.
Definition lci.hpp:353
void(*)(void *value) graph_node_free_cb_t
The function signature for a callback that will be triggered when the node was freed.
Definition lci.hpp:728
void(*)(const void *left, const void *right, void *dst, size_t n) reduce_op_t
The user-defined reduction operation.
Definition lci.hpp:693
matching_policy_t
Enum class for matching policy.
Definition lci.hpp:392
void * graph_node_t
The node type for the completion graph.
Definition lci.hpp:699
const tag_t ANY_TAG
Special tag value for any-tag receive.
Definition lci.hpp:376
const graph_node_run_cb_t GRAPH_NODE_DUMMY_CB
A dummy callback function for a graph node.
Definition lci.hpp:721
allreduce_algorithm_t
The type of allreduce algorithm.
Definition lci.hpp:265
reduce_scatter_algorithm_t
The type of reduce scatter algorithm.
Definition lci.hpp:247
const comp_t COMP_NULL_EXPECT_DONE
Deprecated. Same as COMP_NULL.
Definition lci.hpp:644
const mr_t MR_UNKNOWN
A special mr_t value for unknown memory. LCI will detect the memory type automatically.
Definition lci.hpp:317
void * matching_entry_val_t
The type of matching engine entry value.
Definition lci.hpp:408
matching_entry_type_t
The type of matching entry.
Definition lci.hpp:383
uint32_t rcomp_t
The type of remote completion handler.
Definition lci.hpp:364
void(*)(status_t status) comp_handler_t
Function Signature for completion handler.
Definition lci.hpp:686
const graph_node_t GRAPH_START
The start node of the completion graph.
Definition lci.hpp:705
const comp_t COMP_NULL
Special completion object setting allow_posted to false.
Definition lci.hpp:638
const comp_t COMP_NULL_EXPECT_DONE_OR_RETRY
Deprecated. Same as COMP_NULL_RETRY.
Definition lci.hpp:658
uint64_t tag_t
The type of tag.
Definition lci.hpp:347
comp_semantic_t
The enum class of completion semantic.
Definition lci.hpp:418
uint32_t net_imm_data_t
The type of network-layer immediate data field.
Definition lci.hpp:284
const comp_t COMP_NULL_RETRY
Special completion object setting allow_posted and allow_retry to false.
Definition lci.hpp:652
@ ring
Definition lci.hpp:233
@ direct
Definition lci.hpp:231
@ tree
Definition lci.hpp:232
@ retry
Definition lci.hpp:132
@ retry_nopacket
Definition lci.hpp:136
@ done_max
Definition lci.hpp:124
@ posted_backlog
Definition lci.hpp:128
@ done
Definition lci.hpp:121
@ retry_min
Definition lci.hpp:131
@ done_min
Definition lci.hpp:120
@ retry_lock
Definition lci.hpp:135
@ posted_min
Definition lci.hpp:125
@ retry_max
Definition lci.hpp:142
@ posted
Definition lci.hpp:126
@ retry_backlog
Definition lci.hpp:140
@ retry_init
Definition lci.hpp:134
@ done_backlog
Definition lci.hpp:122
@ retry_nomem
Definition lci.hpp:138
@ fatal
Definition lci.hpp:143
@ posted_max
Definition lci.hpp:130
@ READ
Definition lci.hpp:215
@ SEND
Definition lci.hpp:211
@ REMOTE_WRITE
Definition lci.hpp:214
@ RECV
Definition lci.hpp:212
@ WRITE
Definition lci.hpp:213
@ IN
Definition lci.hpp:355
@ OUT
Definition lci.hpp:354
@ max
Definition lci.hpp:397
@ rank_tag
Definition lci.hpp:396
@ tag_only
Definition lci.hpp:395
@ rank_only
Definition lci.hpp:394
@ send
Definition lci.hpp:384
@ recv
Definition lci.hpp:385
@ buffer
Definition lci.hpp:419
@ network
Definition lci.hpp:420
All LCI API functions and classes are defined in this namespace.
const char * get_allreduce_algorithm_str(broadcast_algorithm_t algorithm)
Get the string representation of a collective algorithm.
void swap(data_t &first, data_t &second)
Definition lci.hpp:941
attr_backend_t
Definition lci.hpp:63
@ none
Definition lci.hpp:64
@ ibv
Definition lci.hpp:65
@ ofi
Definition lci.hpp:66
@ ucx
Definition lci.hpp:67
const graph_node_t GRAPH_END
Definition lci.hpp:706
const char * get_reduce_scatter_algorithm_str(broadcast_algorithm_t algorithm)
Get the string representation of a collective algorithm.
@ graph
Definition lci_binding_pre.hpp:32
const char * get_errorcode_str(errorcode_t errorcode)
Get the string representation of an error code.
void graph_free_op_fn(void *value)
Definition lci.hpp:804
std::vector< rbuffer_t > rbuffers_t
Definition lci.hpp:455
attr_net_lock_mode_t
Definition lci.hpp:70
@ LCI_NET_TRYLOCK_POLL
Definition lci.hpp:73
@ LCI_NET_TRYLOCK_SEND
Definition lci.hpp:71
@ LCI_NET_TRYLOCK_RECV
Definition lci.hpp:72
@ LCI_NET_TRYLOCK_MAX
Definition lci.hpp:74
const char * get_net_opcode_str(net_opcode_t opcode)
Get the string representation of a network operation code.
std::enable_if< std::is_same< typenamestd::result_of< T()>::type, status_t >::value, status_t >::type graph_execute_op_fn(void *value)
Definition lci.hpp:770
const char * get_broadcast_algorithm_str(broadcast_algorithm_t algorithm)
Get the string representation of a collective algorithm.
std::vector< buffer_t > buffers_t
Definition lci.hpp:454
The user-defined allocator type.
Definition lci.hpp:461
virtual ~allocator_base_t()=default
virtual void deallocate(void *ptr)=0
virtual void * allocate(size_t size)=0
The type of a local buffer descriptor.
Definition lci.hpp:430
size_t size
Definition lci.hpp:432
void * base
Definition lci.hpp:431
buffer_t(void *base_, size_t size_)
Definition lci.hpp:435
mr_t mr
Definition lci.hpp:433
buffer_t(void *base_, size_t size_, mr_t mr_)
Definition lci.hpp:436
buffer_t()
Definition lci.hpp:434
Definition lci_binding_pre.hpp:99
A generic type for describing or holding data.
Definition lci.hpp:494
static const int MAX_SCALAR_SIZE
Definition lci.hpp:495
get_semantic_t
Enum class of get semantic.
Definition lci.hpp:566
@ copy
Definition lci.hpp:568
@ view
Definition lci.hpp:569
@ move
Definition lci.hpp:567
bool own_data
Definition lci.hpp:512
T get_scalar() const
Get the scalar data from the data object.
Definition lci.hpp:997
type_t
Definition lci.hpp:496
@ LCI_DATA_TYPE_BUFFERS
Definition lci.hpp:500
@ LCI_DATA_TYPE_SCALAR
Definition lci.hpp:498
@ LCI_DATA_TYPE_BUFFER
Definition lci.hpp:499
@ LCI_DATA_TYPE_NONE
Definition lci.hpp:497
void copy_from(const void *data_, size_t size, allocator_base_t *allocator_=nullptr)
Definition lci.hpp:957
buffers_t get_buffers(get_semantic_t semantic=get_semantic_t::move)
Get the buffers from the data object.
Definition lci.hpp:1052
buffer_t * buffers
Definition lci.hpp:531
void * base
Definition lci.hpp:524
void set_type(type_t type_)
Definition lci.hpp:548
struct lci::data_t::@076173265013046342263132075131334126052375112161::@304232263224033304106252124165030274231050146201 buffer
size_t get_buffers_count() const
Get the number of buffers from the data object.
Definition lci.hpp:1044
struct lci::data_t::@076173265013046342263132075131334126052375112161::@363335147013034143035040152023326255073312106017 scalar
char data[MAX_SCALAR_SIZE]
Definition lci.hpp:518
bool is_buffer() const
Definition lci.hpp:553
data_t & operator=(data_t other)
Definition lci.hpp:935
uint8_t size
Definition lci.hpp:517
type_t type
Definition lci.hpp:511
bool is_scalar() const
Definition lci.hpp:552
data_t()
Definition lci.hpp:834
size_t count
Definition lci.hpp:530
buffer_t get_buffer(get_semantic_t semantic=get_semantic_t::move)
Get the buffer from the data object.
Definition lci.hpp:1015
bool is_buffers() const
Definition lci.hpp:554
mr_t mr
Definition lci.hpp:525
struct lci::data_t::@076173265013046342263132075131334126052375112161::@072116374306302151235374307357141054206077020333 common
void set_own_data(bool own_data_)
Definition lci.hpp:550
type_t get_type() const
Definition lci.hpp:547
bool get_own_data() const
Definition lci.hpp:549
friend void swap(data_t &first, data_t &second)
Definition lci.hpp:941
Wrapper class for error code.
Definition lci.hpp:160
bool is_done() const
Check if the error code is in the done category.
Definition lci.hpp:176
error_t()
Definition lci.hpp:162
bool is_posted() const
Check if the error code is in the posted category.
Definition lci.hpp:185
const char * get_str() const
Get the string representation of the error code.
Definition lci.hpp:203
errorcode_t errorcode
Definition lci.hpp:161
void reset_retry()
Reset the error code to retry.
Definition lci.hpp:171
error_t(errorcode_t errorcode_)
Construct an error_t object with a specific error code.
Definition lci.hpp:167
bool is_retry() const
Check if the error code is in the retry category.
Definition lci.hpp:194
The struct for network status.
Definition lci.hpp:292
net_imm_data_t imm_data
Definition lci.hpp:297
int rank
Definition lci.hpp:294
void * user_context
Definition lci.hpp:295
net_opcode_t opcode
Definition lci.hpp:293
size_t length
Definition lci.hpp:296
bool m_is_set
Definition lci.hpp:100
option_t()
Definition lci.hpp:80
T get_value() const
Definition lci.hpp:96
T get_value_or(T default_value) const
Definition lci.hpp:84
bool get_set_value(T *value) const
Definition lci.hpp:88
T m_value
Definition lci.hpp:99
option_t(T value_, bool is_set_)
Definition lci.hpp:82
bool is_set() const
Definition lci.hpp:97
option_t(T value_)
Definition lci.hpp:81
rbuffer_t(uintptr_t disp_, rmr_t rmr_)
Definition lci.hpp:452
uintptr_t disp
Definition lci.hpp:448
rbuffer_t(uintptr_t disp_)
Definition lci.hpp:451
rbuffer_t()
Definition lci.hpp:450
rmr_t rmr
Definition lci.hpp:449
The type of remote memory region.
Definition lci.hpp:330
uintptr_t base
Definition lci.hpp:331
bool is_empty() const
Definition lci.hpp:334
uint64_t opaque_rkey
Definition lci.hpp:332
rmr_t()
Definition lci.hpp:333
The type of the completion desciptor for a posted communication.
Definition lci.hpp:604
bool is_buffer() const
Definition lci.hpp:630
status_t(errorcode_t error_)
Definition lci.hpp:611
bool is_scalar() const
Definition lci.hpp:629
status_t(void *user_context_)
Definition lci.hpp:612
void set_retry()
Definition lci.hpp:618
data_t data
Definition lci.hpp:607
error_t error
Definition lci.hpp:605
void set_done()
Definition lci.hpp:616
tag_t tag
Definition lci.hpp:608
T get_scalar() const
Definition lci.hpp:623
void set_posted()
Definition lci.hpp:617
bool is_done() const
Definition lci.hpp:619
void * user_context
Definition lci.hpp:609
bool is_posted() const
Definition lci.hpp:620
bool is_buffers() const
Definition lci.hpp:631
status_t()=default
bool is_retry() const
Definition lci.hpp:621
int rank
Definition lci.hpp:606
buffers_t get_buffers()
Definition lci.hpp:628
buffer_t get_buffer()
Definition lci.hpp:627