\hypertarget{kdtrsm_8c}{}\section{src/kdtrsm.c File Reference}
\label{kdtrsm_8c}\index{src/kdtrsm.\+c@{src/kdtrsm.\+c}}


L\+A\+Ss-\/\+D\+D\+Ss kdtrsm routine.  


{\ttfamily \#include \char`\"{}../include/lass.\+h\char`\"{}}\\*
Include dependency graph for kdtrsm.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{kdtrsm_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
enum L\+A\+S\+S\+\_\+\+R\+E\+T\+U\+RN \hyperlink{kdtrsm_8c_addfda795c19230c16da674648de83a5c}{kdtrsm} (enum D\+D\+S\+S\+\_\+\+S\+I\+DE S\+I\+DE, enum D\+D\+S\+S\+\_\+\+U\+P\+LO U\+P\+LO, enum D\+D\+S\+S\+\_\+\+T\+R\+A\+NS T\+R\+A\+N\+S\+\_\+A, enum D\+D\+S\+S\+\_\+\+D\+I\+AG D\+I\+AG, int M, int N, const double A\+L\+P\+HA, double $\ast$A, int L\+DA, double $\ast$B, int L\+DB)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
L\+A\+Ss-\/\+D\+D\+Ss kdtrsm routine. 

L\+A\+Ss-\/\+D\+D\+Ss is a software package provided by\+: Barcelona Supercomputing Center -\/ Centro Nacional de Supercomputacion

\begin{DoxyAuthor}{Author}
Pedro Valero-\/\+Lara \href{mailto:pedro.valero@bsc.es}{\tt pedro.\+valero@bsc.\+es} 

Boro Sofranac \href{mailto:boro.sofranac@bsc.es}{\tt boro.\+sofranac@bsc.\+es} 
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
2017-\/12-\/14   
\end{DoxyDate}


\subsection{Function Documentation}
\index{kdtrsm.\+c@{kdtrsm.\+c}!kdtrsm@{kdtrsm}}
\index{kdtrsm@{kdtrsm}!kdtrsm.\+c@{kdtrsm.\+c}}
\subsubsection[{\texorpdfstring{kdtrsm(enum D\+D\+S\+S\+\_\+\+S\+I\+D\+E S\+I\+D\+E, enum D\+D\+S\+S\+\_\+\+U\+P\+L\+O U\+P\+L\+O, enum D\+D\+S\+S\+\_\+\+T\+R\+A\+N\+S T\+R\+A\+N\+S\+\_\+\+A, enum D\+D\+S\+S\+\_\+\+D\+I\+A\+G D\+I\+A\+G, int M, int N, const double A\+L\+P\+H\+A, double $\ast$\+A, int L\+D\+A, double $\ast$\+B, int L\+D\+B)}{kdtrsm(enum DDSS_SIDE SIDE, enum DDSS_UPLO UPLO, enum DDSS_TRANS TRANS_A, enum DDSS_DIAG DIAG, int M, int N, const double ALPHA, double *A, int LDA, double *B, int LDB)}}]{\setlength{\rightskip}{0pt plus 5cm}enum L\+A\+S\+S\+\_\+\+R\+E\+T\+U\+RN kdtrsm (
\begin{DoxyParamCaption}
\item[{enum D\+D\+S\+S\+\_\+\+S\+I\+DE}]{S\+I\+DE, }
\item[{enum D\+D\+S\+S\+\_\+\+U\+P\+LO}]{U\+P\+LO, }
\item[{enum D\+D\+S\+S\+\_\+\+T\+R\+A\+NS}]{T\+R\+A\+N\+S\+\_\+A, }
\item[{enum D\+D\+S\+S\+\_\+\+D\+I\+AG}]{D\+I\+AG, }
\item[{int}]{M, }
\item[{int}]{N, }
\item[{const double}]{A\+L\+P\+HA, }
\item[{double $\ast$}]{A, }
\item[{int}]{L\+DA, }
\item[{double $\ast$}]{B, }
\item[{int}]{L\+DB}
\end{DoxyParamCaption}
)}\hypertarget{kdtrsm_8c_addfda795c19230c16da674648de83a5c}{}\label{kdtrsm_8c_addfda795c19230c16da674648de83a5c}
Solves one of the matrix equations\+: \begin{DoxyVerb}op( A ) * X = ALPHA * B, or X * op( A ) = ALPHA * B
\end{DoxyVerb}


where op( A ) is one of\+: \begin{DoxyVerb}op( A ) = A      or
op( A ) = A**T 
\end{DoxyVerb}


A\+L\+P\+HA is a scalar, X and B are M by N matrices, A is a unit, or non-\/unit, upper or lower triangular matrix. The matrix X is overwritten on B


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em S\+I\+DE} & enum D\+D\+S\+S\+\_\+\+S\+I\+DE. S\+I\+DE specifies the position of the triangular A matrix in the operations\+:
\begin{DoxyItemize}
\item Left\+: op( A ) $\ast$ X = A\+L\+P\+HA $\ast$ B.
\item Right\+: X $\ast$ op( A ) = A\+L\+P\+HA $\ast$ B.
\end{DoxyItemize}\\
\hline
\mbox{\tt in}  & {\em U\+P\+LO} & enum D\+D\+S\+S\+\_\+\+U\+P\+LO. U\+P\+LO specifies the form of A is stored\+:
\begin{DoxyItemize}
\item Lower\+: Lower triangle of A is stored. The upper traingular part is not referenced.
\item Upper\+: Upper triangle of A is stored. The lower triangular part is not referenced.
\end{DoxyItemize}\\
\hline
\mbox{\tt in}  & {\em T\+R\+A\+N\+S\+\_\+A} & enum D\+D\+S\+S\+\_\+\+T\+R\+A\+NS. T\+R\+A\+N\+S\+\_\+A specifies the form of op( A ) to be used\+:
\begin{DoxyItemize}
\item No\+Trans\+: op( A ) = A.
\item Trans\+: op( A ) = A$\ast$$\ast$T.
\end{DoxyItemize}\\
\hline
\mbox{\tt in}  & {\em D\+I\+AG} & enum D\+D\+S\+S\+\_\+\+D\+I\+AG. D\+I\+AG specifies whether or not A is unit triangular as follows\+:
\begin{DoxyItemize}
\item Unit\+: A is assumed to be unit triangular.
\item Non\+Unit\+: A is not assumed to be unit triangular.
\end{DoxyItemize}\\
\hline
\mbox{\tt in}  & {\em M} & int. M specifies the number of rows of B. M must be at least zero.\\
\hline
\mbox{\tt in}  & {\em N} & int. N specifies the number of columns of B. N must be at least zero.\\
\hline
\mbox{\tt in}  & {\em A\+L\+P\+HA} & double. A\+L\+P\+HA specifies the scalar alpha.\\
\hline
\mbox{\tt in}  & {\em A} & double $\ast$. A is a pointer to a matrix of dimension K by K, where K is M when S\+I\+DE = Left and is N otherwise. When U\+P\+LO = Uppper the strictly lower triangular part of A is not referenced and when U\+P\+LO = Lower the strictly upper triangular part of A is not referenced. Note that when D\+I\+AG = Unit, the diagonal elements of A are not referenced either, but are assumed to be unity.\\
\hline
\mbox{\tt in}  & {\em L\+DA} & int. L\+DA specifies the number of columns of A ( row-\/major order ). When S\+I\+DE = Left then L\+DA must be at least max( 1, M ), otherwise L\+DA must be at least max( 1, N ).\\
\hline
\mbox{\tt in,out}  & {\em B} & double $\ast$. B is a pointer to a matrix of dimension M by N. On exit the matrix B is overwritten by the solution matrix X.\\
\hline
\mbox{\tt in}  & {\em L\+DB} & int. L\+DB specifies the number of columns of B ( row-\/major order ). L\+DB must be at least max( 1, N ).\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Success} & successful exit \\
\hline
{\em No\+Success} & unsuccessful exit\\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
ddss\+\_\+tile 

