Comments (3)
The timings are misleading in this example. You've built the matrix with setElement, which is the slower way to do it, and it also leaves the matrix as a pile of unsorted tuples. If you want to time just the dup, you would need to put a GrB_wait outside the timer, first. Otherwise, GrB_Matrix_dup must first call GrB_wait itself on the matrix, which is doing the work of GrB_Matrix_build on the unsorted tuples from setElement.
Serialization is likely the best way to send a matrix across a network. That's what it's designed for. An alternative would be to use no compression at all, which leads to a faster serialize time, but requires more bytes to send. Another alternative would be to use GxB_Matrix_unpack to unpack the matrix in O(1) time, transmit the pieces, and then GxB_Matrix_pack it again.
from graphblas.
magic!!! i knew about needing to wait for operations to execute of course but i didn't realize it applied to setElement as well.
this order of magnitude drop in time cost buys me a lot of time until i have to worry about this problem again. thanks so much.
i see now that the serialization without compression is essentially an allocate + memcpy as well. so i'll just copy the matrix on the "main thread" then serialize it with GxB_COMPRESSION_ZSTD on a worker thread.
the memory consumption of the matrix also fell to 37.6% of the original after GrB_MATERIALIZE. so that's only ~8 bytes per uint8_t element instead of the ~22 bytes i assumed before. so now the memory size differential between the serialized matrix and the GrB_Matrix is on the order of 2.8x whereas before it was on the order of 7.4x, so ~2.7x smaller. so much easier to justify overcommitting the database's memory to account for this transient memory need of copy then compress than before.
i need to preserve the matrices so the unpack way isn't an option, but its time cost would be the same as these other ways.
root@clr-b5df9984821e4d129387e172044f5754~ # ./graphreplication.test
milliseconds to GrB_MATERIALIZE: 3354ms
1000000x1000000 matrix with 100000000 elements consumes 770.5MB
milliseconds to allocate + copy the matrix: 76ms
milliseconds to allocate + serialize the matrix with compression: 776ms
size of serialized compressed matrix: 275.6MB
milliseconds to allocate + serialize the matrix NO compression: 72ms
size of serialized matrix without compression: 770.5MB
from graphblas.
circling back on this. i realized the optimal solution is to fork the process to get copy-on-write matrices, and then serialize on that new process. this requires no downtime and the absolute minimal extra memory cost.
from graphblas.
Related Issues (20)
- Removed symbols without soname bump HOT 12
- atomic*: Undefined symbol on armel and mipsel architectures HOT 33
- "ZEROB" Binary Operator HOT 3
- GxB sort with smaller (or larger) output objects
- cpu_features: Build error for MinGW HOT 13
- Size of Static Library HOT 16
- Link error with Intel igx and Ninja generator on Windows HOT 9
- Optimisation report causing build failure when using Intel oneAPI HOT 2
- nvals weirdness with 8.0.0 for max-sized Vector HOT 6
- Where is `GxB_Context_error`? HOT 3
- Why was `nthreads` and `chunks` remove from the descriptor? HOT 5
- dynamic connectivity in the language of graphblas HOT 1
- no JIT kernels produced? HOT 3
- Modify CMake options to build without bundled libraries HOT 1
- Sublinear Performance with n Threads HOT 6
- [BUG]: Incorrect result(!) in vector-matrix multiply with accumulation in versions 8.0.2 and 8.2.0 HOT 13
- Allow enabling and disabling JIT for operators and types with get/set HOT 1
- Monoid Creation with Scalar HOT 1
- Excess allocation in dense apply HOT 2
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 graphblas.