ENH: CPU implementation of CostFxnBendingEnergy class

Builds on !21 (merged), !24 (merged), and !26 (merged), which must be merged first. Also depends on utils!18 (merged).

This MR provides a CPU implementation of the CostFxnBendingEnergy class. This class has been split into three separate files:

  • CostFxnBendingEnergy.cpp - CPU/GPU agnostic class definition.
  • CostFxnBendingEnergyCoreCPU.cpp - CPU implementation of hessian matrix calculation.
  • CostFxnBendingEnergyCoreGPU.cu - CPU implementation of hessian matrix calculation.

As part of this work, a large amount of refactoring of the MMORF code base has taken place, to remove large amounts of duplicated code, and isolate code which is shared across several cost functions. Some of the most notable changes:

  • There were many instances of values of type int being passed into CUDA kernel functions which were expecting unsigned int (and which were not resulting in compiler warnings/errors). This has been addressed in part by adding new member functions to the Volume classes, e.g. std::vector<unsigned int> get_udimensions(), to accompany the existing std::vector<int> get_dimensions().
  • Several CUDA kernel function signatures have been simplified - instead of requiring XYZ dimensions to be passed in as separate arguments, the IndexUtils module now defines ivec3 and uvec3 structs, allowing XYZ dimensions to be passed in as a single function argument.
  • Some new functions and simple data structures have been added to the IndexUtils module, containing logic for calculating row/column ranges of diagonals, calculating spline overlap indices, and for populating a hessian matrix, taking into account symmetry. This functionality was previously duplicated in several cost functions.
  • The VolumeTensor class has been adjusted to use C++ threading for parallelisation instead of OpenMP.
  • The Makefile has been adjusted so that both CPU and GPU versions of the unit tests can be compiled in the same source tree (previously one would have to run make clean before recompiling the tests for a different platform).
Edited by Paul McCarthy

Merge request reports

Loading