Hi all - I’m attempting to build a program that will setup cuSolver gesvdj once and then run it X amount of times (on dynamically changing data). In order to do that, I would like to the run the buffer setup once and then call cusolverDNCgesvdjBatched as needed. However, if I try to move some of the functionality to a different function the result of the svd is all 0’s, and I get a “CUSOLVER_STATUS_INVALID_VALUE” (3) error from the function call.
I have a minimally reproducible example in the zip file. It’s currently setup to run correctly, but if you change lines 158-177 to :
// --- Query the SVD workspace
// cusolveSafeCall(cusolverDnCgesvdjBatched_bufferSize(
// solver_handle,
// CUSOLVER_EIG_MODE_NOVECTOR, // --- Compute the singular vectors or not
// M, // --- Nubmer of rows of A, 0 <= M
// N, // --- Number of columns of A, 0 <= N
// d_A, // --- M x N
// LDA, // --- Leading dimension of A
// d_S, // --- Square matrix of size min(M, N) x min(M, N)
// d_U, // --- M x M if econ = 0, M x min(M, N) if econ = 1
// M, // --- Leading dimension of U, ldu >= max(1, M)
// d_V, // --- N x N if econ = 0, N x min(M,N) if econ = 1
// N, // --- Leading dimension of V, ldv >= max(1, N)
// &work_size,
// gesvdj_params,
// N_MAX_TARGETS));
// gpuErrchk(cudaMalloc(&d_work, sizeof(float2) * work_size));
init(&solver_handle, &gesvdj_params, d_work, &streamsvd, work_size, d_U, d_V, numMatrices, d_A, d_S);
then you will see the issue. Thanks in advance for your time.
example.zip (19.3 KB)