Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hybrid cpu host + gpu device execution of bdsqr() #742

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions library/src/auxiliary/rocauxiliary_bdsqr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

#include <cmath>

#include "rocauxiliary_bdsqr_host.hpp"

ROCSOLVER_BEGIN_NAMESPACE

/************** Kernels and device functions *******************/
Expand Down Expand Up @@ -1079,29 +1081,41 @@ rocblas_status rocsolver_bdsqr_template(rocblas_handle handle,
ROCSOLVER_LAUNCH_KERNEL((bdsqr_init<T>), grid1, threads1, 0, stream, n, D, strideD, E, strideE,
info, maxiter, sfm, tol, splits_map, work, incW, strideW);

bool const use_bdsqr_host = true;
rocblas_status istat = rocblas_status_success;
if(n > 1)
{
// rotate to upper bidiagonal if necessary
if(uplo == rocblas_fill_lower)
if(use_bdsqr_host)
{
ROCSOLVER_LAUNCH_KERNEL((bdsqr_lower2upper<T>), grid1, threads2, 0, stream, n, nu, nc,
D, strideD, E, strideE, U, shiftU, ldu, strideU, C, shiftC, ldc,
strideC, info, work, strideW);
rocblas_fill const uplo_in = uplo;
istat = rocsolver_bdsqr_host_batch_template<T, S, W1, W2, W3, rocblas_int>(
handle, uplo_in, n, nv, nu, nc, D, strideD, E, strideE, V, shiftV, ldv, strideV, U,
shiftU, ldu, strideU, C, shiftC, ldc, strideC, info, batch_count, splits_map, work);
}
else
{
// rotate to upper bidiagonal if necessary
if(uplo == rocblas_fill_lower)
{
ROCSOLVER_LAUNCH_KERNEL((bdsqr_lower2upper<T>), grid1, threads2, 0, stream, n, nu,
nc, D, strideD, E, strideE, U, shiftU, ldu, strideU, C,
shiftC, ldc, strideC, info, work, strideW);
}

// main computation of SVD
ROCSOLVER_LAUNCH_KERNEL((bdsqr_kernel<T>), grid2, threads3, 0, stream, n, nv, nu, nc, D,
strideD, E, strideE, V, shiftV, ldv, strideV, U, shiftU, ldu,
strideU, C, shiftC, ldc, strideC, info, maxiter, eps, sfm, tol,
minshift, splits_map, work, incW, strideW);
// main computation of SVD
ROCSOLVER_LAUNCH_KERNEL((bdsqr_kernel<T>), grid2, threads3, 0, stream, n, nv, nu, nc, D,
strideD, E, strideE, V, shiftV, ldv, strideV, U, shiftU, ldu,
strideU, C, shiftC, ldc, strideC, info, maxiter, eps, sfm, tol,
minshift, splits_map, work, incW, strideW);
}
}

// sort the singular values and vectors
ROCSOLVER_LAUNCH_KERNEL((bdsqr_sort<T>), grid1, threads3, 0, stream, n, nv, nu, nc, D, strideD,
E, strideE, V, shiftV, ldv, strideV, U, shiftU, ldu, strideU, C, shiftC,
ldc, strideC, info, splits_map);

return rocblas_status_success;
return istat;
}

ROCSOLVER_END_NAMESPACE
Loading