Skip to content

Commit 399e1dd

Browse files
committed
Fix parameters
1 parent 4e3493d commit 399e1dd

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

source/module_base/blas_connector.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void BlasConnector::axpy( const int n, const float alpha, const float *X, const
5858
}
5959
else if (device_type == base_device::AbacusDevice_t::GpuDevice){
6060
#ifdef __CUDA
61-
cublasErrcheck(cublasSaxpy(cublas_handle, n, alpha, X, incX, Y, incY));
61+
cublasErrcheck(cublasSaxpy(cublas_handle, n, &alpha, X, incX, Y, incY));
6262
#endif
6363
}
6464
}
@@ -70,7 +70,7 @@ void BlasConnector::axpy( const int n, const double alpha, const double *X, cons
7070
}
7171
else if (device_type == base_device::AbacusDevice_t::GpuDevice){
7272
#ifdef __CUDA
73-
cublasErrcheck(cublasDaxpy(cublas_handle, n, alpha, X, incX, Y, incY));
73+
cublasErrcheck(cublasDaxpy(cublas_handle, n, &alpha, X, incX, Y, incY));
7474
#endif
7575
}
7676
}
@@ -82,7 +82,7 @@ void BlasConnector::axpy( const int n, const std::complex<float> alpha, const st
8282
}
8383
else if (device_type == base_device::AbacusDevice_t::GpuDevice){
8484
#ifdef __CUDA
85-
cublasErrcheck(cublasCaxpy(cublas_handle, n, alpha, X, incX, Y, incY));
85+
cublasErrcheck(cublasCaxpy(cublas_handle, n, &alpha, X, incX, Y, incY));
8686
#endif
8787
}
8888
}
@@ -94,7 +94,7 @@ void BlasConnector::axpy( const int n, const std::complex<double> alpha, const s
9494
}
9595
else if (device_type == base_device::AbacusDevice_t::GpuDevice){
9696
#ifdef __CUDA
97-
cublasErrcheck(cublasZaxpy(cublas_handle, n, alpha, X, incX, Y, incY));
97+
cublasErrcheck(cublasZaxpy(cublas_handle, n, &alpha, X, incX, Y, incY));
9898
#endif
9999
}
100100
}
@@ -108,7 +108,7 @@ void BlasConnector::scal( const int n, const float alpha, float *X, const int i
108108
}
109109
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
110110
#ifdef __CUDA
111-
cublasErrcheck(cublasSscal(cublas_handle, n, (float2*)alpha, (float2*)X, incx));
111+
cublasErrcheck(cublasSscal(cublas_handle, n, (float2*)alpha, (float2*)X, incX));
112112
#endif
113113
}
114114
}
@@ -120,7 +120,7 @@ void BlasConnector::scal( const int n, const double alpha, double *X, const int
120120
}
121121
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
122122
#ifdef __CUDA
123-
cublasErrcheck(cublasDscal(cublas_handle, n, (double2*)alpha, (double2*)X, incx));
123+
cublasErrcheck(cublasDscal(cublas_handle, n, (double2*)alpha, (double2*)X, incX));
124124
#endif
125125
}
126126
}
@@ -132,7 +132,7 @@ void BlasConnector::scal( const int n, const std::complex<float> alpha, std::com
132132
}
133133
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
134134
#ifdef __CUDA
135-
cublasErrcheck(cublasCscal(cublas_handle, n, (float2*)alpha, (float2*)X, incx));
135+
cublasErrcheck(cublasCscal(cublas_handle, n, (float2*)alpha, (float2*)X, incX));
136136
#endif
137137
}
138138
}
@@ -144,7 +144,7 @@ void BlasConnector::scal( const int n, const std::complex<double> alpha, std::co
144144
}
145145
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
146146
#ifdef __CUDA
147-
cublasErrcheck(cublasZscal(cublas_handle, n, (double2*)alpha, (double2*)X, incx));
147+
cublasErrcheck(cublasZscal(cublas_handle, n, (double2*)alpha, (double2*)X, incX));
148148
#endif
149149
}
150150
}
@@ -159,7 +159,7 @@ float BlasConnector::dot( const int n, const float *X, const int incX, const flo
159159
else if (device_type == base_device::AbacusDevice_t::GpuDevice){
160160
#ifdef __CUDA
161161
float result = 0.0;
162-
cublasErrcheck(cublasSdot(cublas_handle, n, X, incx, Y, incy, &result));
162+
cublasErrcheck(cublasSdot(cublas_handle, n, X, incX, Y, incY, &result));
163163
return result;
164164
#endif
165165
}
@@ -174,7 +174,7 @@ double BlasConnector::dot( const int n, const double *X, const int incX, const d
174174
else if (device_type == base_device::AbacusDevice_t::GpuDevice){
175175
#ifdef __CUDA
176176
double result = 0.0;
177-
cublasErrcheck(cublasDdot(cublas_handle, n, X, incx, Y, incy, &result));
177+
cublasErrcheck(cublasDdot(cublas_handle, n, X, incX, Y, incY, &result));
178178
return result;
179179
#endif
180180
}
@@ -283,61 +283,61 @@ void BlasConnector::gemm(const char transa, const char transb, const int m, cons
283283
}
284284

285285
void BlasConnector::gemv(const char trans, const int m, const int n,
286-
const float alpha, const float* A, const int lda, const float* X, const int incx,
287-
const float beta, float* Y, const int incy, base_device::AbacusDevice_t device_type)
286+
const float alpha, const float* A, const int lda, const float* X, const int incX,
287+
const float beta, float* Y, const int incY, base_device::AbacusDevice_t device_type)
288288
{
289289
if (device_type == base_device::AbacusDevice_t::CpuDevice) {
290-
sgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incx, &beta, Y, &incy);
290+
sgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
291291
}
292292
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
293293
#ifdef __CUDA
294294
cublasOperation_t cutrans = judge_trans_op(false, trans, "gemv_op");
295-
cublasErrcheck(cublasSgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incx, beta, Y, incy));
295+
cublasErrcheck(cublasSgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incX, beta, Y, incY));
296296
#endif
297297
}
298298
}
299299

