-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType #2712
PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType #2712
Conversation
Does anyone have a suggestion? https://open.cdash.org/viewBuildError.php?type=1&buildid=7436933 (Linux-Build5098-PR2712-BSplineInterpolationWeightFunction-FixedArray-Python) says:
|
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.
itk::FixedArray< double, 9 >
I think fixed arrays etc are wrapped by default only up to dimension 4.
Would it be OK to wrap I think that both |
I am not sure whether anything needs to be done for
|
ITK/Wrapping/WrapITKTypes.cmake Lines 115 to 152 in 34f3db8
|
41fecd6
to
7c79455
Compare
@thewtex Thanks Matt! Please check my attempt to wrap ITK/Wrapping/WrapITKTypes.cmake Lines 152 to 155 in 7c79455
Unfortunately Darwin-Build5152-PR2712-BSplineInterpolationWeightFunction-FixedArray-Python still says:
Do you have more suggestions? |
I guess we need to add something to https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/wrapping/itkFunctionBase.wrap. I am not quite certain what. |
e83f1ef
to
a20047a
Compare
@dzenanz Thanks! I'm not certain at all, but I gave it a try:
ITK/Modules/Core/Common/wrapping/itkFunctionBase.wrap Lines 29 to 31 in 90b6738
I'd be surprised if it would work directly, but we'll see. |
a20047a
to
a5cf690
Compare
Replaced `itk::Array` by `itk::FixedArray` as output type (`OutputType`, `WeightsType`) of `itk::BSplineInterpolationWeightFunction`. Observed ~30% reduction of the runtime duration of a call to `BSplineBaseTransform::TransformPoint`: Going from 1.5 sec. down to 1.0 sec. for 10'000'000 `TransformPoint` function calls. Tested on Windows 10, Visual C++ 2019 64-bit, Release configuration. Allowed `BSplineInterpolationWeightFunction` to be wrapped, by adding extra `FixedArray` and `FunctionBase` wrappings.
Replaced `itk::Array` by `itk::FixedArray` as `ParameterIndexArrayType` of `itk::BSplineBaseTransform`. This is the type of indices, used during BSpline transformations. Suggested by Dženan Zukić. Observed more than 60% reduction of the runtime duration of a call to `BSplineBaseTransform::TransformPoint`: Going from 1.0 sec. down to less than 0.4 sec. for 10'000'000 `TransformPoint` function calls. Tested on Windows 10, Visual C++ 2019 64-bit, Release configuration.
a5cf690
to
bc7c5df
Compare
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.
Replaced `itk::Array2D` by `itk::FixedArray`, used as private `TableType` of `BSplineInterpolationWeightFunction`. This is the type of a table, used internally by its `Evaluate` member function. Declared this table `const`, and initialized the table by an in-class default-member-initializer. Defaulted the default-constructor. Follow-up to pull request InsightSoftwareConsortium#2712 commit bc7c5df "PERF: Use FixedArray for BSplineBaseTransform ParameterIndexArrayType" commit 9bf745b "PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType"
Replaced `itk::Array2D` by `itk::FixedArray`, used as private `TableType` of `BSplineInterpolationWeightFunction`. This is the type of a table, used internally by its `Evaluate` member function. Declared this table `const`, and initialized the table by an in-class default-member-initializer. Defaulted the default-constructor. Follow-up to pull request InsightSoftwareConsortium#2712 commit bc7c5df "PERF: Use FixedArray for BSplineBaseTransform ParameterIndexArrayType" commit 9bf745b "PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType"
Replaced `itk::Array2D` by `itk::FixedArray`, used as private `TableType` of `BSplineInterpolationWeightFunction`. This is the type of a table, used internally by its `Evaluate` member function. Declared this table `const`, and initialized the table by an in-class default-member-initializer. Defaulted the default-constructor. Follow-up to pull request InsightSoftwareConsortium#2712 commit bc7c5df "PERF: Use FixedArray for BSplineBaseTransform ParameterIndexArrayType" commit 9bf745b "PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType"
Replaced `itk::Array2D` by `itk::FixedArray`, used as private `TableType` of `BSplineInterpolationWeightFunction`. This is the type of a table, used internally by its `Evaluate` member function. Declared this table `const`, and initialized the table by an in-class default-member-initializer. Defaulted the default-constructor. Follow-up to pull request InsightSoftwareConsortium#2712 commit bc7c5df "PERF: Use FixedArray for BSplineBaseTransform ParameterIndexArrayType" commit 9bf745b "PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType"
Replaced `itk::Array2D` by `itk::FixedArray`, used as private `TableType` of `BSplineInterpolationWeightFunction`. This is the type of a table, used internally by its `Evaluate` member function. Declared this table `const`, and initialized the table by an in-class default-member-initializer. Defaulted the default-constructor. Follow-up to pull request #2712 commit bc7c5df "PERF: Use FixedArray for BSplineBaseTransform ParameterIndexArrayType" commit 9bf745b "PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType"
Code like `WeightsType weights(n)` does not necessarily construct an object of `n` weights, as it did before ITK 5.3. It now fills a fixed array of weights by value `n`. This behavior change is caused by a change of the definition of `itk::BSplineInterpolationWeightFunction::WeightsType`, by ITK pull request InsightSoftwareConsortium/ITK#2712 commit InsightSoftwareConsortium/ITK@9bf745b "PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType" (merged on 7 September 2021, included with ITK v5.3rc01). Follow-up to pull request #620 commit a0cf523 "COMP: Upgrade ITK from v5.2.0 to v5.3rc03" (merged on 18 February 2022).
Code like `WeightsType weights(n)` does not necessarily construct an object of `n` weights, as it did before ITK 5.3. It now fills a fixed array of weights by value `n`. This behavior change is caused by a change of the definition of `itk::BSplineInterpolationWeightFunction::WeightsType`, by ITK pull request InsightSoftwareConsortium/ITK#2712 commit InsightSoftwareConsortium/ITK@9bf745b "PERF: Use FixedArray for BSplineInterpolationWeightFunction OutputType" (merged on 7 September 2021, included with ITK v5.3rc01). Follow-up to pull request #620 commit a0cf523 "COMP: Upgrade ITK from v5.2.0 to v5.3rc03" (merged on 18 February 2022).
Replaced
itk::Array
byitk::FixedArray
as output type (array ofweights) of
itk::BSplineInterpolationWeightFunction
.Observed a significant improvement of the runtime performance of a call to
itk::BSplineBaseTransform::TransformPoint
: the runtime duration appeared ~30% lower than before, from 1.5 sec. down to 1.0 sec. when callingTransformPoint
10'000'000 times. (Tested using Visual C++ 2019 Release).