|
7 | 7 | \usepackage{geometry} |
8 | 8 | \geometry{ |
9 | 9 | a4paper, |
10 | | - % left=22mm, |
11 | | - % right=22mm, |
| 10 | + left=22mm, |
| 11 | + right=22mm, |
12 | 12 | top=20mm, |
13 | 13 | bottom=20mm |
14 | 14 | } |
15 | 15 |
|
| 16 | +\usepackage{graphicx} |
| 17 | +\usepackage{subcaption} |
| 18 | + |
| 19 | + |
16 | 20 | % use packages for code listings |
17 | 21 | \usepackage{listings} |
18 | 22 | \usepackage{color} |
|
40 | 44 | language=C |
41 | 45 | } |
42 | 46 |
|
| 47 | +\usepackage{multirow} |
| 48 | + |
43 | 49 | \title{Analyzing Performance of Spatial-Domain Linear Filtering on Multi-Channel Images using OpenMP} |
44 | 50 | \author{R Mukesh} |
45 | 51 | \affil{IIITDM, Kancheepuram} |
|
65 | 71 | The section construct in OpenMP is a way of distributing different independent blocks of codes (each performing a task) to different threads. The sytax of the sections construct is: |
66 | 72 |
|
67 | 73 | \begin{lstlisting}[style=CStyle] |
| 74 | + |
68 | 75 | #pragma omp parallel |
69 | 76 | { |
70 | 77 | #pragma omp sections |
|
92 | 99 | \section{Results \protect\footnote{The experiments were conducted on a computer with 6\textsuperscript{th} Generation Intel(R) Core(TM) i7-6500U Processor (4M Cache, upto 3.10 GHz) and 4GB Single Channel DDR3L 1600M Hz (4GBx1) RAM.}} |
93 | 100 |
|
94 | 101 | The experiments were conducted on a three-channel (red, green and blue) image of size 384x512 for varying size of filter kernels. Each section block performed mean filtering of one channel of the image. |
95 | | - |
96 | | - \section{Infererence} |
| 102 | + |
| 103 | + |
| 104 | +\begin{table}[!htbp] |
| 105 | +\begin{tabular}{|c|c|c|c|c|c|c|} |
| 106 | +\hline |
| 107 | +\multicolumn{1}{|l|}{\multirow{3}{*}{\textbf{Number of Threads}}} & \multicolumn{6}{c|}{\textbf{Execution Time (in seconds)}} \\ \cline{2-7} |
| 108 | +\multicolumn{1}{|l|}{} & \multicolumn{3}{c|}{\textbf{Without Sections}} & \multicolumn{3}{c|}{\textbf{With Sections}} \\ \cline{2-7} |
| 109 | +\multicolumn{1}{|l|}{} & \textbf{3x3 filter} & \textbf{5x5 filter} & \textbf{7x7 filter} & \textbf{3x3 filter} & \textbf{5x5 filter} & \textbf{7x7 filter} \\ \hline |
| 110 | +1 & 0.019927 & 0.054407 & 0.105519 & 0.012785 & 0.021406 & 0.040657 \\ \hline |
| 111 | +2 & 0.010053 & 0.027356 & 0.053044 & 0.008516 & 0.021233 & 0.040614 \\ \hline |
| 112 | +4 & 0.007793 & 0.015653 & 0.032042 & 0.009176 & 0.021220 & 0.040507 \\ \hline |
| 113 | +6 & 0.007935 & 0.020113 & 0.038913 & 0.008530 & 0.021251 & 0.040530 \\ \hline |
| 114 | +8 & 0.007302 & 0.015856 & 0.030059 & 0.008977 & 0.021224 & 0.040493 \\ \hline |
| 115 | +12 & 0.007650 & 0.016432 & 0.034132 & 0.008535 & 0.021301 & 0.040629 \\ \hline |
| 116 | +16 & 0.007699 & 0.017675 & 0.031378 & 0.008656 & 0.021210 & 0.040533 \\ \hline |
| 117 | +20 & 0.007568 & 0.019941 & 0.033236 & 0.008595 & 0.021234 & 0.040508 \\ \hline |
| 118 | +24 & 0.009263 & 0.020189 & 0.031605 & 0.008533 & 0.021246 & 0.040567 \\ \hline |
| 119 | +28 & 0.007752 & 0.025205 & 0.033459 & 0.008351 & 0.021210 & 0.043062 \\ \hline |
| 120 | +32 & 0.008162 & 0.022908 & 0.032675 & 0.010023 & 0.021207 & 0.043040 \\ \hline |
| 121 | +\end{tabular} |
| 122 | +\end{table} |
| 123 | + |
| 124 | +\textbf{Note:} The actual number of concurrently executing threads for the programs with sections is thrice the indicated number since the three sections are executed in parallel, with each section executing the indicated number of threads. |
| 125 | + |
| 126 | +\begin{figure}[!htbp] |
| 127 | + |
| 128 | + \centering |
| 129 | + \begin{subfigure}[!htbp]{\textwidth} |
| 130 | + \centering |
| 131 | + \includegraphics[scale=0.8]{without-sections-3x3-performance} |
| 132 | + \subcaption{Performance of Mean Filtering for 3x3 Filter (without sections)} |
| 133 | + \end{subfigure} |
| 134 | + |
| 135 | + \begin{subfigure}[!htbp]{\textwidth} |
| 136 | + \centering |
| 137 | + \includegraphics[scale=0.8]{without-sections-5x5-performance} |
| 138 | + \subcaption{Performance of Mean Filtering for 5x5 Filter (without sections)} |
| 139 | + \end{subfigure} |
| 140 | + |
| 141 | + \begin{subfigure}[!htbp]{\textwidth} |
| 142 | + \centering |
| 143 | + \includegraphics[scale=0.8]{without-sections-7x7-performance} |
| 144 | + \subcaption{Performance of Mean Filtering for 7x7 Filter (without sections)} |
| 145 | + \end{subfigure} |
| 146 | + |
| 147 | + \caption{Number of Threads vs Execution Time of Mean Filtering for varying filter size in OpenMP without sections} |
| 148 | +\end{figure} |
| 149 | + |
| 150 | +\begin{figure}[!htbp] |
| 151 | + |
| 152 | + \centering |
| 153 | + \begin{subfigure}[!htbp]{\textwidth} |
| 154 | + \centering |
| 155 | + \includegraphics[scale=0.8]{with-sections-3x3-performance} |
| 156 | + \subcaption{Performance of Mean Filtering for 3x3 Filter (with sections)} |
| 157 | + \end{subfigure} |
| 158 | + |
| 159 | + \begin{subfigure}[!htbp]{\textwidth} |
| 160 | + \centering |
| 161 | + \includegraphics[scale=0.8]{with-sections-5x5-performance} |
| 162 | + \subcaption{Performance of Mean Filtering for 5x5 Filter (with sections)} |
| 163 | + \end{subfigure} |
| 164 | + |
| 165 | + \begin{subfigure}[!htbp]{\textwidth} |
| 166 | + \centering |
| 167 | + \includegraphics[scale=0.8]{with-sections-7x7-performance} |
| 168 | + \subcaption{Performance of Mean Filtering for 7x7 Filter (with sections)} |
| 169 | + \end{subfigure} |
| 170 | + |
| 171 | + \caption{Number of Threads vs Execution Time of Mean Filtering for varying filter size in OpenMP with sections} |
| 172 | +\end{figure} |
| 173 | + |
| 174 | +\section{Calculation} |
| 175 | + |
| 176 | +The parallel fraction of the algorithm can be computed using the following equation: |
| 177 | + |
| 178 | +\begin{equation} |
| 179 | + f = \frac{(1-T_p/T_1)}{(1-1/p)} |
| 180 | +\end{equation} |
| 181 | + |
| 182 | +For Mean Filtering using 3x3 filter (without sections), |
| 183 | + \[f = \frac{(1-0.007793/0.019927)}{(1-1/4)} = \textbf{0.811896756 (81.19 \%)}\] |
97 | 184 |
|
| 185 | +For Mean Filtering using 5x5 filter (without sections), |
| 186 | + \[f = \frac{(1-0.015653/0.054407)}{(1-1/4)} = \textbf{0.949730733 (94.97 \%)}\] |
| 187 | + |
| 188 | +For Mean Filtering using 7x7 filter (without sections), |
| 189 | + \[f = \frac{(1-0.032042/0.105519)}{(1-1/4)} = \textbf{0.928452064 (92.85 \%)}\] |
| 190 | + |
| 191 | +\section{Inference} |
| 192 | + |
| 193 | +\begin{enumerate} |
| 194 | + \item Mean Filtering Algorithm for kernel sizes of 3x3, 5x5 and 7x7 has parallel fractions of \textbf{81.19 \%}, \textbf{94.97 \%} and \textbf{92.85 \%} respectively. |
98 | 195 |
|
| 196 | + \item The program with sections outperforms the program without sections because the sections are executed parallely. |
| 197 | + |
| 198 | + \item The sudden spike in execution time for mean filtering using 7x7 kernel size with sections in OpenMP can be attributed the overheads associated with creation, switching and scheduling of large number of threads. |
| 199 | + |
| 200 | +\end{enumerate} |
| 201 | + |
99 | 202 | \end{document} |
0 commit comments