300300
void BlasConnector::gemv(const char trans, const int m, const int n,
301-
const double alpha, const double* A, const int lda, const double* X, const int incx,
302-
const double beta, double* Y, const int incy, base_device::AbacusDevice_t device_type)
301+
const double alpha, const double* A, const int lda, const double* X, const int incX,
302+
const double beta, double* Y, const int incY, base_device::AbacusDevice_t device_type)
303303
{
304304
if (device_type == base_device::AbacusDevice_t::CpuDevice) {
305-
dgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incx, &beta, Y, &incy);
305+
dgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
306306
}
307307
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
308308
#ifdef __CUDA
309309
cublasOperation_t cutrans = judge_trans_op(false, trans, "gemv_op");
310-
cublasErrcheck(cublasDgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incx, beta, Y, incy));
310+
cublasErrcheck(cublasDgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incX, beta, Y, incY));
311311
#endif
312312
}
313313
}
314314

315315
void BlasConnector::gemv(const char trans, const int m, const int n,
316-
const std::complex<float> alpha, const std::complex<float> *A, const int lda, const std::complex<float> *X, const int incx,
317-
const std::complex<float> beta, std::complex<float> *Y, const int incy, base_device::AbacusDevice_t device_type)
316+
const std::complex<float> alpha, const std::complex<float> *A, const int lda, const std::complex<float> *X, const int incX,
317+
const std::complex<float> beta, std::complex<float> *Y, const int incY, base_device::AbacusDevice_t device_type)
318318
{
319319
if (device_type == base_device::AbacusDevice_t::CpuDevice) {
320-
cgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incx, &beta, Y, &incy);
320+
cgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
321321
}
322322
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
323323
#ifdef __CUDA
324324
cublasOperation_t cutrans = judge_trans_op(false, trans, "gemv_op");
325-
cublasErrcheck(cublasCgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incx, beta, Y, incy));
325+
cublasErrcheck(cublasCgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incX, beta, Y, incY));
326326
#endif
327327
}
328328
}
329329

330330
void BlasConnector::gemv(const char trans, const int m, const int n,
331-
const std::complex<double> alpha, const std::complex<double> *A, const int lda, const std::complex<double> *X, const int incx,
332-
const std::complex<double> beta, std::complex<double> *Y, const int incy, base_device::AbacusDevice_t device_type)
331+
const std::complex<double> alpha, const std::complex<double> *A, const int lda, const std::complex<double> *X, const int incX,
332+
const std::complex<double> beta, std::complex<double> *Y, const int incY, base_device::AbacusDevice_t device_type)
333333
{
334334
if (device_type == base_device::AbacusDevice_t::CpuDevice) {
335-
zgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incx, &beta, Y, &incy);
335+
zgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
336336
}
337337
else if (device_type == base_device::AbacusDevice_t::GpuDevice) {
338338
#ifdef __CUDA
339339
cublasOperation_t cutrans = judge_trans_op(false, trans, "gemv_op");
340-
cublasErrcheck(cublasZgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incx, beta, Y, incy));
340+
cublasErrcheck(cublasZgemv(cublas_handle, cutrans, m, n, alpha, A, lda, X, incX, beta, Y, incY));
341341
#endif
342342
}
343343
}
@@ -371,16 +371,16 @@ double BlasConnector::nrm2( const int n, const std::complex<double> *X, const in
371371
}
372372

373373
// copies a into b
374-
void BlasConnector::copy(const long n, const double *a, const int incx, double *b, const int incy, base_device::AbacusDevice_t device_type)
374+
void BlasConnector::copy(const long n, const double *a, const int incX, double *b, const int incY, base_device::AbacusDevice_t device_type)
375375
{
376376
if (device_type == base_device::AbacusDevice_t::CpuDevice) {
377-
dcopy_(&n, a, &incx, b, &incy);
377+
dcopy_(&n, a, &incX, b, &incY);
378378
}
379379
}
380380

381-
void BlasConnector::copy(const long n, const std::complex<double> *a, const int incx, std::complex<double> *b, const int incy, base_device::AbacusDevice_t device_type)
381+
void BlasConnector::copy(const long n, const std::complex<double> *a, const int incX, std::complex<double> *b, const int incY, base_device::AbacusDevice_t device_type)
382382
{
383383
if (device_type == base_device::AbacusDevice_t::CpuDevice) {
384-
zcopy_(&n, a, &incx, b, &incy);
384+
zcopy_(&n, a, &incX, b, &incY);
385385
}
386386
}

0 commit comments

Comments
 (0)