Skip to content
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

ENH: Add default factory initialization #26

Merged
merged 1 commit into from Apr 13, 2022

Conversation

tbirdso
Copy link
Contributor

@tbirdso tbirdso commented Mar 7, 2022

Leverages the InitFactory mechanism introduced in ITK commit c266651
to register VkFFT GPU-accelerated implementation classes as the default
backends for ITK FFT classes via the object factory.

With these changes in place, GPU acceleration of ITK FFT image filters is achieved by simply installing the itk-vkfftbackend Python module:

> pip install itk itk-vkfftbackend
> python
>>> import itk
>>> fft_filter = itk.ForwardFFTImageFilter.values()[-1].New()        # base FFT filter instantiated
>>> t1 = itk.VkForwardFFTImageFilter.values()[-1]                  # Prove instance is VkFFT backend with a cast
>>> t1.cast(fft_filter)
<itk.itkVkForwardFFTImageFilterPython.itkVkForwardFFTImageFilterIF3; proxy of <Swig Object of type 'itkVkForwardFFTImageFilterIF3 *' at 0x0000016275980270> >

This PR relies on ITK features that will be available in the ITK 5.3rc04 prerelease, may need to wait for that release in order for CI to pass. I have verified tests pass on my local Windows system when built against the ITK main branch.

Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 🥇

@tbirdso
Copy link
Contributor Author

tbirdso commented Apr 5, 2022

Rebased on master.

Leverages the `InitFactory` mechanism introduced in ITK commit c266651
to register VkFFT GPU-accelerated implementation classes as the default
backends for ITK FFT classes via the object factory.
@tbirdso
Copy link
Contributor Author

tbirdso commented Apr 13, 2022

Linter failure tracked in InsightSoftwareConsortium/ITKSplitComponents#52 and does not originate from these changes.

@tbirdso tbirdso merged commit 283646d into InsightSoftwareConsortium:master Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants