root / src / pfact / HPL_pdfact.c @ 8
Historique | Voir | Annoter | Télécharger (6,38 ko)
1 |
/*
|
---|---|
2 |
* -- High Performance Computing Linpack Benchmark (HPL)
|
3 |
* HPL - 2.0 - September 10, 2008
|
4 |
* Antoine P. Petitet
|
5 |
* University of Tennessee, Knoxville
|
6 |
* Innovative Computing Laboratory
|
7 |
* (C) Copyright 2000-2008 All Rights Reserved
|
8 |
*
|
9 |
* -- Copyright notice and Licensing terms:
|
10 |
*
|
11 |
* Redistribution and use in source and binary forms, with or without
|
12 |
* modification, are permitted provided that the following conditions
|
13 |
* are met:
|
14 |
*
|
15 |
* 1. Redistributions of source code must retain the above copyright
|
16 |
* notice, this list of conditions and the following disclaimer.
|
17 |
*
|
18 |
* 2. Redistributions in binary form must reproduce the above copyright
|
19 |
* notice, this list of conditions, and the following disclaimer in the
|
20 |
* documentation and/or other materials provided with the distribution.
|
21 |
*
|
22 |
* 3. All advertising materials mentioning features or use of this
|
23 |
* software must display the following acknowledgement:
|
24 |
* This product includes software developed at the University of
|
25 |
* Tennessee, Knoxville, Innovative Computing Laboratory.
|
26 |
*
|
27 |
* 4. The name of the University, the name of the Laboratory, or the
|
28 |
* names of its contributors may not be used to endorse or promote
|
29 |
* products derived from this software without specific written
|
30 |
* permission.
|
31 |
*
|
32 |
* -- Disclaimer:
|
33 |
*
|
34 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
35 |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
36 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
37 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
|
38 |
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
39 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
40 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
41 |
* DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
42 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
43 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
44 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
45 |
* ---------------------------------------------------------------------
|
46 |
*/
|
47 |
/*
|
48 |
* Include files
|
49 |
*/
|
50 |
#include "hpl.h" |
51 |
|
52 |
#ifdef STDC_HEADERS
|
53 |
void HPL_pdfact
|
54 |
( |
55 |
HPL_T_panel * PANEL |
56 |
) |
57 |
#else
|
58 |
void HPL_pdfact
|
59 |
( PANEL ) |
60 |
HPL_T_panel * PANEL; |
61 |
#endif
|
62 |
{ |
63 |
/*
|
64 |
* Purpose
|
65 |
* =======
|
66 |
*
|
67 |
* HPL_pdfact recursively factorizes a 1-dimensional panel of columns.
|
68 |
* The RPFACT function pointer specifies the recursive algorithm to be
|
69 |
* used, either Crout, Left- or Right looking. NBMIN allows to vary the
|
70 |
* recursive stopping criterium in terms of the number of columns in the
|
71 |
* panel, and NDIV allow to specify the number of subpanels each panel
|
72 |
* should be divided into. Usuallly a value of 2 will be chosen. Finally
|
73 |
* PFACT is a function pointer specifying the non-recursive algorithm to
|
74 |
* to be used on at most NBMIN columns. One can also choose here between
|
75 |
* Crout, Left- or Right looking. Empirical tests seem to indicate that
|
76 |
* values of 4 or 8 for NBMIN give the best results.
|
77 |
*
|
78 |
* Bi-directional exchange is used to perform the swap::broadcast
|
79 |
* operations at once for one column in the panel. This results in a
|
80 |
* lower number of slightly larger messages than usual. On P processes
|
81 |
* and assuming bi-directional links, the running time of this function
|
82 |
* can be approximated by (when N is equal to N0):
|
83 |
*
|
84 |
* N0 * log_2( P ) * ( lat + ( 2*N0 + 4 ) / bdwth ) +
|
85 |
* N0^2 * ( M - N0/3 ) * gam2-3
|
86 |
*
|
87 |
* where M is the local number of rows of the panel, lat and bdwth are
|
88 |
* the latency and bandwidth of the network for double precision real
|
89 |
* words, and gam2-3 is an estimate of the Level 2 and Level 3 BLAS
|
90 |
* rate of execution. The recursive algorithm allows indeed to almost
|
91 |
* achieve Level 3 BLAS performance in the panel factorization. On a
|
92 |
* large number of modern machines, this operation is however latency
|
93 |
* bound, meaning that its cost can be estimated by only the latency
|
94 |
* portion N0 * log_2(P) * lat. Mono-directional links will double this
|
95 |
* communication cost.
|
96 |
*
|
97 |
* Arguments
|
98 |
* =========
|
99 |
*
|
100 |
* PANEL (local input/output) HPL_T_panel *
|
101 |
* On entry, PANEL points to the data structure containing the
|
102 |
* panel information.
|
103 |
*
|
104 |
* ---------------------------------------------------------------------
|
105 |
*/
|
106 |
/*
|
107 |
* .. Local Variables ..
|
108 |
*/
|
109 |
void * vptr = NULL; |
110 |
int align, jb;
|
111 |
/* ..
|
112 |
* .. Executable Statements ..
|
113 |
*/
|
114 |
jb = PANEL->jb; PANEL->n -= jb; PANEL->ja += jb; |
115 |
|
116 |
if( ( PANEL->grid->mycol != PANEL->pcol ) || ( jb <= 0 ) ) return; |
117 |
#ifdef HPL_DETAILED_TIMING
|
118 |
HPL_ptimer( HPL_TIMING_RPFACT ); |
119 |
#endif
|
120 |
align = PANEL->algo->align; |
121 |
vptr = (void *)malloc( ( (size_t)(align) +
|
122 |
(size_t)(((4+((unsigned int)(jb) << 1)) << 1) )) * |
123 |
sizeof(double) ); |
124 |
if( vptr == NULL ) |
125 |
{ HPL_pabort( __LINE__, "HPL_pdfact", "Memory allocation failed" ); } |
126 |
/*
|
127 |
* Factor the panel - Update the panel pointers
|
128 |
*/
|
129 |
PANEL->algo->rffun( PANEL, PANEL->mp, jb, 0, (double *)HPL_PTR( vptr, |
130 |
((size_t)(align) * sizeof(double) ) ) ); |
131 |
if( vptr ) free( vptr );
|
132 |
|
133 |
PANEL->A = Mptr( PANEL->A, 0, jb, PANEL->lda );
|
134 |
PANEL->nq -= jb; PANEL->jj += jb; |
135 |
#ifdef HPL_DETAILED_TIMING
|
136 |
HPL_ptimer( HPL_TIMING_RPFACT ); |
137 |
#endif
|
138 |
/*
|
139 |
* End of HPL_pdfact
|
140 |
*/
|
141 |
} |