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

Method MultTrans

ngscuda/cuda_linalg.cpp:745–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743 }
744
745 void DevBlockDiagonalMatrixSoA :: MultTrans (const BaseVector & x, BaseVector & y) const
746 {
747 static Timer t("DevBlockDiagonalMatrixSoA::MultTrans"); RegionTimer reg(t);
748
749 UnifiedVectorWrapper ux(x);
750 UnifiedVectorWrapper uy(y);
751 ux.UpdateDevice();
752 uy.UpdateDevice();
753
754 FlatMatrix<Dev<double>> a(dimx*dimy, blocks, (Dev<double>*)dev_data);
755 FlatMatrix<Dev<double>> b(dimy, blocks, (Dev<double>*)ux.DevData());
756 FlatMatrix<Dev<double>> res(dimx, blocks, (Dev<double>*)uy.DevData());
757
758
759 {
760 static Timer t("DevBlockDiagonalMatrixSoA::MultTrans");
761 CudaRegionTimer rt(t);
762
763 /*
764 DeviceParallelFor
765 (res.Width(),
766 [a,b,res,inds=FlatArray(indices)] DEVICE_LAMBDA (auto i)
767 {
768 for (int j = 0; j < res.Height(); j++)
769 res(j,i) = 0;
770
771 for (int j = 0; j < inds.Size(); j+=3)
772 {
773 int rowa = inds[j];
774 int rowb = inds[j+2];
775 int rowres = inds[j+1];
776 res(rowres,i) += a(rowa,i) * b(rowb,i);
777 }
778 });
779 */
780
781 DeviceParallelFor
782 (res.Width(),
783 [a,b,res,dimx=this->dimx,sparseT=FlatTable<int>(sparseT)] DEVICE_LAMBDA (auto i)
784 {
785 for (int j = 0; j < sparseT.Size(); j++)
786 {
787 double sum = 0;
788 for (int k = 0; k < sparseT[j].Size(); k++)
789 {
790 int ind = sparseT[j][k];
791 sum += a(ind*dimx+j,i) * b(ind,i);
792 }
793 res(j,i) = sum;
794 }
795 });
796
797
798
799 }
800
801 if (synckernels) cudaDeviceSynchronize();
802 uy.InvalidateHost();

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected