Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GrB_Vector_(de)serialize #175

Open
victorstewart opened this issue Nov 2, 2022 · 6 comments
Open

GrB_Vector_(de)serialize #175

victorstewart opened this issue Nov 2, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@victorstewart
Copy link

any fundamental reason why these functions don't exist, or just simply "on the docket"?

@DrTimothyAldenDavis
Copy link
Owner

They should exist, in my opinion. See GraphBLAS/graphblas-api-c#36 . I only follow the spec, and I've put in an issue to the GraphBLAS C API committee to consider adding them. I've added my own as GxB_Vector_serialize and deserialize.

@DrTimothyAldenDavis DrTimothyAldenDavis added the enhancement New feature or request label Nov 2, 2022
@DrTimothyAldenDavis
Copy link
Owner

I closed this by mistake ... should be left open until the C API spec is updated.

@victorstewart
Copy link
Author

victorstewart commented Nov 2, 2022

sounds good.

i prepend the size of the serialized buffer first, then the buffer, then align the tail to 2MB as i'm using O_DIRECT. so when i control the memory it's as simple as a single meta write. but when i don't control the memory i have to do it in up to 3 stages (head + body + tail). so just makes the code more unnecessarily complex though still less than 40 lines. and 10 lines the other way.

@victorstewart
Copy link
Author

oh and thanks for these functions! allowed me to delete the multi hundred line serialization and deserialization functions i'd written myself. less code is always more.

@DrTimothyAldenDavis
Copy link
Owner

Glad to help! Yes, the serialize/deserialize methods are very important. I put a lot of work into them to make the serialized blobs as compact as possible, now with ZSTD compression by default.

I hadn't considered the idea of rounding up the size to a multiple of 2MB, but then that would only make sense if all you had was the blob ... but you want to (naturally) add the blobsize at the front.

Actually, the first 8 bytes of the serialized blob contains the size of the blob itself. But the blob is supposed to be opaque, and that feature of my blob is not supposed to be visible to the user application. So you can't rely on that fact, unfortunately.

See this line for the first thing in my blob header:

GB_BLOB_WRITE (blob_size_required, size_t) ;

... shhhh ... you didn't see that line of code :-)

@victorstewart
Copy link
Author

victorstewart commented Sep 20, 2023

i just ran into a need for this. when forking, to then serialize the copy-on-write copies of the matrix and vector objects into IPC shared memory segments between the parent and child process, there's of course no way with the current API to instruct GrB_Vector_serialize to write into the shared memory region.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants