MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / MultTransAdd

Method MultTransAdd

ngscuda/cuda_linalg.cpp:271–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269
270
271 void DevSparseMatrix :: MultTransAdd (double s, const BaseVector & x, BaseVector & y) const
272 {
273 static Timer tmv("DevSparseMatrix :: MultTransAdd");
274 CudaRegionTimer reg(tmv);
275
276 UnifiedVectorWrapper ux(x);
277 UnifiedVectorWrapper uy(y);
278
279 ux.UpdateDevice();
280 uy.UpdateDevice();
281
282 double alpha= s;
283 double beta = 1;
284
285 size_t bufferSize = 0;
286 void* dBuffer = NULL;
287
288 cusparseDnVecDescr_t descr_x, descr_y;
289 cusparseCreateDnVec (&descr_x, ux.Size(), ux.DevData(), CUDA_R_64F);
290 cusparseCreateDnVec (&descr_y, uy.Size(), uy.DevData(), CUDA_R_64F);
291
292 cusparseSpMV_bufferSize(Get_CuSparse_Handle(), CUSPARSE_OPERATION_TRANSPOSE,
293 &alpha, descr, descr_x, &beta, descr_y, CUDA_R_64F,
294 CUSPARSE_SPMV_ALG_DEFAULT, &bufferSize);
295 cudaMalloc(&dBuffer, bufferSize);
296
297 cusparseSpMV(Get_CuSparse_Handle(),
298 CUSPARSE_OPERATION_TRANSPOSE, &alpha, descr,
299 descr_x, &beta, descr_y, CUDA_R_64F,
300 CUSPARSE_SPMV_ALG_DEFAULT, dBuffer);
301
302 cudaFree(dBuffer);
303
304 cusparseDestroyDnVec(descr_x);
305 cusparseDestroyDnVec(descr_y);
306
307 uy.InvalidateHost();
308 }
309
310
311

Callers

nothing calls this directly

Calls 6

Get_CuSparse_HandleFunction · 0.85
DeviceParallelForFunction · 0.85
InvalidateHostMethod · 0.80
SizeMethod · 0.45
DevDataMethod · 0.45
WidthMethod · 0.45

Tested by

no test coverage detected