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
intbeing passed into CUDA kernel functions which were expectingunsigned int(and which were not resulting in compiler warnings/errors). This has been addressed in part by adding new member functions to theVolumeclasses, e.g.std::vector<unsigned int> get_udimensions(), to accompany the existingstd::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
IndexUtilsmodule now definesivec3anduvec3structs, allowing XYZ dimensions to be passed in as a single function argument. - Some new functions and simple data structures have been added to the
IndexUtilsmodule, 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
VolumeTensorclass has been adjusted to use C++ threading for parallelisation instead of OpenMP. - The
Makefilehas 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 runmake cleanbefore recompiling the tests for a different platform).
Edited by Paul McCarthy