cctbx / cctbx_project

Computational Crystallography Toolbox
https://cci.lbl.gov/docs/cctbx
Other
207 stars 111 forks source link

Memory policy #983

Open nksauter opened 2 months ago

nksauter commented 2 months ago

I've created a failing unit test for new kokkos code in the cuda-context.

If the test "libtbx.python cctbx_project/simtbx/tests/tst_memory_policy.py" can be made to work, the bug has been fixed.

Background information: I'm trying to extend the kokkos exascale_api with new behavior. In the old way, it would allocate large arrays on GPU corresponding to the detector size even if only a few pixels are calculated due to the whitelist (a list of pixels of interest). In the new behavior only enough memory is allocated for the whitelist pixels. I am using C++ templates with template specialization dependent on these two memory-allocation cases. I need this to work so Daniel can move ahead with the SPREAD project, and it is just this last detail that I cannot seem to fix.

dermen commented 1 month ago

@nksauter , just making sure I see where we are: in the latest commit, the test works, but there is duplicated code which we want to avoid ?

nksauter commented 1 month ago

@dermen stand by please with regard to the working tests. I'm going to apply the test to additional cases today to double check. The duplicated code is a serious problem, as my original intent was to implement polymorphism with the minimal lines of code, instead I had to duplicate an entire kernel. Further, I was unable to shrink the size of the m_accumulate_floatimage array as was the original intent.

On Thu, May 9, 2024 at 8:53 AM Derek Mendez @.***> wrote:

@nksauter https://github.com/nksauter , just making sure I see where we are: in the latest commit, the test works, but there is duplicated code which we want to avoid ?

— Reply to this email directly, view it on GitHub https://github.com/cctbx/cctbx_project/pull/983#issuecomment-2102940176, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADQ24VTVVOZLU4RA3OPDZETZBOLXNAVCNFSM6AAAAABF7NPLTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBSHE2DAMJXGY . You are receiving this because you were mentioned.Message ID: @.***>