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

Recommended pattern for memory mapped arrays #27

Closed
bear24rw opened this issue Sep 4, 2019 · 2 comments
Closed

Recommended pattern for memory mapped arrays #27

bear24rw opened this issue Sep 4, 2019 · 2 comments

Comments

@bear24rw
Copy link

bear24rw commented Sep 4, 2019

Hi,

I have a 100GB file of floats that I have memory mapped, what would be the recommended pattern for doing things like finding the min and max value or computing a histogram? It seems like DynamicArray is the thing to use but it assumes ownership of the array. I could loop over fixed size chunks and load<>() them into an Array but then I need to deal with the boundary condition at the end if the dataset isn't a multiple of the Array size. What would be your suggestions for this scenario?

@merlinND
Copy link
Member

merlinND commented Sep 5, 2019

Hi @bear24rw,

Dynamic arrays offer the map(ptr, size) constructor, which does not take ownership of the memory region. Does this work for you?

static Derived map(void *ptr, size_t size) {

@bear24rw
Copy link
Author

bear24rw commented Sep 5, 2019

I think that's exactly what I need, I didn't see that mentioned anywhere in the docs, thanks!

@bear24rw bear24rw closed this as completed Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@bear24rw @merlinND and others