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

implemented Base.unaliascopy for mappedarrays #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

m-wells
Copy link

@m-wells m-wells commented Feb 3, 2020

I was getting this error

ERROR: ArgumentError: an array of type `MappedArrays.MappedArray` shares memory with another argument and must
make a preventative copy of itself in order to maintain consistent semantics,
but `copy(A)` returns a new array of type `Array{Unitful.Quantity{Float32,𝐌,Unitful.FreeUnits{(M⊙,),𝐌,nothing}},1}`. To fix, implement:
    `Base.unaliascopy(A::MappedArrays.MappedArray)::typeof(A)`

So I did what the error message suggested.

@codecov-io
Copy link

codecov-io commented Feb 3, 2020

Codecov Report

Merging #30 into master will increase coverage by 0.02%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #30      +/-   ##
==========================================
+ Coverage   74.44%   74.46%   +0.02%     
==========================================
  Files           1        1              
  Lines          90       94       +4     
==========================================
+ Hits           67       70       +3     
- Misses         23       24       +1
Impacted Files Coverage Δ
src/MappedArrays.jl 74.46% <75%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb4a697...8fa8d7d. Read the comment docs.

@timholy
Copy link
Member

timholy commented Feb 3, 2020

Can you show how this came up? It's quite possible that this error is a good thing, and that you should instead be explicitly calling copy.

@m-wells
Copy link
Author

m-wells commented Feb 4, 2020

I have a large memory mapped array with JLD that I call views and mapped arrays on. I tried to create a standalone example that would demonstrate the error but I cannot. The views and mapped arrays all share the underlying data.

To be clear, the underlying data is not being manipulated during these operations and the views and maps are being passed to functions to compute new values to be stored separately.

@timholy
Copy link
Member

timholy commented Feb 4, 2020

Even if you can't share the data for reasons of size, can you share the code portion of a reproducer?

@m-wells
Copy link
Author

m-wells commented Feb 5, 2020

I'll see if I can make a code snippet that I am comfortable sharing.

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

Successfully merging this pull request may close these issues.

3 participants