Optimization of the Insight Segmentation and Registration Toolkit (ITK) using Streaming SIMD Extensions (SSE) and OpenMP
This research was conducted as a requirement for obtaining the degree of Master of Science in Informatics by Federal University of Paraná (UFPR).
Author: Tony Alexander Hild (Lattes)
Supervisor: Daniel Weingaertner
Abstract
The image processing has achieved great importance in a world that depends largely on visual stimuli. On this assumption, efficient image processing algorithms are needed to increase productivity in various fields such as medicine, industry and entertainment. For that, this work studied Multiple Instruction, Multiple Data (MIMD) optimization techniques with the use of OpenMP and Single Instruction, Multiple Data (SIMD), with the use of SSE, and implemented these techniques in convolution algorithms, and Canny edge detection algorithm, evaluating their performance. In addition, was proposed changes to the ITK library so that other filters may benefit from the studied optimizations. Was obtained a performance gain up to 7 times on the implementations of convolution algorithms and 16 times on the implementations of the Canny edge detection algorithm. It was concluded that still can achieve performance gains by optimizing algorithms to run on existing processors, with the cost of increased complexity of coding, and reduction of code portability.
Key-words: MIMD, SIMD; SSE; OpenMP; Processamento de Imagens; ITK; Algoritmos de Convolução; Detecção de Bordas; Canny.
Related Topics
- Parallel Computing
- Instruction Level Paralelism
- Image Processing using ITK
- Parallel Image Processing
- Canny Edge Detection
Files
- Dissertation (PDF – Portuguese)
- ITK patch
- ITKOpCannyEdgeDetectionFilter source code
- TKOpCannyEdgeDetectionFilter testes results
- Images dataset
- opConvolution source code
Instructions to build ITKOpCannyEdgeDetectionFilter
Download one of the ITK versions between 3.16 and 3.20 from http://www.itk.org/ITK/resources/software.html.
-
- Apply the patch:
- $ cd /root/directory/where/is/found/InsightToolkit-3.x
- $ wget http://git.io/B_rojg
- $ ln -s InsightToolkit-3.x/Code Original-Code
- $ patch -p0 < itkop.patch
Build ITK:
- $ mkdir InsightTootlkit-3.x-Build
- $ cd InsightTootlkit-3.x-Build
- ccmake ../InsightToolkit-3.x
- add the following flags:
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_CXX_FLAGS:STRING=-fabi-version=5
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG -mfpmath=sse -march=native -mtune=native -ffast-math -ftree-vectorize
CMAKE_EXE_LINKER_FLAGS:STRING=-lrt
CMAKE_INSTALL_PREFIX:PATH=/path/to/patched/install
- $ make
- $ make install
Download the latest ITKOpCannyEdgeDetectionFilter source code from https://github.com/thild/ITKOpCannyEdgeDetectionImageFilter
- $ mkdir ITKOpCannyEdgeDetectionFilter-Build
- $ cd ITKOpCannyEdgeDetectionFilter-Build
- $ ccmake ../ITKOpCannyEdgeDetectionFilter
- add the following flags:
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_CXX_FLAGS:STRING=-fopenmp -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -fabi-version=5
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG -mfpmath=sse -march=native -mtune=native -ffast-math -ftree-vectorize
CMAKE_INSTALL_PREFIX:PATH=/path/to/ITKOpCannyEdgeDetectionImageFilter-Bin
ITK_DIR:PATH=/path/to/patched/install/of/InsightToolkit-3.x
-
- $ make install
- $ cd /path/to/ITKOpCannyEdgeDetectionImageFilter-Bin/bin
- $ wget http://dl.dropbox.com/u/6882617/dataset.tar.gz
- $ tar zxf dataset.tar.gz
- $ cd dataset/bin
- $ ./generate_datasets 6
- $ cd ../../
$ ./opcanny -pt -c test.cfg
Instructions to build opConvolution
Download the latest opConvolution source code from https://github.com/thild/opConvolution
- $ mkdir opConvolution-Build
- $ cd opConvolution-Build
- $ ccmake ../opConvolution
- add the fowlling flags:
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_CXX_FLAGS:STRING=-fopenmp -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -fabi-version=5
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG -mfpmath=sse -march=native -mtune=native -ffast-math -ftree-vectorize
CMAKE_INSTALL_PREFIX:PATH=/path/to/opConvolve-Bin
- $ make install
- $ cd /path/to/opConvolve-Bin/opConvolve-Bin/bin
- $ ./opconv -c test.cfg
Code License
The source code is licensed by MIT/X11 license (http://www.opensource.org/licenses/mit-license.php).
Last Update: 10/02/2012
© 2012, Tony Alexander HIld < tony_hild (at) yahoo (dot) com >