15 #error "Do not include kmrimpl.h in C++" 20 #ifdef __INTEL_COMPILER 22 #pragma warning (disable : 869) 29 #define KMR_DEBUGX(X) (X) 31 #define KMR_DEBUGX(X) ((void)0) 40 #define KMR_OMP_PARALLEL_ _Pragma("omp parallel") 41 #define KMR_PP_(X) _Pragma(#X) 42 #define KMR_OMP_PARALLEL_IF_(CC) KMR_PP_(omp parallel if (CC)) 43 #define KMR_OMP_SINGLE_NOWAIT_ _Pragma("omp single nowait") 44 #define KMR_OMP_PARALLEL_FOR_ _Pragma("omp parallel for") 45 #define KMR_OMP_CRITICAL_ _Pragma("omp critical") 46 #define KMR_OMP_TASK_ _Pragma("omp task") 47 #define KMR_OMP_TASK_FINAL_(CC) KMR_PP_(omp task final (CC)) 48 #define KMR_OMP_TASKWAIT_ _Pragma("omp taskwait") 49 #define KMR_OMP_FOR_ _Pragma("omp for") 50 #define KMR_OMP_GET_THREAD_NUM() omp_get_thread_num() 56 #define KMR_OMP_PARALLEL_ KMR_EMPTY 57 #define KMR_OMP_PARALLEL_IF_(CC) KMR_EMPTY 58 #define KMR_OMP_SINGLE_NOWAIT_ KMR_EMPTY 59 #define KMR_OMP_PARALLEL_FOR_ KMR_EMPTY 60 #define KMR_OMP_CRITICAL_ KMR_EMPTY 61 #define KMR_OMP_TASK_ KMR_EMPTY 62 #define KMR_OMP_TASK_FINAL_(CC) KMR_EMPTY 63 #define KMR_OMP_TASKWAIT_ KMR_EMPTY 64 #define KMR_OMP_FOR_ KMR_EMPTY 65 #define KMR_OMP_GET_THREAD_NUM() 0 75 #define KMR_ALIGN(X) (((X)+((8)-1))&~((8)-1)) 79 #define KMR_MAX_THREADS 200 83 #define KMR_TAG_ATOA 100 87 #define KMR_TAG_MAP_BY_RANK 200 89 #define KMR_TAG_PUSHOFF 201 94 #define KMR_TAG_REQ 399 95 #define KMR_TAG_PEER_0 400 96 #define KMR_TAG_PEER_END (KMR_TAG_PEER_0 + KMR_MAX_THREADS) 97 #define KMR_TAG_PEER(THRD) (KMR_TAG_PEER_0 + (THRD)) 101 #define KMR_TRACE_FILE_PREFIX "kmrlog" 111 "%s:%d: %s: Assertion '%s' failed.\n", \ 112 __FILE__, __LINE__, __func__, #X), \ 113 (void)MPI_Abort(MPI_COMM_WORLD, 1))) 119 "Assertion failed: %s, file %s, line %d, function %s\n", \ 120 #X, __FILE__, __LINE__, __func__), \ 121 (void)MPI_Abort(MPI_COMM_WORLD, 1))) 128 extern double kmr_wtime(
void);
137 #if (defined(__sparc_v9__) && defined(__arch64__)) 139 static __thread
long r;
140 __asm__ __volatile__ (
"rd %%tick, %0" :
"=r" (r) :
"0" (r));
142 #elif (defined(__x86_64__) && defined(__GNUC__) && !defined(__llvm__)) 145 __asm__ __volatile__(
"rdtscp" :
"=a" (ax),
"=d" (dx));
146 return (((
long)ax) | (((
long)dx) << 32));
148 #define KMR_TICK_ONLY_FOR_AMD64_AND_SPARC 0 156 typedef int (*kmr_sorter_t)(
const struct kmr_kv_box *p,
160 typedef int (*kmr_qsorter_t)(
const void *p,
const void *q);
162 extern void kmr_warning(
KMR *mr,
unsigned int mask,
char *m);
163 extern void kmr_error_at_site(
KMR *mr,
char *m,
struct kmr_code_line *site);
164 extern void kmr_error(
KMR *mr,
char *m);
165 extern void kmr_error2(
KMR *mr,
char *m,
166 const char *file,
const int line,
const char *func);
167 extern void kmr_error_kvs_at_site(
KMR *mr,
char *m,
KMR_KVS *kvs,
169 extern void kmr_error_kvs(
KMR *mr,
char *m,
KMR_KVS *kvs);
170 extern void kmr_error_kvs2(
KMR *mr,
char *m,
KMR_KVS *kvs,
171 const char *file,
const int line,
const char *func);
172 extern void kmr_error_mpi(
KMR *mr,
char *m,
int errorcode);
177 #define kmr_malloc(Z) kmr_safe_malloc((Z), #Z, __FILE__, __LINE__, __func__) 181 #define kmr_realloc(P,Z) kmr_safe_realloc((P), (Z), #Z, __FILE__, __LINE__, __func__) 184 kmr_safe_malloc(
size_t s,
char *szexpr,
185 const char *file,
const int line,
const char *func)
190 char *m = strerror(errno);
191 snprintf(ee, 80,
"malloc((%s)=%zd): %s", szexpr, s, m);
192 kmr_error2(0, ee, file, line, func);
198 kmr_safe_realloc(
void *q,
size_t s,
char *szexpr,
199 const char *file,
const int line,
const char *func)
201 void *p = realloc(q, s);
204 char *m = strerror(errno);
205 snprintf(ee, 80,
"realloc((%s)=%zd): %s", szexpr, s, m);
206 kmr_error2(0, ee, file, line, func);
212 kmr_free(
void *p,
size_t sz)
214 KMR_DEBUGX(memset(p, 0, sz));
222 kmr_check_alignment(
size_t sz)
224 return ((sz & ((8)-1)) == 0);
234 assert(data != KMR_KV_BAD);
241 case KMR_KV_POINTER_OWNED:
242 case KMR_KV_POINTER_UNMANAGED:
261 if (kmr_unit_sized_p(keyf)) {
267 if (kmr_unit_sized_p(valf)) {
281 if (kmr_unit_sized_p(keyf)) {
287 if (kmr_unit_sized_p(valf)) {
308 kmr_kvs_entry_netsize_of_box(
const struct kmr_kv_box kv)
323 if (kmr_unit_sized_p(keyf)) {
329 if (kmr_unit_sized_p(valf)) {
334 return (
void *)&(e->c[(ksz + vsz)]);
343 assert((((intptr_t)e) & 3) == 0);
344 e->klen = -1, e->vlen = -1;
353 return (e->klen == -1 && e->vlen == -1);
359 kmr_kvs_first_block(
KMR_KVS *kvs)
361 xassert(kvs->c.current_block == 0);
363 kvs->c.current_block = b;
378 return (
void *)&(b->data[0]);
391 return (
void *)((
char *)b + sz);
399 struct kmr_kvs_entry *e = (
void *)((
char *)&b->data[0] + b->fill_size);
412 struct kmr_kvs_entry *limit = kmr_kvs_last_entry_limit(kvs, b);
413 assert(&b->data[0] <= e && e <= limit);
424 return (
void *)((
char *)&(b->data[0]) + bytes);
434 assert(kvs != 0 && e != 0 && kvs->c.current_block != 0);
437 assert(p <= kmr_kvs_last_entry_limit(kvs, b));
438 if (!kmr_kvs_entry_tail_p(p)) {
441 if (bound_in_block) {
447 kvs->c.current_block = b;
462 size_t size,
size_t netsize)
464 KMR_DEBUGX(memset(b, 0, size));
467 b->partial_element_count = 0;
470 kmr_kvs_mark_entry_tail(e);
478 assert(kvs->c.magic == KMR_KVS_ONCORE);
479 if (kvs->c.first_block == 0) {
480 assert(kvs->c.current_block == 0 && kvs->c.block_count == 0);
481 kvs->c.first_block = b;
483 assert(kvs->c.current_block != 0 && kvs->c.block_count != 0);
484 kvs->c.current_block->next = b;
486 kvs->c.block_count++;
487 kvs->c.current_block = b;
488 kvs->c.adding_point = kmr_kvs_first_entry(kvs, b);
489 assert(kvs->c.current_block != 0 && kvs->c.adding_point != 0);
513 return (
void *)&(e->c[0]);
521 return (
void *)&(e->c[
KMR_ALIGN(e->klen)]);
525 kmr_pick_kv2(struct kmr_kvs_entry *e,
533 if (kmr_unit_sized_p(keyf)) {
538 if (kmr_unit_sized_p(valf)) {
553 struct kmr_kv_box kv = kmr_pick_kv2(e, kvs->c.key_data,
559 kmr_poke_kv2(
struct kmr_kvs_entry *e,
const struct kmr_kv_box kv,
562 _Bool reserve_space_only)
568 if (kmr_unit_sized_p(keyf)) {
571 if (!reserve_space_only) {
572 memcpy(kp, kv.k.p, (
size_t)kv.klen);
575 xkv->k.p = (
const char *)kp;
578 if (kmr_unit_sized_p(valf)) {
581 if (!reserve_space_only) {
582 memcpy(vp, kv.v.p, (
size_t)kv.vlen);
585 xkv->v.p = (
const char *)vp;
601 _Bool reserve_space_only)
603 kmr_poke_kv2(e, kv, xkv, kvs->c.key_data, kvs->c.value_data,
611 kmr_assert_i_kvs_ok_at_site(
KMR_KVS *kvi, _Bool irequired,
614 if (irequired && kvi == 0) {
615 kmr_error_at_site(0,
"Null input kvs", site);
616 }
else if (kvi != 0 && !KMR_KVS_MAGIC_OK(kvi->c.magic)) {
617 kmr_error_at_site(0,
"Bad input kvs (freed or corrupted)", site);
618 }
else if (kvi != 0 && !kvi->c.stowed) {
620 kmr_error_kvs_at_site(mr,
"kmr_add_kv_done not called for input kvs",
626 kmr_assert_i_kvs_ok(
KMR_KVS *kvi, _Bool irequired)
628 kmr_assert_i_kvs_ok_at_site(kvi, irequired, 0);
635 kmr_assert_o_kvs_ok_at_site(
KMR_KVS *kvo, _Bool orequired,
638 if (orequired && kvo == 0) {
639 kmr_error_at_site(0,
"Null output kvs", site);
640 }
else if (kvo != 0 && !KMR_KVS_MAGIC_OK(kvo->c.magic)) {
641 kmr_error_at_site(0,
"Bad output kvs (freed or corrupted)", site);
642 }
else if (kvo != 0 && kvo->c.stowed) {
644 kmr_error_kvs_at_site(mr,
645 "kmr_add_kv_done already called for output kvs",
651 kmr_assert_o_kvs_ok(
KMR_KVS *kvo, _Bool orequired)
653 kmr_assert_o_kvs_ok_at_site(kvo, orequired, 0);
662 _Bool irequired, _Bool orequired)
664 kmr_assert_i_kvs_ok_at_site(kvi, irequired, 0);
665 kmr_assert_o_kvs_ok_at_site(kvo, orequired, 0);
671 kmr_key_pointer_p(
KMR_KVS *kvs)
673 switch (kvs->c.key_data) {
675 xassert(kvs->c.key_data != KMR_KV_BAD);
682 case KMR_KV_POINTER_OWNED:
683 case KMR_KV_POINTER_UNMANAGED:
694 kmr_value_pointer_p(
KMR_KVS *kvs)
696 switch (kvs->c.value_data) {
698 xassert(kvs->c.value_data != KMR_KV_BAD);
705 case KMR_KV_POINTER_OWNED:
706 case KMR_KV_POINTER_UNMANAGED:
718 kmr_fields_pointer_p(
KMR_KVS *kvs)
720 return (kmr_key_pointer_p(kvs) || kmr_value_pointer_p(kvs));
729 switch (kvs->c.key_data) {
731 assert(kvs->c.key_data != KMR_KV_BAD);
734 if ((
size_t)kv.klen !=
sizeof(
long)) {
735 kmr_error(mr,
"Bad kv klen");
739 if ((
size_t)kv.klen !=
sizeof(
double)) {
740 kmr_error(mr,
"Bad kv klen");
745 case KMR_KV_POINTER_OWNED:
746 case KMR_KV_POINTER_UNMANAGED:
752 switch (kvs->c.value_data) {
754 assert(kvs->c.value_data != KMR_KV_BAD);
757 if ((
size_t)kv.vlen !=
sizeof(
long)) {
758 kmr_error(mr,
"Bad kv vlen");
762 if ((
size_t)kv.vlen !=
sizeof(
double)) {
763 kmr_error(mr,
"Bad kv vlen");
768 case KMR_KV_POINTER_OWNED:
769 case KMR_KV_POINTER_UNMANAGED:
793 case KMR_KV_POINTER_OWNED:
794 case KMR_KV_POINTER_UNMANAGED:
795 return KMR_KV_OPAQUE;
817 case KMR_KV_POINTER_OWNED:
818 case KMR_KV_POINTER_UNMANAGED:
819 return KMR_KV_POINTER_UNMANAGED;
829 return (kmr_unit_sized_or_opaque(d0) == kmr_unit_sized_or_opaque(d1));
837 return (kmr_shuffle_compatible_data_p(s0->c.key_data, s1->c.key_data)
838 && kmr_shuffle_compatible_data_p(s0->c.key_data, s1->c.key_data));
848 if (mr->kvses.tail == 0) {
849 assert(mr->kvses.head == 0);
850 mr->kvses.head = kvs;
851 mr->kvses.tail = kvs;
852 kvs->c.link.next = 0;
853 kvs->c.link.prev = 0;
855 KMR_KVS *tail = mr->kvses.tail;
856 assert(tail->c.link.next == 0);
857 tail->c.link.next = kvs;
858 mr->kvses.tail = kvs;
859 kvs->c.link.next = 0;
860 kvs->c.link.prev = tail;
867 kmr_copy_options_i_part(struct kmr_option opt)
869 struct kmr_option xopt = {.inspect = opt.inspect,
870 .nothreading = opt.nothreading,
871 .take_ckpt = opt.take_ckpt};
877 static inline struct kmr_option
878 kmr_copy_options_o_part(struct kmr_option opt)
880 struct kmr_option xopt = {.keep_open = opt.keep_open,
881 .nothreading = opt.nothreading,
882 .take_ckpt = opt.take_ckpt};
888 static inline struct kmr_option
889 kmr_copy_options_m_part(struct kmr_option opt)
891 struct kmr_option xopt = {.nothreading = opt.nothreading,
892 .take_ckpt = opt.take_ckpt};
898 static inline struct kmr_option
899 kmr_copy_s_option(struct kmr_option opt)
901 struct kmr_option xopt = {.key_as_rank = opt.key_as_rank,
902 .rank_zero = opt.rank_zero,
903 .take_ckpt = opt.take_ckpt};
910 kmr_ntuple_data_offset(
int n)
912 size_t sz =
sizeof(((
struct kmr_ntuple *)0)->len[0]);
913 size_t off = (size_t)
KMR_ALIGN((
int)sz * n);
914 return (offsetof(
struct kmr_ntuple, len) + off);
920 kmr_ntuple_entry_size(
int len)
928 kmr_ntuple_nth_offset(
struct kmr_ntuple *u,
int nth)
931 off = kmr_ntuple_data_offset(u->n);
932 for (
int i = 0; i < nth; i++) {
933 off += (size_t)kmr_ntuple_entry_size(u->len[i]);
941 kmr_ntuple_insertion_point(
struct kmr_ntuple *u)
943 assert(u->index < u->n);
945 size_t off = kmr_ntuple_nth_offset(u, u->index);
946 return (
void *)(p + off);
949 #define CHECK_ONE_FN_OPTION(NAME, A, B) \ 950 if (A . NAME < B . NAME) { \ 952 snprintf(ee, sizeof(ee), \ 953 "%s() does not support '" # NAME "' option", func); \ 960 kmr_check_fn_options(
KMR *mr,
struct kmr_option provide,
961 struct kmr_option given,
const char *func)
963 CHECK_ONE_FN_OPTION(nothreading, provide, given);
964 CHECK_ONE_FN_OPTION(inspect, provide, given);
965 CHECK_ONE_FN_OPTION(keep_open, provide, given);
966 CHECK_ONE_FN_OPTION(key_as_rank, provide, given);
967 CHECK_ONE_FN_OPTION(rank_zero, provide, given);
968 CHECK_ONE_FN_OPTION(collapse, provide, given);
969 CHECK_ONE_FN_OPTION(take_ckpt, provide, given);
972 extern int kmr_kv_field_bad;
973 extern int kmr_kv_field_opaque;
974 extern int kmr_kv_field_cstring;
975 extern int kmr_kv_field_integer;
976 extern int kmr_kv_field_float8;
977 extern int kmr_kv_field_pointer_owned;
978 extern int kmr_kv_field_pointer_unmanaged;
983 extern char *kmr_ptrstr_ff(
char *s);
984 extern long kmr_ptrint_ff(
void *p);
985 extern void * kmr_intptr_ff(
long p);
986 extern long kmr_dblint_ff(
double v);
987 extern double kmr_intdbl_ff(
long v);
988 extern long kmr_strint_ff(
char *p);
993 extern int kmr_get_nprocs(
const KMR *mr);
994 extern int kmr_get_rank(
const KMR *mr);
995 extern int kmr_get_nprocs_ff(
const KMR_KVS *kvs);
996 extern int kmr_get_rank_ff(
const KMR_KVS *kvs);
997 extern int kmr_get_key_type_ff(
const KMR_KVS *kvs);
998 extern int kmr_get_value_type_ff(
const KMR_KVS *kvs);
1000 extern int kmr_init_ff(
int kf,
struct kmr_option opt,
1002 extern KMR *kmr_create_context_ff(
const int fcomm,
const int finfo,
1004 extern int kmr_map_via_spawn_ff(
KMR_KVS *kvi,
KMR_KVS *kvo,
void *arg,
1007 extern int kmr_get_spawner_communicator_ff(
KMR *mr,
long i,
int *comm);
1009 extern void kmr_init_kvs_oncore(
KMR_KVS *kvs,
KMR *mr);
1010 extern int kmr_free_kvs_pushoff(
KMR_KVS *kvs, _Bool deallocate);
1013 extern int kmr_pushoff_make_stationary(
KMR_KVS *kvs);
1018 extern int kmr_parse_int(
char *s,
int *r);
1019 extern int kmr_parse_boolean(
char *s,
int *r);
1021 extern int kmr_scan_argv_strings(
KMR *mr,
char *s,
size_t len,
int arglim,
1022 int *argc,
char **argv,
1023 _Bool wssep,
char *msg);
1025 extern int kmr_allocate_block(
KMR_KVS *kvs,
size_t size);
1027 extern void kmr_isort(
void *a,
size_t n,
size_t es,
int depth);
1028 extern void *
kmr_bsearch(
const void *key,
const void *base,
1029 size_t nel,
size_t size,
1030 int (*compar)(
const void *,
const void *));
1032 extern int kmr_reverse_fn(
const struct kmr_kv_box kv,
1035 extern int kmr_pairing_fn(
const struct kmr_kv_box kv,
1038 extern int kmr_unpairing_fn(
const struct kmr_kv_box kv,
1041 extern int kmr_imax_one_fn(
const struct kmr_kv_box kv[],
const long n,
1043 extern int kmr_isum_one_fn(
const struct kmr_kv_box kv[],
const long n,
1046 extern kmr_sorter_t kmr_choose_sorter(
const KMR_KVS *kvs);
1047 extern signed long kmr_stable_key(
const struct kmr_kv_box kv,
1051 _Bool shuffling, _Bool ranking);
1056 void *sbuf,
long *scounts,
long *sdsps,
1057 void *rbuf,
long *rcounts,
long *rdsps);
1060 void *sbuf,
long scnt,
1061 void *rbuf,
long *rcnts,
long *rdsps);
1063 extern int kmr_iogroup_distance(
int a0,
int a1);
1068 extern FILE *
kmr_fopen(
const char *n,
const char *m);
1072 extern int kmr_msleep(
int msec,
int interval);
1073 extern void kmr_mfree(
void *p,
size_t sz);
1074 extern size_t kmr_mpi_type_size(
char *s);
1075 extern uint64_t kmr_mpi_constant_value(
char *s);
1077 extern int kmr_install_watch_program(
KMR *mr,
char *msg);
1079 extern int kmr_check_options(
KMR *mr, MPI_Info conf);
1080 extern int kmr_load_preference(
KMR *mr, MPI_Info info);
1081 extern int kmr_set_option_by_strings(
KMR *mr,
char *k,
char *v);
1085 extern void kmr_print_options(
struct kmr_option opt);
1088 extern void kmr_print_string(
char *msg,
char *s,
int len);
1090 extern void kmr_open_log(
KMR *mr);
int kmr_ckpt_progress_init(KMR_KVS *, KMR_KVS *, struct kmr_option)
It initializes a progress of MapReduce checkpointing.
Key-Value Stream (abstract).
int kmr_iogroup_of_obd(int obdidx)
Returns an I/O-group (an integer key) of a disk from an OBDIDX of Lustre file-system.
Options to Mapping, Shuffling, and Reduction.
int kmr_intstr_ff(long p, char *s, int n)
Fills the character array S by the contents at the pointer value integer P by the length N...
void kmr_ckpt_progress_fin(KMR *)
It finalizes the progress of MapReduce checkpointing.
void kmr_string_truncation(KMR *mr, size_t sz, char *s)
Modifies the string end with by "..." for indicating truncation, used on the result of snprintf...
#define KMR_ALIGN(X)
Rounds up a given size to the alignment restriction (currently eight bytes).
unsigned long kmr_fix_bits_endian_ff(unsigned long b)
Fixes little-endian bits used in Fortran to host-endian.
void kmr_ckpt_restore_ckpt(KMR_KVS *)
It restores checkpoint data to kvs.
void kmr_ckpt_save_kvo_each_init(KMR *, KMR_KVS *)
It initializes saving indexed key-value pairs of the output KVS to a checkpoint data file...
void kmr_ckpt_save_kvo_each_fin(KMR *, KMR_KVS *)
It finalizes saving indexed key-value pairs of the output KVS to the checkpoint data file...
int kmr_ckpt_enabled(KMR *)
Check if checkpoint/restart is enabled.
static const size_t kmr_kvs_entry_header
Size of an Entry Header.
Keyed-Record for Sorting.
long kmr_ckpt_first_unprocessed_kv(KMR *)
It returns the index of the first unprocessed key-value in the input KVS.
void kmr_ckpt_save_kvo_each_add(KMR *, KMR_KVS *, long)
It adds new key-value pairs of the output KVS to the checkpoint data file.
FILE * kmr_fopen(const char *n, const char *m)
Does fopen, avoiding EINTR.
char * kmr_strptr_ff(char *s)
Returns itself; this is for Fortran-binding.
unsigned short kmr_k_position_t[4]
Positions of node by (X,Y,Z,ABC), with ABC axes collapsed.
void kmr_ckpt_save_kvo_whole(KMR *, KMR_KVS *)
It saves all key-value pairs in the output KVS to a checkpoint data file.
int kmr_fgetc(FILE *f)
Does fgetc, avoiding EINTR.
int kmr_dump_mpi_info(char *prefix, MPI_Info info)
Dumps simply contents in MPI_Info.
int kmr_allgatherv(KMR *mr, _Bool rankzeroonly, void *sbuf, long scnt, void *rbuf, long *rcnts, long *rdsps)
All-gathers data, or gathers data when RANKZEROONLY.
static long kmr_tick()
Returns the clock counter value.
char * kmr_stringify_spawn_options(struct kmr_spawn_option o)
Returns a print string of a single option, to check the bits are properly encoded in foreign language...
void kmr_ckpt_save_kvo_block_add(KMR *, KMR_KVS *, long)
It adds a new block of key-value pairs of the output KVS to the checkpoint data file.
struct kmr_kvs_entry * kmr_find_kvs_last_entry(KMR_KVS *kvs)
Finds the last entry of a key-value stream.
kmr_kv_field
Datatypes of Keys or Values.
void kmr_isort(void *a, size_t n, size_t es, int depth)
Sorts by comparator on long integers.
void kmr_ckpt_create_context(KMR *)
Initialize checkpoint context.
Handy Copy of a Key-Value Field.
Options to Mapping by Spawns.
void kmr_ckpt_save_kvo_block_fin(KMR *, KMR_KVS *)
It finalizes saving block of key-value pairs of the output KVS to the checkpoint data file...
void * kmr_bsearch(const void *key, const void *base, size_t nel, size_t size, int(*compar)(const void *, const void *))
Searches a key entry like bsearch(3C), but returns a next greater entry instead of null on no match...
void kmr_ckpt_free_context(KMR *)
Free checkpoint context.
char * kmr_stringify_file_options(struct kmr_file_option o)
Returns a print string of a single option, to check the bits are properly encoded in foreign language...
int kmr_ckpt_disable_ckpt(KMR *)
It temporally disables checkpoint/restart.
int kmr_add_kv_pushoff(KMR_KVS *kvs, const struct kmr_kv_box kv)
Adds a key-value pair.
int kmr_assert_sorted(KMR_KVS *kvi, _Bool locally, _Bool shuffling, _Bool ranking)
Checks a key-value stream is sorted.
int kmr_iogroup_of_node(KMR *mr)
Returns an I/O-group (an integer key) of a compute node.
void kmr_ckpt_save_kvo_block_init(KMR *, KMR_KVS *)
It initializes saving blocks of key-value pairs of the output KVS to a checkpoint data file...
#define xassert(X)
Asserts and aborts, but it cannot be disabled.
char * kmr_stringify_options(struct kmr_option o)
Returns a print string of a single option, to check the bits are properly encoded in foreign language...
int kmr_add_kv_done_pushoff(KMR_KVS *kvs)
Marks finished adding key-value pairs, called from kmr_add_kv_done().
int kmr_getdtablesize(KMR *mr)
Does getdtablesize(); it is defined, because it is not Posix.
int kmr_load_properties(MPI_Info conf, char *filename)
Loads properties into MPI_Info (in Latin1 characters).
Options to Mapping on Files.
static struct kmr_kv_box kmr_pick_kv(struct kmr_kvs_entry *e, KMR_KVS *kvs)
Returns a handle to a key-value entry – a reverse of kmr_poke_kv().
int kmr_k_node(KMR *mr, kmr_k_position_t p)
Gets TOFU position (physical coordinates) of the node.
int(* kmr_redfn_t)(const struct kmr_kv_box kv[], const long n, const KMR_KVS *kvi, KMR_KVS *kvo, void *arg)
Reduce-function Type.
int kmr_gather_sizes(KMR *mr, long siz, long *rbuf)
Calls all-gather for collecting one long-integer.
int kmr_ckpt_enable_ckpt(KMR *, int)
It temporally enables checkpoint/restart which has been disabled by calling kmr_ckpt_disable_ckpt().
static void kmr_poke_kv(struct kmr_kvs_entry *e, const struct kmr_kv_box kv, struct kmr_kv_box *xkv, const KMR_KVS *kvs, _Bool reserve_space_only)
Stores a key-value pair at the entry E in the store – a reverse of kmr_pick_kv().
Information of Source Code Line.
int(* kmr_mapfn_t)(const struct kmr_kv_box kv, const KMR_KVS *kvi, KMR_KVS *kvo, void *arg, const long index)
Map-function Type.
void kmr_ckpt_lock_start(KMR *)
Define the start position of code region that is referred when restart.
int kmr_copy_mpi_info(MPI_Info src, MPI_Info dst)
Copies contents of MPI_Info.
int kmr_alltoallv(KMR *mr, void *sbuf, long *scounts, long *sdsps, void *rbuf, long *rcounts, long *rdsps)
Does all-to-all-v, but it takes arguments of long-integers.
void * kmr_strdup(char *s)
STRDUP, but aborts on failure.
void kmr_ckpt_remove_ckpt(KMR_KVS *)
It removes checkpoint data file.
void kmr_ckpt_lock_finish(KMR *)
Define the end position of code region that is referred when restart.
int kmr_exchange_sizes(KMR *mr, long *sbuf, long *rbuf)
Calls all-to-all to exchange one long-integer.