File tree Expand file tree Collapse file tree 9 files changed +170
-0
lines changed
Expand file tree Collapse file tree 9 files changed +170
-0
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,17 @@ before_install:
3131script :
3232- buckaroo install
3333- ./test.sh
34+ - buck build :bundle
35+
36+ deploy :
37+ provider : releases
38+ api_key :
39+ secure : fKnFdbsFZqotefPp0VrAN3CnUWsjizAs0Jnr71ZhrAX6yv82bJwa0sy3TPdWeGQcMEGWaEZYU/t1ovZ2NX1uVrkNXv9BI1GMiJdkM7IVVZ1tUYskmfr9Xvtgr84AVJbsKu775r84jUQ3/wNw2FeDBvvPbZ/1WM1nN4XaKup5rpjIU01uc1Xyzz4PhuaT4LXP7lQ82uV838cDGFn2le9AKtCLlcI5+fe6/ttjGm+46m32xSIwwbuzFNdO/Epw4TEq+VbFeoRSKmxENXa70I4CXxqaKcmSxvS5yRmQQENjNYqNXmI6Gx/9Ro7lJMni7P7jPGyh5G4G/s9UEhHefklecIgsq/eXuGprN5NcBJIOvZP5dReMR/9zAonzI4qS0V2/igoZau5VEH/twhCA2nOk4pTLRFsLbBibs2JmT6WTbAMsJuliae4EvivdQ+b99TphxTJia3EPTd2THwOfvHJ1zEc23Vgd7B7j5laVE9G553i03U/d7Cc3KNDt7yz+VDOVxm1f2CxhD1KpmQ93TDe42oNs96bcABtEQyi7IJZNz8zClBSyF1e1HwdImNojlYHnT5EkguVNpCm45dVcecHLGTvlWTkNY6J+6Br6s6BEGWTiEZDHngsi0PJ4S8La1wBJ0UGdHfxvijtAmqfCZoRUPLwDkIb/meZ7Eav/VYTIu4A=
40+ file_glob : true
41+ file :
42+ - " buck-out/gen/bundle/bundle.zip"
43+ skip_cleanup : true
44+ on :
45+ repo : LoopPerfect/conduit
46+ tags : true
47+ all_branches : true
Original file line number Diff line number Diff line change @@ -41,3 +41,17 @@ cxx_library(
4141 'PUBLIC' ,
4242 ],
4343)
44+
45+ genrule (
46+ name = 'bundle' ,
47+ out = 'bundle.zip' ,
48+ srcs = glob ([
49+ 'include/conduit/**/*.hpp' ,
50+ ]),
51+ cmd = ' && ' .join ([
52+ 'cp -r $SRCDIR/. $TMP' ,
53+ 'cp $(location :mega-header) $TMP/include/conduit/conduit.hpp' ,
54+ 'cd $TMP' ,
55+ 'zip -r $OUT .' ,
56+ ]),
57+ )
Original file line number Diff line number Diff line change @@ -13,6 +13,34 @@ Conduit's goals are:
1313
1414These are attained by adopting a monadic interface that leverages zero-cost abstractions.
1515
16+ ## Build
17+
18+ To fetch dependencies (only required for testing and benchmarks):
19+
20+ ``` bash=
21+ buckaroo install
22+ ```
23+
24+ To build the library:
25+
26+ ``` bash=
27+ buck build :conduit
28+ ```
29+
30+ To run the examples:
31+
32+ ``` bash=
33+ buck run examples/primes
34+ buck run examples/fibonacci
35+ # etc...
36+ ```
37+
38+ To run the tests:
39+
40+ ``` bash=
41+ buck test test
42+ ```
43+
1644## Examples
1745
1846Use ` co_yield ` to define a coroutine and transform it using high-level operators.
Original file line number Diff line number Diff line change 1+ # Allocators
2+
3+ The current implementation of coroutines implicitly allocates a coroutine - unless optimized - on the heap.
4+ As a result the user cannot initialize any coroutines using a custom allocator object.
5+
6+ This means only static allocators can be supported.
7+ One way to costumize the allocation behaviour is via an extra template parameter ` seq<T, AllocatorType> ` .
8+
9+ An alternative is to implement a costomization point using template specializations.
10+
11+ We have chosen the latter solution as this does not require threading the AllocatorType through each operator.
12+ We believe that this reduces the cognitive overhead required to implement new algorithms and will increase developer productivity.
13+ This solution implies that you have to choose an allocator seq<T > before your application runs.
14+
15+ ## How does the customization point work?
16+
17+ We have defined a generic type ` template<class T> promise_allocator ` which is used for each ` seq<T> ` .
18+ By default it uses the standard allocator.
19+ In order to change the promise_allocator specialize this template:
20+
21+ ``` c++
22+ template <class T >
23+ struct promise_allocator <seq<T >> {
24+ void* allocate(std::size_t);
25+ void deallocate(void* );
26+ };
27+ ```
28+
29+ This definition will be prefrred by the compiler as this a higher specificity compared to default definition.
30+ You can use a predifined allocator by just including `include/conduit/allocators/*.hpp` or implement your own in a same fashion.
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ Rx allows you to build and transform *push* based data processing pipelines. Con
2121
2222Range-V3 focuses on implementing an API compatible with the Ranges-TS. Although there is some intersection between Range-V3 and Conduit's Sequences API, Conduit's API is much leaner. This enables more composability and compiler optimizations.
2323
24+ Furthermore Range-V3 implements every operation using templates, leading to a unique type for each iterator/container constructed. This leads to large compile times. In Conduit every operation returns a ` seq<T> ` .
25+
2426### Why does ` seq ` not implement ` .base() ` ?
2527
2628` .base() ` returns the pointer to the original iterator. For example:
Original file line number Diff line number Diff line change 1+ cxx_binary (
2+ name = 'random' ,
3+ srcs = [
4+ 'main.cpp' ,
5+ ],
6+ compiler_flags = [
7+ '-fPIC' ,
8+ '-pthread' ,
9+ ],
10+ linker_flags = [
11+ '-pthread' ,
12+ ],
13+ deps = [
14+ '//:conduit' ,
15+ ],
16+ )
Original file line number Diff line number Diff line change 1+ #include < random>
2+ #include < iostream>
3+
4+ #include < conduit/conduit.hpp>
5+
6+ using namespace conduit ;
7+ using namespace operators ;
8+
9+ auto random_seq = [](int seed) -> seq<double > {
10+ // pseudo-random
11+ std::mt19937 engine (seed);
12+ std::uniform_real_distribution<> dist;
13+
14+ while (true ) {
15+ co_yield dist (engine);
16+ }
17+ };
18+
19+ int main () {
20+ int seed = 1234 ;
21+
22+ for (auto x : random_seq (seed) >> take (10 )) {
23+ std::cout << x << std::endl;
24+ }
25+
26+ return 0 ;
27+ }
Original file line number Diff line number Diff line change 1+ cxx_binary (
2+ name = 'squares' ,
3+ srcs = [
4+ 'main.cpp' ,
5+ ],
6+ compiler_flags = [
7+ '-fPIC' ,
8+ '-pthread' ,
9+ ],
10+ linker_flags = [
11+ '-pthread' ,
12+ ],
13+ deps = [
14+ '//:conduit' ,
15+ ],
16+ )
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ #include < conduit/conduit.hpp>
3+
4+ using namespace conduit ;
5+ using namespace operators ;
6+
7+ auto squares = []() -> seq<int > {
8+ int x = 0 ;
9+
10+ while ( true ) {
11+ co_yield x * x;
12+
13+ ++x;
14+ }
15+ };
16+
17+ int main () {
18+ for (auto x : squares () >> take (10 )) {
19+ std::cout << x << std::endl;
20+ }
21+
22+ return 0 ;
23+ }
You can’t perform that action at this time.
0 commit comments