Comments (3)
Alternatively if we can replace hae steal request as pointers (#7), we could use a set instead of a bitset.
The following is probably the most efficient set datastructure found bounded sets that needs fast random picking and has been used for Montecarlo Tree Search: https://github.com/mratsim/golem-prime/blob/09a81ebf9f4c0789e830f391cdfde1e796ea0765/src/datatypes.nim#L106-L119 and https://github.com/mratsim/golem-prime/blob/09a81ebf9f4c0789e830f391cdfde1e796ea0765/src/core/c_empty_points.nim
- An array of indices
- An array of values
- A length
The array of values + len can be appended to and values can be deleted in any order (we replace the deleted value with the last value to keep it constant time we don't copy everything). The array of indices will map the "real" index to the actual index in the array of values.
This trades speed of space.
Bitset of 256 victims would require 32 bytes, such an array would require at the minimum 2x uint8 + length so 513 bytes. This requires steal request as pointers as otherwise this will have a huge impact on the size of the MPSC channels, the size required would grow by 481 bytes * numWorkers * numWorkers (as each channel needs to be sized for numWorkers steal requests, and each workers has its own)
from weave.
3 interesting approaches for a compressed bitset random victim selection:
- bithacks: http://graphics.stanford.edu/~seander/bithacks.html#SelectPosFromMSBRank
- faster uncompressing: https://lemire.me/blog/2018/02/21/iterating-over-set-bits-quickly/
- Adapt the following algorithm:
Uncompressing will cause stack overflow with high core counts
The bithack require quite a lot of instructions even though it benefits from instruction level parallelism.
from weave.
closed by #15
from weave.
Related Issues (20)
- parallelFor has arguments that do not fit in the parallel tasks data buffer HOT 9
- a plea for an easier to understand error message HOT 3
- Recent Nim makes Weave crash HOT 8
- affinity_posix should get this patch (for Android/Termux)
- @mratsim
- Cache misses (much) worse for page-aligned (e.g. power of two) accesses
- Raytracing example doesnt compile with threads HOT 1
- UX: auto-transform captured seq to ptr UncheckedArray behind the scenes HOT 3
- functions with no arguments fail parsing HOT 1
- Is there a manual or tutorial for weave? HOT 2
- Weave doesn't compile on MacOS with arm64 HOT 2
- Error: undeclared identifier: 'gebb_ukernel_int_x86_AVX512' HOT 2
- Feature Request: Cores as init parameter, respect core perf levels
- Vastly simplify and accelerate memory management. HOT 1
- Use Lnear Congruential Generator to generate work-stealing permutation HOT 1
- randomly "off values" HOT 2
- error: special identifier '_' ignored HOT 4
- Can Weave spawn a thread that sends a Channel message to the main channel without blocking the main thread? HOT 3
- "nimble install weave" fails on Ubuntu 18 HOT 3
- Examples in README.md do not compile HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weave.