Skip to content

Commit

Permalink
Merge pull request #530 from Cytnx-dev/return-zero-det
Browse files Browse the repository at this point in the history
Det() returns zero for the sigular matrix
  • Loading branch information
IvanaGyro authored Dec 5, 2024
2 parents dd72877 + eb67ff2 commit 32f2ef7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/backend/linalg_internal_gpu/cuDet_internal.cu
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ namespace cytnx {

int info;
checkCudaErrors(cudaMemcpy(&info, devInfo, sizeof(int), cudaMemcpyDeviceToHost));
cytnx_error_msg(info != 0, "[ERROR] cusolverDnZgetrf fail with info= %d\n", info);
cytnx_error_msg(info < 0, "[ERROR] cusolverDnZgetrf fail with info= %d\n", info);
// TODO: info > 0 means U[info - 1, info - 1] is zero, which implies the determinant is
// zero. The steps below can be skipped.

// since we do unify mem, direct access element is possible:
od[0] = 1;
Expand Down Expand Up @@ -79,7 +81,9 @@ namespace cytnx {

int info;
checkCudaErrors(cudaMemcpy(&info, devInfo, sizeof(int), cudaMemcpyDeviceToHost));
cytnx_error_msg(info != 0, "[ERROR] cusolverDnCgetrf fail with info= %d\n", info);
cytnx_error_msg(info < 0, "[ERROR] cusolverDnCgetrf fail with info= %d\n", info);
// TODO: info > 0 means U[info - 1, info - 1] is zero, which implies the determinant is
// zero. The steps below can be skipped.

// since we do unify mem, direct access element is possible:
od[0] = 1;
Expand Down Expand Up @@ -124,7 +128,9 @@ namespace cytnx {

int info;
checkCudaErrors(cudaMemcpy(&info, devInfo, sizeof(int), cudaMemcpyDeviceToHost));
cytnx_error_msg(info != 0, "[ERROR] cusolverDnDgetrf fail with info= %d\n", info);
cytnx_error_msg(info < 0, "[ERROR] cusolverDnDgetrf fail with info= %d\n", info);
// TODO: info > 0 means U[info - 1, info - 1] is zero, which implies the determinant is
// zero. The steps below can be skipped.

// since we do unify mem, direct access element is possible:
od[0] = 1;
Expand Down Expand Up @@ -169,7 +175,9 @@ namespace cytnx {

int info;
checkCudaErrors(cudaMemcpy(&info, devInfo, sizeof(int), cudaMemcpyDeviceToHost));
cytnx_error_msg(info != 0, "[ERROR] cusolverDnSgetrf fail with info= %d\n", info);
cytnx_error_msg(info < 0, "[ERROR] cusolverDnSgetrf fail with info= %d\n", info);
// TODO: info > 0 means U[info - 1, info - 1] is zero, which implies the determinant is
// zero. The steps below can be skipped.

// since we do unify mem, direct access element is possible:
od[0] = 1;
Expand Down

0 comments on commit 32f2ef7

Please sign in to comment.