ddss\+\_\+flat2tiled 

\hyperlink{lass_8h_afc5c48ad2172946afab6c9e989c4e81a}{ddss\+\_\+dsymflat2tiled} 

ddss\+\_\+tiled2flat 
\end{DoxySeeAlso}


Definition at line 123 of file kdtrsm.\+c.



References ddss\+\_\+dflat2tiled(), ddss\+\_\+dsymflat2tiled(), ddss\+\_\+dtiled2flat(), and ddss\+\_\+tile\+\_\+size().



Referenced by ddss\+\_\+dtrsm().


\begin{DoxyCode}
128 \{
129 
130     \textcolor{comment}{// Local variables}
131     \textcolor{keywordtype}{int} k;
132     \textcolor{keywordtype}{int} mt, nt;
133     \textcolor{keywordtype}{int} ki, ni, mi, nni, mmi;
134     \textcolor{keywordtype}{int} Am, An;
135     \textcolor{keywordtype}{int} Bm, Bn;
136     \textcolor{keywordtype}{int} tile\_size\_m;
137     \textcolor{keywordtype}{int} tile\_size\_mm;
138     \textcolor{keywordtype}{int} tile\_size\_n;
139     \textcolor{keywordtype}{int} tile\_size\_nn;
140     \textcolor{keywordtype}{int} tile\_size\_k;
141     \textcolor{keywordtype}{double} alpha;
142 
143     \textcolor{comment}{// Number of tiles}
144     \textcolor{keywordflow}{if} ( M % TILE\_SIZE == 0 ) 
145     \{
146         mt = M / TILE\_SIZE;
147     \} 
148     \textcolor{keywordflow}{else} 
149     \{
150         mt = ( M / TILE\_SIZE ) + 1;
151     \}
152 
153     \textcolor{keywordflow}{if} ( N % TILE\_SIZE == 0 ) 
154     \{
155         nt = N / TILE\_SIZE;
156     \} 
157     \textcolor{keywordflow}{else} 
158     \{
159         nt = ( N / TILE\_SIZE ) + 1;
160     \}
161 
162     \textcolor{comment}{/****************************}
163 \textcolor{comment}{     --Tile matrices declaration--}
164 \textcolor{comment}{     ****************************/}
165 
166     \textcolor{keywordflow}{if} ( SIDE == Left ) 
167     \{
168         Am = An = mt;
169         k = M;
170     \} 
171     \textcolor{keywordflow}{else} 
172     \{
173         Am = An = nt;
174         k = N;
175     \}
176 
177     Bm = mt;
178     Bn = nt;
179 
180     \textcolor{comment}{/***************************}
181 \textcolor{comment}{     --Tile matrices allocation--}
182 \textcolor{comment}{     ***************************/}
183 
184     double ( *TILE\_A )[An][TILE\_SIZE * TILE\_SIZE] = malloc(
185              Am * An * TILE\_SIZE * TILE\_SIZE * \textcolor{keyword}{sizeof}( \textcolor{keywordtype}{double} ) );
186 
187     \textcolor{keywordflow}{if} ( TILE\_A == NULL ) 
188     \{
189         fprintf( stderr, \textcolor{stringliteral}{"Failure in ddss\_dtile\_alloc for matrix TILE\_A\(\backslash\)n"} );
190         \textcolor{keywordflow}{return} NoSuccess;
191     \}
192 
193     double ( *TILE\_B )[Bn][TILE\_SIZE * TILE\_SIZE] = malloc(
194              Bm * Bn * TILE\_SIZE * TILE\_SIZE * \textcolor{keyword}{sizeof}( \textcolor{keywordtype}{double} ) );
195 
196     \textcolor{keywordflow}{if} ( TILE\_B == NULL ) 
197     \{
198         fprintf( stderr, \textcolor{stringliteral}{"Failure in ddss\_dtile\_alloc for matrix TILE\_B\(\backslash\)n"} );
199         \textcolor{keywordflow}{return} NoSuccess;
200     \}
201 
202     \textcolor{comment}{/*********************************************}
203 \textcolor{comment}{     --From flat data layout to tiled data layout-- }
204 \textcolor{comment}{     *********************************************/}
205 
206     \textcolor{comment}{// From flat matrix A to tile matrix TILE\_A}
207     \hyperlink{ddss__flat2tiled_8c_afc5c48ad2172946afab6c9e989c4e81a}{ddss\_dsymflat2tiled}( k, k, A, LDA, Am, An, TILE\_A, UPLO );
208 
209     \textcolor{comment}{// From flat matrix B to tile matrix TILE\_B }
210     \hyperlink{ddss__flat2tiled_8c_ab411e9b05a203c7905f0285ef4200a9e}{ddss\_dflat2tiled}( M, N, B, LDB, Bm, Bn, TILE\_B );
211 
212     \textcolor{comment}{/*************}
213 \textcolor{comment}{     --DTRSM tile--}
214 \textcolor{comment}{     *************/}
215 
216     \textcolor{keywordflow}{if} ( SIDE == Left ) 
217     \{
218         \textcolor{keywordflow}{if} ( UPLO == Upper ) 
219         \{
220             \textcolor{comment}{// --SIDE = Left & UPLO = Upper & TRANS\_A = NoTrans-- }
221             \textcolor{keywordflow}{if} ( TRANS\_A == NoTrans ) 
222             \{
223                 \textcolor{keywordflow}{for} ( ki = mt - 1; ki >= 0; ki-- ) 
224                 \{
225                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, ki );
226                     \textcolor{keywordflow}{if} ( ki == mt - 1 ) 
227                     \{
228                         alpha = ALPHA;
229                     \}
230                     \textcolor{keywordflow}{else} 
231                     \{
232                         alpha = 1.0;    
233                     \}
234 
235                     \textcolor{keywordflow}{for} ( ni = 0; ni < nt; ni++ ) 
236                     \{
237                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );
238 
239 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
240 \textcolor{preprocessor}{                            inout( TILE\_B[ki][ni] ) \(\backslash\)}
241 \textcolor{preprocessor}{                            shared( TILE\_A, TILE\_B ) \(\backslash\)}
242 \textcolor{preprocessor}{                            firstprivate( ki, ni ) \(\backslash\)}
243 \textcolor{preprocessor}{                            label( dtrsm )}
244                         cblas\_dtrsm( CblasRowMajor,
245                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
246                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
247                                      ( CBLAS\_DIAG ) DIAG,
248                                      tile\_size\_k, 
249                                      tile\_size\_n,
250                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
251                                             TILE\_B[ki][ni], tile\_size\_n );
252                     \}
253 
254                     \textcolor{keywordflow}{for} ( mi = ki - 1; mi >= 0; mi-- ) 
255                     \{
256                         tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
257                         \textcolor{keywordflow}{for} ( nni = 0; nni < nt; nni++ ) 
258                         \{
259                             tile\_size\_nn = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, nni );
260 
261 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[mi][ki] ) \(\backslash\)}
262 \textcolor{preprocessor}{                                in( TILE\_B[ki][nni] ) \(\backslash\)}
263 \textcolor{preprocessor}{                                inout( TILE\_B[mi][nni] ) \(\backslash\)}
264 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
265 \textcolor{preprocessor}{                                firstprivate( ki, mi, nni ) \(\backslash\)}
266 \textcolor{preprocessor}{                                label( dgemm )}
267                             cblas\_dgemm( CblasRowMajor,
268                                          CblasNoTrans, CblasNoTrans,
269                                          tile\_size\_m, 
270                                          tile\_size\_nn, 
271                                          tile\_size\_k,
272                                          -1.0,  TILE\_A[mi][ki],  tile\_size\_k,
273                                                 TILE\_B[ki][nni], tile\_size\_nn,
274                                          alpha, TILE\_B[mi][nni], tile\_size\_nn );
275                         \}
276                     \}
277                 \}
278             \}
279 
280             \textcolor{comment}{// --SIDE = Left & UPLO = Upper & TRANS\_A = Trans-- }
281             \textcolor{keywordflow}{else} 
282             \{
283                 \textcolor{keywordflow}{for} ( ki = 0; ki < mt; ki++ ) 
284                 \{
285                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, ki );
286                     \textcolor{keywordflow}{if} ( ki == 0 ) 
287                     \{
288                         alpha = ALPHA;
289                     \} 
290                     \textcolor{keywordflow}{else} 
291                     \{
292                         alpha = 1.0;
293                     \}
294 
295                     \textcolor{keywordflow}{for} ( ni = 0; ni < nt; ni++ ) 
296                     \{
297                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );
298 
299 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
300 \textcolor{preprocessor}{                            inout( TILE\_B[ki][ni] ) \(\backslash\)}
301 \textcolor{preprocessor}{                            shared( TILE\_A, TILE\_B ) \(\backslash\)}
302 \textcolor{preprocessor}{                            firstprivate( ki, ni ) \(\backslash\)}
303 \textcolor{preprocessor}{                            label( dtrsm )}
304                         cblas\_dtrsm( CblasRowMajor,
305                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
306                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
307                                      ( CBLAS\_DIAG ) DIAG,
308                                      tile\_size\_k, 
309                                      tile\_size\_n,
310                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
311                                             TILE\_B[ki][ni], tile\_size\_n );
312                     \}
313 
314                     \textcolor{keywordflow}{for} ( mi = ki + 1; mi < mt; mi++ )
315                     \{   
316                         tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
317                         \textcolor{keywordflow}{for} ( nni = 0; nni < nt; nni++ ) 
318                         \{
319                             tile\_size\_nn = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, nni );
320                 
321 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[ki][mi]) \(\backslash\)}
322 \textcolor{preprocessor}{                                in( TILE\_B[ki][nni] ) \(\backslash\)}
323 \textcolor{preprocessor}{                                inout(  TILE\_B[mi][nni] ) \(\backslash\)}
324 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
325 \textcolor{preprocessor}{                                firstprivate( ki, mi, nni ) \(\backslash\)}
326 \textcolor{preprocessor}{                                label( dgemm )}
327                             cblas\_dgemm( CblasRowMajor,
328                                          CblasTrans, CblasNoTrans,
329                                          tile\_size\_m, 
330                                          tile\_size\_nn, 
331                                          tile\_size\_k,
332                                          -1.0,  TILE\_A[ki][mi],  tile\_size\_m,
333                                                 TILE\_B[ki][nni], tile\_size\_nn,
334                                          alpha, TILE\_B[mi][nni], tile\_size\_nn );
335                         \}
336                     \}
337                 \}
338             \}
339         \}
340 
341         \textcolor{comment}{// --SIDE = Left & UPLO = Lower & TRANS\_A = NoTrans--  }
342         \textcolor{keywordflow}{else} 
343         \{
344             \textcolor{keywordflow}{if} ( TRANS\_A == NoTrans ) 
345             \{
346                 \textcolor{keywordflow}{for} ( ki = 0; ki < mt; ki++ )
347                 \{
348                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, ki );
349                     \textcolor{keywordflow}{if} ( ki == 0 )
350                     \{
351                         alpha = ALPHA;      
352                     \} 
353                     \textcolor{keywordflow}{else} 
354                     \{
355                         alpha = 1.0;    
356                     \}
357 
358                     \textcolor{keywordflow}{for} ( ni = 0; ni < nt; ni++ )
359                     \{
360                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );
361 
362 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
363 \textcolor{preprocessor}{                            inout(  TILE\_B[ki][ni] ) \(\backslash\)}
364 \textcolor{preprocessor}{                            shared( TILE\_A, TILE\_B ) \(\backslash\)}
365 \textcolor{preprocessor}{                            firstprivate( ki, ni ) \(\backslash\)}
366 \textcolor{preprocessor}{                            label( dtrsm )}
367                         cblas\_dtrsm( CblasRowMajor,
368                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
369                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
370                                      ( CBLAS\_DIAG ) DIAG,
371                                      tile\_size\_k,
372                                      tile\_size\_n,
373                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
374                                             TILE\_B[ki][ni], tile\_size\_n );
375 
376                     \}
377                     \textcolor{keywordflow}{for} ( nni = 0; nni < nt; nni++ ) 
378                     \{
379                         tile\_size\_nn = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, nni );
380             
381                         \textcolor{keywordflow}{for} ( mi = ki + 1; mi < mt; mi++ )
382                         \{
383                         
384                             tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
385                         
386 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[mi][ki] ) \(\backslash\)}
387 \textcolor{preprocessor}{                                in( TILE\_B[ki][nni] ) \(\backslash\)}
388 \textcolor{preprocessor}{                                inout( TILE\_B[mi][nni] ) \(\backslash\)}
389 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
390 \textcolor{preprocessor}{                                firstprivate( ki, mi, nni ) \(\backslash\)}
391 \textcolor{preprocessor}{                                label( dgemm )}
392                             cblas\_dgemm( CblasRowMajor,
393                                          CblasNoTrans, CblasNoTrans,
394                                          tile\_size\_m,
395                                          tile\_size\_nn,
396                                          tile\_size\_k,
397                                          -1.0,   TILE\_A[mi][ki],  tile\_size\_k,
398                                                 TILE\_B[ki][nni], tile\_size\_nn,
399                                          alpha, TILE\_B[mi][nni], tile\_size\_nn );
400                         \}
401                     \}
402                 \}
403             \}
404 
405             \textcolor{comment}{// --SIDE = Left & UPLO = Lower & TRANS\_A = Trans--    }
406             \textcolor{keywordflow}{else} 
407             \{
408                 \textcolor{keywordflow}{for} ( ki = mt - 1; ki >= 0; ki-- )
409                 \{   
410                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, ki );
411                     \textcolor{keywordflow}{if} ( ki == mt - 1 )
412                     \{
413                         alpha = ALPHA;  
414                     \} 
415                     \textcolor{keywordflow}{else}
416                     \{
417                         alpha = 1.0;
418                     \}
419 
420                     \textcolor{keywordflow}{for} ( ni = 0; ni < nt; ni++ )
421                     \{   
422                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );
423 
424 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
425 \textcolor{preprocessor}{                            inout( TILE\_B[ki][ni] ) \(\backslash\)}
426 \textcolor{preprocessor}{                            shared( TILE\_A, TILE\_B ) \(\backslash\)}
427 \textcolor{preprocessor}{                            firstprivate( ki, ni ) \(\backslash\)}
428 \textcolor{preprocessor}{                            label( dtrsm )}
429                         cblas\_dtrsm( CblasRowMajor,
430                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
431                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
432                                      ( CBLAS\_DIAG ) DIAG,
433                                      tile\_size\_k,
434                                      tile\_size\_n,
435                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
436                                             TILE\_B[ki][ni], tile\_size\_n );
437                     \}
438 
439                     \textcolor{keywordflow}{for} ( mi = ki - 1; mi >= 0; mi-- ) 
440                     \{
441                         tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
442                         \textcolor{keywordflow}{for} ( nni = 0; nni < nt; nni++ ) 
443                         \{
444                             tile\_size\_nn = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, nni );
445                             
446 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[ki][mi] ) \(\backslash\)}
447 \textcolor{preprocessor}{                                in( TILE\_B[ki][nni] ) \(\backslash\)}
448 \textcolor{preprocessor}{                                inout(  TILE\_B[mi][nni] ) \(\backslash\)}
449 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
450 \textcolor{preprocessor}{                                firstprivate( ki, mi, nni ) \(\backslash\)}
451 \textcolor{preprocessor}{                                label( dgemm )}
452                             cblas\_dgemm( CblasRowMajor,
453                                          CblasTrans, CblasNoTrans,
454                                          tile\_size\_m,
455                                          tile\_size\_nn,
456                                          tile\_size\_k,
457                                          -1.0,  TILE\_A[ki][mi],  tile\_size\_m,
458                                                 TILE\_B[ki][nni], tile\_size\_nn,
459                                          alpha, TILE\_B[mi][nni], tile\_size\_nn );
460                         \}
461                     \}
462                 \}
463             \}
464         \}
465     \}
466 
467     \textcolor{comment}{// --SIDE = Right & UPLO = Upper & TRANS\_A = NoTrans--   }
468     \textcolor{keywordflow}{else}
469     \{
470         \textcolor{keywordflow}{if} ( UPLO == Upper )
471         \{
472             \textcolor{keywordflow}{if} ( TRANS\_A == NoTrans )
473             \{   
474                 \textcolor{keywordflow}{for} ( ki = 0; ki < nt; ki++ )
475                 \{
476                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ki );
477                     \textcolor{keywordflow}{if} ( ki == 0 )
478                     \{
479                         alpha = ALPHA;                      
480                     \} 
481                     \textcolor{keywordflow}{else}
482                     \{
483                         alpha = 1.0;                    
484                     \}
485 
486                     \textcolor{keywordflow}{for} ( mi = 0; mi < mt; mi++ ) 
487                     \{       
488                         tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
489 
490 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
491 \textcolor{preprocessor}{                            inout(  TILE\_B[mi][ki] ) \(\backslash\)}
492 \textcolor{preprocessor}{                            shared( TILE\_A, TILE\_B ) \(\backslash\)}
493 \textcolor{preprocessor}{                            firstprivate( ki, mi ) \(\backslash\)}
494 \textcolor{preprocessor}{                            label( dtrsm )}
495                         cblas\_dtrsm( CblasRowMajor,
496                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
497                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
498                                      ( CBLAS\_DIAG ) DIAG,
499                                      tile\_size\_m,
500                                      tile\_size\_k,
501                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
502                                             TILE\_B[mi][ki], tile\_size\_k );
503                     \}
504 
505                     \textcolor{keywordflow}{for} ( ni = ki + 1; ni < nt; ni++ ) 
506                     \{   
507                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );
508                         \textcolor{keywordflow}{for} ( mmi = 0; mmi < mt; mmi++ ) 
509                         \{
510                             tile\_size\_mm = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mmi );
511                             
512 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[ki][ni] ) \(\backslash\)}
513 \textcolor{preprocessor}{                                in( TILE\_B[mmi][ki] ) \(\backslash\)}
514 \textcolor{preprocessor}{                                inout(  TILE\_B[mmi][ni] ) \(\backslash\)}
515 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
516 \textcolor{preprocessor}{                                firstprivate( ki, ni, mmi ) \(\backslash\)}
517 \textcolor{preprocessor}{                                label( dgemm )}
518                             cblas\_dgemm( CblasRowMajor,
519                                          CblasNoTrans, CblasNoTrans,
520                                          tile\_size\_mm,
521                                          tile\_size\_n,
522                                          tile\_size\_k,
523                                          -1.0,  TILE\_B[mmi][ki], tile\_size\_k,
524                                                 TILE\_A[ki][ni],  tile\_size\_n,
525                                          alpha, TILE\_B[mmi][ni], tile\_size\_n );
526                         \}
527                     \}
528                 \}
529             \}
530             \textcolor{comment}{// --SIDE = Right & UPLO = Upper & TRANS\_A = Trans-- }
531             \textcolor{keywordflow}{else}
532             \{
533                 \textcolor{keywordflow}{for} ( ki = nt - 1; ki >= 0; ki-- ) 
534                 \{   
535                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ki );
536                     \textcolor{keywordflow}{if} ( ki == nt - 1 )
537                     \{
538                         alpha = ALPHA;  
539                     \} 
540                     \textcolor{keywordflow}{else}
541                     \{
542                         alpha = 1.0;
543                     \}
544 
545                     \textcolor{keywordflow}{for} ( mi = 0; mi < mt; mi++ )
546                     \{   
547                         tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
548 
549 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
550 \textcolor{preprocessor}{                            inout( TILE\_B[mi][ki] ) \(\backslash\)}
551 \textcolor{preprocessor}{                            shared( TILE\_A, TILE\_B ) \(\backslash\)}
552 \textcolor{preprocessor}{                            firstprivate( ki, mi ) \(\backslash\)}
553 \textcolor{preprocessor}{                            label( dtrsm )}
554                         cblas\_dtrsm( CblasRowMajor,
555                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
556                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
557                                      ( CBLAS\_DIAG ) DIAG,
558                                      tile\_size\_m,
559                                      tile\_size\_k,
560                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
561                                             TILE\_B[mi][ki], tile\_size\_k );
562                     \}
563 
564                     \textcolor{keywordflow}{for} ( ni = ki - 1; ni >= 0; ni-- ) 
565                     \{
566                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );
567                         \textcolor{keywordflow}{for} ( mmi = 0; mmi < mt; mmi++ ) 
568                         \{
569                             tile\_size\_mm = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mmi );
570 
571 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[ni][ki] ) \(\backslash\)}
572 \textcolor{preprocessor}{                                in( TILE\_B[mmi][ki] ) \(\backslash\)}
573 \textcolor{preprocessor}{                                inout( TILE\_B[mmi][ni] ) \(\backslash\)}
574 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
575 \textcolor{preprocessor}{                                firstprivate( ki, ni, mmi ) \(\backslash\)}
576 \textcolor{preprocessor}{                                label( dgemm )}
577                             cblas\_dgemm( CblasRowMajor,
578                                          CblasNoTrans, CblasTrans,
579                                          tile\_size\_mm,
580                                          tile\_size\_n,
581                                          tile\_size\_k,
582                                          -1.0,  TILE\_B[mmi][ki], tile\_size\_k,
583                                                 TILE\_A[ni][ki],  tile\_size\_k,
584                                          alpha, TILE\_B[mmi][ni], tile\_size\_n );
585                         \}
586                     \}
587                 \}
588             \}
589         \}
590 
591         \textcolor{comment}{// --SIDE = Right & UPLO = Lower & TRANS\_A = NoTrans--  }
592         \textcolor{keywordflow}{else}
593         \{
594             \textcolor{keywordflow}{if} ( TRANS\_A == NoTrans )
595             \{
596                 \textcolor{keywordflow}{for} ( ki = nt - 1; ki >= 0; ki-- )
597                 \{
598                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ki );
599                     \textcolor{keywordflow}{if} ( ki == nt - 1 )
600                     \{
601                         alpha = ALPHA;                  
602                     \}
603                     \textcolor{keywordflow}{else}
604                     \{
605                         alpha = 1.0;                    
606                     \}
607 
608                     \textcolor{keywordflow}{for} ( mi = 0; mi < mt; mi++ ) 
609                     \{
610                         tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
611 
612 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
613 \textcolor{preprocessor}{                            inout( TILE\_B[mi][ki] ) \(\backslash\)}
614 \textcolor{preprocessor}{                            shared( TILE\_A, TILE\_B ) \(\backslash\)}
615 \textcolor{preprocessor}{                            firstprivate( ki, mi ) \(\backslash\)}
616 \textcolor{preprocessor}{                            label( dtrsm ) }
617                         cblas\_dtrsm( CblasRowMajor,
618                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
619                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
620                                      ( CBLAS\_DIAG ) DIAG,
621                                      tile\_size\_m,
622                                      tile\_size\_k,
623                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
624                                             TILE\_B[mi][ki], tile\_size\_k );
625                     \}
626 
627                     \textcolor{keywordflow}{for} ( ni = ki - 1; ni >= 0; ni-- ) 
628                     \{                   
629                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );            
630                         \textcolor{keywordflow}{for} ( mmi = 0; mmi < mt; mmi++ ) 
631                         \{   
632                             tile\_size\_mm = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mmi );
633 
634 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[ki][ni] ) \(\backslash\)}
635 \textcolor{preprocessor}{                                in( TILE\_B[mmi][ki] ) \(\backslash\)}
636 \textcolor{preprocessor}{                                inout( TILE\_B[mmi][ni] ) \(\backslash\)}
637 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
638 \textcolor{preprocessor}{                                firstprivate( ki, ni, mmi ) \(\backslash\)}
639 \textcolor{preprocessor}{                                label( dgemm ) }
640                             cblas\_dgemm( CblasRowMajor,
641                                          CblasNoTrans, CblasNoTrans,
642                                          tile\_size\_mm,
643                                          tile\_size\_n,
644                                          tile\_size\_k,
645                                          -1.0,  TILE\_B[mmi][ki], tile\_size\_k,
646                                                 TILE\_A[ki][ni],  tile\_size\_n,
647                                          alpha, TILE\_B[mmi][ni], tile\_size\_n );
648                         \}
649                     \}
650                 \}
651             \}
652         
653             \textcolor{comment}{// --SIDE = Right & UPLO = Lower & TRANS\_A = Trans--  }
654             \textcolor{keywordflow}{else} 
655             \{
656                 \textcolor{keywordflow}{for} ( ki = 0; ki < nt; ki++ ) 
657                 \{
658                     tile\_size\_k = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ki );
659                     \textcolor{keywordflow}{if} ( ki == 0 ) 
660                     \{
661                         alpha = ALPHA;      
662                     \} 
663                     \textcolor{keywordflow}{else} 
664                     \{
665                         alpha = 1.0;        
666                     \}
667 
668                     \textcolor{keywordflow}{for} ( mi = 0; mi < mt; mi++ )  
669                     \{       
670                         tile\_size\_m = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mi );
671 
672 \textcolor{preprocessor}{                        #pragma oss task in( TILE\_A[ki][ki] ) \(\backslash\)}
673 \textcolor{preprocessor}{                            inout( TILE\_B[mi][ki] ) \(\backslash\)}
674 \textcolor{preprocessor}{                            shared( TILE\_A,TILE\_B ) \(\backslash\)}
675 \textcolor{preprocessor}{                            firstprivate( ki, mi ) \(\backslash\)}
676 \textcolor{preprocessor}{                            label( dtrsm )}
677                         cblas\_dtrsm( CblasRowMajor, 
678                                      ( CBLAS\_SIDE ) SIDE, ( CBLAS\_UPLO ) UPLO,
679                                      ( CBLAS\_TRANSPOSE ) TRANS\_A,
680                                      ( CBLAS\_DIAG ) DIAG,
681                                      tile\_size\_m,
682                                      tile\_size\_k,
683                                      alpha, TILE\_A[ki][ki], tile\_size\_k,
684                                             TILE\_B[mi][ki], tile\_size\_k );
685                     \}
686 
687                     \textcolor{keywordflow}{for} ( ni = ki + 1; ni < nt; ni++ ) 
688                     \{
689                         tile\_size\_n = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( N, ni );
690                         \textcolor{keywordflow}{for} ( mmi = 0; mmi < mt; mmi++ ) 
691                         \{
692                             tile\_size\_mm = \hyperlink{ddss__tile_8c_a931442adba78807015ff9a076fb2ae49}{ddss\_tile\_size}( M, mmi );
693 
694 \textcolor{preprocessor}{                            #pragma oss task in( TILE\_A[ni][ki] ) \(\backslash\)}
695 \textcolor{preprocessor}{                                in( TILE\_B[mmi][ki] ) \(\backslash\)}
696 \textcolor{preprocessor}{                                inout(  TILE\_B[mmi][ni] ) \(\backslash\)}
697 \textcolor{preprocessor}{                                shared( TILE\_A, TILE\_B ) \(\backslash\)}
698 \textcolor{preprocessor}{                                firstprivate( ki, ni, mmi ) \(\backslash\)}
699 \textcolor{preprocessor}{                                label( dgemm )}
700                             cblas\_dgemm( CblasRowMajor,
701                                          CblasNoTrans, CblasTrans,
702                                          tile\_size\_mm,
703                                          tile\_size\_n,
704                                          tile\_size\_k,
705                                          -1.0,  TILE\_B[mmi][ki], tile\_size\_k,
706                                                 TILE\_A[ni][ki],  tile\_size\_k,
707                                          alpha, TILE\_B[mmi][ni], tile\_size\_n );
708                         \}
709                     \}
710                 \}
711             \}
712         \}
713     \}
714 
715     \textcolor{comment}{/*********************************************}
716 \textcolor{comment}{     --From tiled data layout to flat data layout-- }
717 \textcolor{comment}{     *********************************************/}
718 
719     \hyperlink{ddss__tiled2flat_8c_aeeb6b69c6b4db8333c660ef6824cdf6a}{ddss\_dtiled2flat}( M, N, B, LDB, Bm, Bn, TILE\_B );
720 
721     \textcolor{comment}{// --Tile matrices free--}
722     free( TILE\_A );
723     free( TILE\_B );
724 
725     \textcolor{keywordflow}{return} Success;
726 
727 \}
\end{DoxyCode}
