-
Notifications
You must be signed in to change notification settings - Fork 637
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
Zero thickness dft array output #330
Zero thickness dft array output #330
Conversation
…ents in periodic geometries
…ckness_dft_array_output
For DFT fields defined on a volume of zero thickness in one or more directions, the Similarly, when the |
In case you were unaware, you can usually get a backtrace by running the script through gdb: $ gdb python
(gdb) run path/to/script.py Fee free to send me the script if you want help troubleshooting. |
Thanks, yes, I've been trying this and also running in valgrind. The difficulty is that valgrind produces a massive torrent of errors, almost all of which seem to be referencing python code. At first I thought it might have something to do with python reference counting and the complications of passing C++-allocated objects back to python codes. However, my C++ code does some allocation and deletion, but only on the C++ side, and the allocated/deleted objects are not passed back to python, so it's not clear why I'm getting so many python-related errors. I am wondering if it might have to do with using the raw, low-level |
If you use Python 3.6, you can change the allocator with an environment variable. That plus the python suppressions file here makes the output much easier to parse. I do something like: PYTHONMALLOC=malloc valgrind --track-origins=yes --suppressions=/path/to/valigrind-python.supp python script.py More info here. |
…ckness_dft_array_output
…mpty dimensions; updated python/tests/dft_fields.py unit test to test collapsing of zero-thickness dimensions in DFT arrays and HDF5 output
Fixes #321.
The unit test is passing and I have done some of my own testing, but it would be good to have others take a look at this to check that it does the right thing in some real-world examples, such as perhaps the original example from Erik Shipton that motivated this improvement. One subtlety is that the scheme implemented here assumes that DFT field components are weighted by interpolation weights, so that we need only sum (i.e. not average) the two entries in the two-pixel array straddling a zero-thickness dimension. However, for exporting DFT fields to HDF5 files and in-memory arrays, I actually don't include the interpolation weight; if the weight is built into the field components in the |
…with zero-thickness dimensions
…number of DFT frequencies, causing freezes in the multiprocessor case for HDF5 output of dft fields
Updated to fix a subtlety that caused freezing on some multiprocessor runs for HDF5 output of DFT fields on volumes with zero-thickness dimensions. The issue was that, depending on chunking, processors may not all agree on the number of DFT frequencies, which was problematic for the handling of zero-thickness dimensions in DFT arrays. Fixed by adding an appropriate call to |
src/dft.cpp
Outdated
file = new h5file(filename,h5file::WRITE, false /*parallel*/ ); | ||
} | ||
if (have_empty_dims) | ||
NumFreqs = (int)max_to_all( (double)NumFreqs ); // subtle! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there is a int max_to_all(int in)
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. This call started out as a call to max_to_master
, for which there doesn't appear to be an int
-valued version. For micro-revisions like this, in the interest of speeding the pace of development I really encourage you to go ahead and make the revisions yourself.
…ckness_dft_array_output
…sion with integer casts
* set initial-guess k vector to bloch vector for get_eigenmode_coefficients in periodic geometries * updates to periodic get_eigenmode_coefficient * pulled changes from master * updates * updates * updates * fixed core-dump issue in HDF5 output for DFT fields on volumes with empty dimensions; updated python/tests/dft_fields.py unit test to test collapsing of zero-thickness dimensions in DFT arrays and HDF5 output * tried but failed to fix freezing when calling output_dft for volumes with zero-thickness dimensions * fixed subtlety involving disagreement among processors regarding the number of DFT frequencies, causing freezes in the multiprocessor case for HDF5 output of dft fields * use integer-valued version of max_to_all instead of double-valued version with integer casts
Initial stab at addressing #321