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
Merge some classes, use memory-mapped storage, vectorise more #23
Conversation
Pull Request Test Coverage Report for Build 1301452136
💛 - Coveralls |
c24d6ed
to
b74367e
Compare
For EpsTensor classes, the above makes |
Hi. I just started looking at your PR. There is a problem with the mandatory epsA and epsB and the inmutable object. A very big advantage of the Haydock method applied to the 2 components nonretarded case (the NR2 objects) is that the same Haydock coefficients may be used for arbitrary compositions, i.e., they don't have to be recalculated when eps[AB] are modified. That was the logic for using an evaluate method, the idea being that on the first call the Haydock coefficients would be calculated (this is the most expensive part of the calculation), but on subsequent calls, they would be recycled. How would this work if a new object is built for every pair of eps[AB]? On the other hand, I'm still somewhat worried about the states being a pdl mapped to a file. Currently there are options to don't keep states except for the current and neighbor states (to conserve memory, when other states are not needed), to keep them in memory (for speed) or to keep them in a file. In the last two cases the may be accessed through an iterator. If they become a single pdl, will there still be three choices? I tested some time ago the file mapped pdl's, and I don't recall the details, but I remember that I was unable to create a large mapped pdl although it was smaller than the available memory. I will have to search my notes or experiment again, but if true, this could be an issue, as the size of the states pdl can become huge. |
As I understand it, those coefficients live in the
Please do so! The whole idea behind File::Map is that you can memory-map any file, no matter how large, immediately and without consuming (or being limited by) physical RAM. If you're saying you have found this not to be the case, that's a bug that can be fixed if you can show me how to reproduce it :-) |
The above works instantly, and creates a 4GB file (taking up no physical RAM). I did try with 1000^3 (8GB of data) and it crashed with an "out of memory" which makes sense because the machine only has 2GB of physical RAM and 2GB of VM. I then did these sanity-check operations:
If using Linux and Bash, please make sure your |
You are right, so the user would recycle the already evaluated nr for succesive calculations (I have not tested yet recycling evaluated AllH's, but I guess they should work). Nevertheless, what would happen for EpsTensor, where the nr array is built from the geometry upon initialization? Do you contemplate the user providing an already evaluated nr?
I don't know if this is what you intend to use, but consider: pdl> $PDL::BIGPDL=1
pdl> use PDL::IO::FastRaw
pdl> $a=mapfraw("rem", {Creat=>1,Dims=>[3,200,200,200,100], Datatype=>9})
Out of memory! So I couldn't create a pdl that corresponds to the 100 states as 3D complex vector fields on a modest 200x200x200 grid. Curiously, I can create the corresponding pdl without mapfraw for, say, 30 states pdl> $a= zeroes(cdouble,3,200,200,200,30) and it uses about 56% of my memory (on a 16Gb laptop). If I create the pdl with mapfraw the program uses less than 0.1% and is much much faster. So my uneducated guess is that mapfraw reserves the memory it would require to store the whole ndarray and the liberates it, but if it can't reserve it, it fails. |
Ok. So you did tests similar to what I was doing. Going beyond the available memory would be quite slow, but is possible with the previous 'iterator' solution. But it seems not to be possible with the mapfraw solution. This worries me for 3D calculations, as they may become unfeasible. |
You could go:
This facility comes "for free" as part of Moo*, because
I'll answer the mapfraw point separately. |
That would also be my uneducated guess! I will take a look at this now. |
Ok. In this case, init_arg=>undef would have to go.
The 'but' method seems a clean solution, so you don't have to carry all the other initialization parameters. Is this kind of solution in common usage? I didn't understand your remark above about the init_arg=>undef. |
You've won a valuable prize! A new version of PDL with a fix will be on its way to CPAN as soon as it's passed CI. I knew there'd be at least one problem revealed by actually using it here! (There are also some other tweaks to the mmap-type stuff which I'd already made but not released yet) |
Quite right.
I think you did in fact understand it, because you spotted the accidental contradiction, sorry. The |
This has now been uploaded as 2.056 (which is quite a nice number, sort of), and on my machine I can now |
Ha! You're fast! Thanks for the prize! I appreciate it |
Do you find it works right with |
I'm just installing 2.056, so I haven't tested the new mapfraw, but after removing the limitation on the size of mapped ndarrays I guess memory mapping will be a good solution. Also, I'm content with the nr reuse, though my colleagues will have to change their codes. Maybe a temporal 'evaluate' that dies with a useful message would facilitate the transition. |
As I'm re-reading the code again after making this |
I just tested the new mapfraw. Seems to work nicely and fast. |
Also, more immediately: I don't see a need for a dummy |
Great!
Yes, there might be some adjustments needed. My feeling however is it will be surprisingly small, and then... threading! Multi-processing! ;-) |
True... |
That'll be nice. |
|
Ah, of course - the BIGPDL check is not done unless it's memory! |
|
It's a sign of the brief allocation of memory that was being done. Not so mysterious, but still bad ;-) |
The most recent commit renames the |
The latest commit, switching from Moose to Moo (a lighter-weight system), makes the tests go from taking 12-13secs, to 9-10secs, which aids development. |
d78ef1c
to
98152ce
Compare
The most recent commit makes a Roles::Field. |
@wlmb There are a couple more changes I believe would be valuable, but I'd prefer to get your feedback on these changes so far first? |
Dear Ed,
On Sun, Dec 26, 2021 at 03:06:15PM -0800, mohawk2 wrote:
@wlmb There are a couple more changes I believe would be valuable, but I'd prefer to get your feedback on these changes so far first?
Thanks! I'm sorry I have not reviewed all your previous changes. It
was a busy end of semester. I expect to look at the previous changes
carefully these coming days.
Best regards and my best wishes.
Luis
…
--
Reply to this email directly or view it on GitHub:
#23 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
--
o
W. Luis Mochán, | tel:(52)(777)329-1734 /<(*)
Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\
Av. Universidad s/n CP 62210 | (*)/\/ \
Cuernavaca, Morelos, México | ***@***.*** /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB
|
No problem! Glad to hear back from you already and I look forward to your thoughts when you have time. My hope is that these changes so far are acceptable, though naturally you may have questions and/or spot things I missed. Once this change-set is acceptable, then I'll look at the dimension-reordering stuff (basically, the aim is to avoid needing to move dimensions around for threading, which shows the dimension layout wasn't right yet). |
@wlmb Could you take a look at these changes? :-) |
No description provided.