| | 1 | The CIVL core libraries include: |
| | 2 | |
| | 3 | * `civlc`: the basic library of CIVL, usually included in a CIVL-C program, defining types and functions that are frequently used; |
| | 4 | * `scope`: providing utility functions related to dynamic scopes; |
| | 5 | * `pointer`: providing utility functions dealing with pointers; |
| | 6 | * `seq`: providing operations on sequences which is realized using arrays; |
| | 7 | * `concurrency`: providing concurrency utilities such as barrier and collective record; |
| | 8 | * `bundle`: defining bundle types and their operations; |
| | 9 | * `comm`: defining communicators and their operations. |
| | 10 | |
| | 11 | === `civlc` : basic functions === |
| | 12 | |
| | 13 | Types: |
| | 14 | * `$operation`: an enumeration type of operations |
| | 15 | |
| | 16 | Functions: |
| | 17 | * `fun[lib="civlc"] $set_default(obj: Pointer)` |
| | 18 | * sets the leaf nodes of a variable to be the default value of zero |
| | 19 | * `fun[lib="civlc"] $apply(obj1: Pointer, op: Operation, obj2: Pointer, result: Pointer)` |
| | 20 | * applies a binary operator `op` to two objects |
| | 21 | * `fun[lib="civlc"] $elaborate(x: Integer)` |
| | 22 | * elaborate an integer expression |
| | 23 | * `fun[lib="civlc"] $next_time_count()` |
| | 24 | * gets a unique non-negative integer for time count |
| | 25 | * `fun[lib="civlc", pure] $pathCondition()` |
| | 26 | * prints path condition of the current state |
| | 27 | * `fun[lib="civlc"] $choose_int(n: Integer): Integer;` |
| | 28 | * non-deterministic choice of integer |
| | 29 | * this function takes as input a positive integer `n` and nondeterministicaly returns an integer in the range `[0, n − 1]`. |
| | 30 | * `fun[lib="scope"] $scope_parent(s: Scope): Scope` |
| | 31 | * gets the parent of a scope `s` |
| | 32 | * If `s` is the root dynamic scope, it returns `scope_null`. |
| | 33 | |
| | 34 | === Pointer utilities `pointer.cvh` === |
| | 35 | The header `pointer.cvh` declares functions taking pointers as the arguments for different purposes, including: |
| | 36 | |
| | 37 | * equality checking: |
| | 38 | `fun[lib="pointer"] $equals(x: Pointer, y: Pointer): Bool` |
| | 39 | this function returns true iff the objects pointed to by the pointers `x` and `y` have the same type and value. |
| | 40 | |
| | 41 | * membership testing: |
| | 42 | `fun[lib="pointer"] $contains(ptr1: Pointer, ptr2: Pointer): Bool` |
| | 43 | this function returns true iff the object pointed to by `ptr1` contains the object pointed to by `ptr2`. For example, `$contains(&a, &a[1].x)` would return true. |
| | 44 | |
| | 45 | * pointer translation: |
| | 46 | |
| | 47 | `fun[lib="pointer"] $translate_ptr(ptr: Pointer, obj: Pointer): Pointer` |
| | 48 | |
| | 49 | this function returns a pointer which is the result of translating the pointer `ptr` (a pointer into one object) to a pointer into a different object `obj` with similar structure. |
| | 50 | |
| | 51 | * copy through pointers: |
| | 52 | `fun[lib="pointer"] $copy(ptr: Pointer, value: pointer)` |
| | 53 | |
| | 54 | copies the value pointed to by `value` to the memory location specified by `ptr`. |
| | 55 | |
| | 56 | * get leaf node pointers: |
| | 57 | |
| | 58 | `fun[lib="pointer"] $leaf_node_ptrs(array: Pointer, obj: Pointer)` |
| | 59 | |
| | 60 | copies the references to the leaf nodes of `obj` to the given `array`. The type of `obj` is `Pointer[T']`, all leaf nodes of `T'` has type `T`, and `array` has type `Pointer[Array[T]]`. For example, `T'` could be `Tuple[<Integer, Array[Integer], Integer>]` |
| | 61 | |
| | 62 | * set leaf nodes: |
| | 63 | `fun[lib="pointer"] $set_leaf_nodes(obj: Pointer, value: Integer)` |
| | 64 | |
| | 65 | * check if the given pointer is pointing to a variable: |
| | 66 | |
| | 67 | `fun[lib="pointer"] $is_identity_ref(obj: Pointer)` |
| | 68 | |
| | 69 | * check if the leaf nodes of the given object are equal to the given integer value |
| | 70 | |
| | 71 | `fun[lib="pointer"] $leaf_nodes_equal_to(obj: Pointer, value: Integer)` |
| | 72 | |
| | 73 | * check if the given object has a leaf node whose value is equal to the given integer value |
| | 74 | |
| | 75 | `fun[lib="pointer"] $has_leaf_node_equal_to(obj: Pointer, value: Integer)` |
| | 76 | |
| | 77 | * check if the given pointer could be safely dereferenced |
| | 78 | |
| | 79 | `fun[lib="pointer"] $is_derefable_pointer(ptr: Pointer)` |
| | 80 | |
| | 81 | * pointer addition |
| | 82 | `fun[lib="pointer"] $pointer_add(ptr: Pointer, offset: Integer, type_size: Integer)` |
| | 83 | |
| | 84 | === `bundle` utility === |
| | 85 | |
| | 86 | * Type: `Bundle`, which is a union type of all system types and user-defined types of a given program |
| | 87 | |
| | 88 | * size of bundle |
| | 89 | |
| | 90 | `fun[lib="bundle", pure] $bundle_size(b: Bundle): Integer` |
| | 91 | |
| | 92 | * pack data into a bundle |
| | 93 | |
| | 94 | `fun[lib="bundle"] $bundle_pack(ptr: Pointer, size: Integer): Bundle` |
| | 95 | |
| | 96 | * unpack a bundle |
| | 97 | |
| | 98 | `fun[lib="bundle"] $bundle_unpack(bundle: Bundle, ptr: Pointer)` |
| | 99 | |
| | 100 | * unpack a bundle and apply some operation to the data |
| | 101 | |
| | 102 | `fun[lib="bundle"] $bundle_unpack_apply(data: Bundle, buf: Pointer, size: Integer, op: Operation)` |
| | 103 | |
| | 104 | === concurrency utility `concurrency` === |
| | 105 | |
| | 106 | ==== barrier operations ==== |
| | 107 | * global barrier creation |
| | 108 | |
| | 109 | `fun[lib="concurrency"] $gbarrier_create(scope: Scope, size: Integer): GBarrier` |
| | 110 | |
| | 111 | * global barrier destroy |
| | 112 | |
| | 113 | `fun[lib="concurreny"] $gbarrier_destroy(barrier: Gbarrier)` |
| | 114 | |
| | 115 | * local barrier creation |
| | 116 | |
| | 117 | `fun[lib="concurrency"] $barrier_create(scope: Scope, gbarrier: Gbarrier, place: Integer): Barrier` |
| | 118 | |
| | 119 | * local barrier destroy |
| | 120 | |
| | 121 | `fun[lib="concurrency"] $barrier_destroy(barrier: Barrier)` |
| | 122 | |
| | 123 | * barrier call |
| | 124 | |
| | 125 | `fun $barrier_call(barrier: Barrier)` |
| | 126 | |
| | 127 | ==== collective records ==== |
| | 128 | * Type: `Collect_record`, `GCollect_checker`, and `Collect_checker` |
| | 129 | |
| | 130 | * global collective checker creation |
| | 131 | |
| | 132 | `fun[lib="concurrency"] $gcollect_checker_create(scope: Scope): Gcollect_checker` |
| | 133 | |
| | 134 | * global collective checker destroy |
| | 135 | |
| | 136 | `fun[lib="concurrency"] $gcollect_checker_destroy(gchecker: Gcollect_checker)` |
| | 137 | |
| | 138 | * collective checker creation |
| | 139 | |
| | 140 | `fun[lib="concurrency"] $collect_checker_create(scope: Scope, gchecker: Gcollect_checker)` |
| | 141 | |
| | 142 | * collective checker destroy |
| | 143 | |
| | 144 | `fun[lib="concurrency"] $collect_checker_destroy(checker: Collect_checker)` |
| | 145 | |
| | 146 | * collective records checking |
| | 147 | |
| | 148 | `fun[lib="concurrency"] $collect_check(checker: Collect_checker, place: Integer, nprocs: Integer, entries: Bundle)` |
| | 149 | |
| | 150 | === communication `comm` === |
| | 151 | * Types |
| | 152 | * `Message` |
| | 153 | * `Queue` |
| | 154 | * `GComm` |
| | 155 | * `Comm` |
| | 156 | |
| | 157 | * message operations |
| | 158 | * pack a message: `fun[lib="comm"] $message_pack(src: Integer, dst: Integer, tag: Integer, dt: Pointer, sz: Integer): Message` |
| | 159 | * unpack a message: `fun[lib="comm"] $message_unpack(msg: Message, buf: Pointer, sz: Integer)` |
| | 160 | * source of a message: `fun[lib="comm", pure] $message_source(msg: Message): Integer` |
| | 161 | * tag of a message: `fun[lib="comm", pure] $message_tag(msg: Message): Integer` |
| | 162 | * destination of a message: `fun[lib="comm", pure] $message_dest(msg: Message): Integer` |
| | 163 | * size of a message: `fun[lib="comm", pure] $message_size(msg: Message): Integer` |
| | 164 | |
| | 165 | * global communicator operations |
| | 166 | * creation: `fun[lib="comm"] $gcomm_create(scope: Scope, size: Integer): GComm` |
| | 167 | * destroy: `fun[lib="comm"] $gcomm_destroy(gcomm: GComm)` |
| | 168 | * duplication: `fun[lib="comm"] $gcomm_dup(old: Comm, new: Comm)` |
| | 169 | |
| | 170 | * local communicator operations |
| | 171 | * creation: `fun[lib="comm"] $comm_create(scope: Scope, gcomm: GComm, place: Integer): Comm` |
| | 172 | * destroy: `fun[lib="comm"] $comm_destroy(comm: Comm)` |
| | 173 | * get size: `fun[lib="comm", pure] $comm_size(comm: Comm): Integer` |
| | 174 | * get place: `fun[lib="comm", pure] $comm_place(comm: Comm): Integer` |
| | 175 | * enqueue: `fun[lib="comm"] $comm_enqueue(comm: Comm, msg: Message)` |
| | 176 | * probe: `fun[lib="comm", pure] $comm_probe(comm: Comm, src: Integer, tag: Integer): Bool` |
| | 177 | * seek: `fun[lib="comm"] $comm_seek(comm: Comm, src: Integer, tag: Integer): Message` |
| | 178 | * dequeue: `fun[lib="comm"] $comm_dequeue(comm: Comm, src: Integer, tag: Integer): Message` |
| | 179 | |
| | 180 | === domain utility `domain` === |
| | 181 | |
| | 182 | * Types: `Domain_strategy` and `Domain_decomposition` |
| | 183 | |
| | 184 | * domain decomposition: `fun[lib="domain"] $domain_partition(dom: Domain, s: Domain_strategy, n: Integer): Domain_decomposition` |
| | 185 | * check if domain is rectangular: `funl[lib="domain"] $is_rectangular_domain(dom: Domain): Bool` |
| | 186 | * get dimension: `fun[lib="domain", pure] $dimension_of(dom: Domain): Integer` |
| | 187 | * get size (total number of tuples): `fun[lib="domain"] $domain_size(dom: Domain): Integer` |
| | 188 | |
| | 189 | === sequence operations `seq` === |
| | 190 | * sequence initialization |
| | 191 | |
| | 192 | `fun[lib="seq"] $seq_init(seq: Pointer, count: Integer, value: Pointer)` |
| | 193 | |
| | 194 | given a pointer to an object of `Array[T]`, sets that object to be the array of length count in which every element has the same value, specified by the given pointer value.Parameters: |
| | 195 | 1. array: pointer-to-incomplete-array-of-T |
| | 196 | 1. count: any integer type, must be nonnegative |
| | 197 | 1.value: pointer-to-T |
| | 198 | |
| | 199 | * length of sequence |
| | 200 | |
| | 201 | `fun[lib="seq", pure] $seq_length(seq: Pointer): Integer` |
| | 202 | |
| | 203 | * insertion |
| | 204 | |
| | 205 | `fun[lib="seq"] $seq_insert(seq: Pointer, index: Integer, values: Pointer, count: Integer)` |
| | 206 | |
| | 207 | * removal |
| | 208 | |
| | 209 | `fun[lib="seq"] $seq_remove(seq: Pointer, index: Integer, values: Pointer, count: Integer)` |
| | 210 | |
| | 211 | * appending |
| | 212 | |
| | 213 | `fun[lib="seq"] $seq_append(seq: Pointer, values: Pointer, count: Integer)` |