root / src / blas / HPL_dcopy.c @ 12
Historique | Voir | Annoter | Télécharger (6,96 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 |
#ifndef HPL_dcopy
|
53 |
|
54 |
#ifdef STDC_HEADERS
|
55 |
void HPL_dcopy
|
56 |
( |
57 |
const int N, |
58 |
const double * X, |
59 |
const int INCX, |
60 |
double * Y,
|
61 |
const int INCY |
62 |
) |
63 |
#else
|
64 |
void HPL_dcopy
|
65 |
( N, X, INCX, Y, INCY ) |
66 |
const int N; |
67 |
const double * X; |
68 |
const int INCX; |
69 |
double * Y;
|
70 |
const int INCY; |
71 |
#endif
|
72 |
{ |
73 |
/*
|
74 |
* Purpose
|
75 |
* =======
|
76 |
*
|
77 |
* HPL_dcopy copies the vector x into the vector y.
|
78 |
*
|
79 |
*
|
80 |
* Arguments
|
81 |
* =========
|
82 |
*
|
83 |
* N (local input) const int
|
84 |
* On entry, N specifies the length of the vectors x and y. N
|
85 |
* must be at least zero.
|
86 |
*
|
87 |
* X (local input) const double *
|
88 |
* On entry, X is an incremented array of dimension at least
|
89 |
* ( 1 + ( n - 1 ) * abs( INCX ) ) that contains the vector x.
|
90 |
*
|
91 |
* INCX (local input) const int
|
92 |
* On entry, INCX specifies the increment for the elements of X.
|
93 |
* INCX must not be zero.
|
94 |
*
|
95 |
* Y (local input/output) double *
|
96 |
* On entry, Y is an incremented array of dimension at least
|
97 |
* ( 1 + ( n - 1 ) * abs( INCY ) ) that contains the vector y.
|
98 |
* On exit, the entries of the incremented array Y are updated
|
99 |
* with the entries of the incremented array X.
|
100 |
*
|
101 |
* INCY (local input) const int
|
102 |
* On entry, INCY specifies the increment for the elements of Y.
|
103 |
* INCY must not be zero.
|
104 |
*
|
105 |
* ---------------------------------------------------------------------
|
106 |
*/
|
107 |
#ifdef HPL_CALL_CBLAS
|
108 |
cblas_dcopy( N, X, INCX, Y, INCY ); |
109 |
#endif
|
110 |
#ifdef HPL_CALL_GSLCBLAS
|
111 |
cblas_dcopy( N, X, INCX, Y, INCY ); |
112 |
#endif
|
113 |
#ifdef HPL_CALL_VSIPL
|
114 |
register double x0, x1, x2, x3, x4, x5, x6, x7; |
115 |
const double * StX; |
116 |
register int i; |
117 |
int nu;
|
118 |
const int incX2 = 2 * INCX, incY2 = 2 * INCY, |
119 |
incX3 = 3 * INCX, incY3 = 3 * INCY, |
120 |
incX4 = 4 * INCX, incY4 = 4 * INCY, |
121 |
incX5 = 5 * INCX, incY5 = 5 * INCY, |
122 |
incX6 = 6 * INCX, incY6 = 6 * INCY, |
123 |
incX7 = 7 * INCX, incY7 = 7 * INCY, |
124 |
incX8 = 8 * INCX, incY8 = 8 * INCY; |
125 |
|
126 |
if( N > 0 ) |
127 |
{ |
128 |
if( ( nu = ( N >> 3 ) << 3 ) != 0 ) |
129 |
{ |
130 |
StX = X + nu * INCX; |
131 |
|
132 |
do
|
133 |
{ |
134 |
x0 = (*X); x4 = X[incX4]; x1 = X[INCX ]; x5 = X[incX5]; |
135 |
x2 = X[incX2]; x6 = X[incX6]; x3 = X[incX3]; x7 = X[incX7]; |
136 |
|
137 |
*Y = x0; Y[incY4] = x4; Y[INCY ] = x1; Y[incY5] = x5; |
138 |
Y[incY2] = x2; Y[incY6] = x6; Y[incY3] = x3; Y[incY7] = x7; |
139 |
|
140 |
X += incX8; |
141 |
Y += incY8; |
142 |
|
143 |
} while( X != StX );
|
144 |
} |
145 |
|
146 |
for( i = N - nu; i != 0; i-- ) |
147 |
{ |
148 |
x0 = (*X); |
149 |
*Y = x0; |
150 |
|
151 |
X += INCX; |
152 |
Y += INCY; |
153 |
} |
154 |
} |
155 |
#endif
|
156 |
|
157 |
#ifdef HPL_CALL_FBLAS
|
158 |
#ifdef HPL_USE_F77_INTEGER_DEF
|
159 |
const F77_INTEGER F77N = N, F77incx = INCX, F77incy = INCY;
|
160 |
#else
|
161 |
#define F77N N
|
162 |
#define F77incx INCX
|
163 |
#define F77incy INCY
|
164 |
#endif
|
165 |
F77dcopy( &F77N, X, &F77incx, Y, &F77incy ); |
166 |
#endif
|
167 |
|
168 |
#ifdef HPL_CALL_CUBLAS
|
169 |
|
170 |
#define CUBLASN N
|
171 |
#define CUBLASincx INCX
|
172 |
#define CUBLASincy INCY
|
173 |
|
174 |
CUBLAS_DCOPY( &CUBLASN, X, &CUBLASincx, Y, &CUBLASincy ); |
175 |
#endif
|
176 |
|
177 |
#ifdef HPL_CALL_ACML
|
178 |
|
179 |
#define ACMLN N
|
180 |
#define ACMLincx INCX
|
181 |
#define ACMLincy INCY
|
182 |
|
183 |
dcopy_( &ACMLN, X, &ACMLincx, Y, &ACMLincy ); |
184 |
#endif
|
185 |
/*
|
186 |
* End of HPL_dcopy
|
187 |
*/
|
188 |
} |
189 |
|
190 |
#endif
|