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

LAPACK API change #59

Open
outpaddling opened this issue Nov 20, 2023 · 0 comments
Open

LAPACK API change #59

outpaddling opened this issue Nov 20, 2023 · 0 comments

Comments

@outpaddling
Copy link

I was tipped off to the need for some updates due to an API change in OpenBLAS 0.3.25, which apparently follows a change to reference LAPACK:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273219

Minimal patches that fix the FreeBSD port build are below. There are numerous other calls to these functions that are not addressed by these patches (e.g. in the plink submodule), and using '1' as the added argument is just an educated guess.

--- include/Matrix.hpp.orig     2022-08-03 06:01:52 UTC
+++ include/Matrix.hpp
@@ -32,7 +32,9 @@ bool _LLT(MatrixType &A, double &logdet){
 #if GCTA_CPU_x86
     dpotrf(&uplo, &cols, vi, &cols, &info);
 #else
-    dpotrf_(&uplo, &cols, vi, &cols, &info);
+    // OpenBLAS 0.3.25 requires a length argument.  Is 1 the right value?
+    // Should all dgeqrf_() calls be patched?
+    dpotrf_(&uplo, &cols, vi, &cols, &info, 1);
 #endif    
     //LOGGER << "  LLT time: " << LOGGER.tp("LLT") << std::endl;
     if(info == 0){
@@ -41,7 +43,9 @@ bool _LLT(MatrixType &A, double &logdet){
 #if GCTA_CPU_x86        
         dpotri(&uplo, &cols, vi, &cols, &info);
 #else
-        dpotri_(&uplo, &cols, vi, &cols, &info);
+        // OpenBLAS 0.3.25 requires a length argument.  Is 1 the right value?
+        // Should all doptri_() calls be patched?
+        dpotri_(&uplo, &cols, vi, &cols, &info, 1);
 #endif
         //LOGGER << "  LLT inverse time: " << LOGGER.tp("LLT_INV") << std::endl;
         if(info == 0){
--- main/mkl.cpp.orig   2023-11-20 14:09:49 UTC
+++ main/mkl.cpp
@@ -365,7 +365,9 @@ bool gcta::comput_inverse_logdet_LDLT_mkl(eigenMatrix 
 #if GCTA_CPU_x86
     dpotrf(&uplo, &int_n, Vi_mkl, &int_n, &info);
 #else
-    dpotrf_(&uplo, &int_n, Vi_mkl, &int_n, &info);
+    // OpenBLAS 0.3.25 requires a length argument.  Is 1 the right value?
+    // Should all dpotrf_() calls be patched?
+    dpotrf_(&uplo, &int_n, Vi_mkl, &int_n, &info, 1);
 #endif
     //LOGGER << "Finished decompose" << endl;
     //spotrf( &uplo, &n, Vi_mkl, &n, &info );
@@ -386,7 +388,9 @@ bool gcta::comput_inverse_logdet_LDLT_mkl(eigenMatrix 
 #if GCTA_CPU_x86
         dpotri(&uplo, &int_n, Vi_mkl, &int_n, &info);
 #else
-        dpotri_(&uplo, &int_n, Vi_mkl, &int_n, &info);
+        // OpenBLAS 0.3.25 requires a length argument.  Is 1 the right value?
+        // Should all dpotri_() calls be patched?
+        dpotri_(&uplo, &int_n, Vi_mkl, &int_n, &info, 1);
 #endif
         //LOGGER << "Inverse finished" << endl;
         //spotri( &uplo, &n, Vi_mkl, &n, &info );
--- src/StatLib.cpp.orig        2022-08-03 06:01:52 UTC
+++ src/StatLib.cpp
@@ -1,3 +1,4 @@
+
 /*
    GCTA: a tool for Genome-wide Complex Trait Analysis
 
@@ -117,8 +118,10 @@ namespace StatLib{
         dormqr(&side, &t, &n, &n, &n, X, &lda, tau, c, 
                 &lda, work, &lwork, &info);
 #else
+        // OpenBLAS 0.3.25 requires a length argument.  Is 1 the right value?
+        // Should all dormqr_() calls be patched?
         dormqr_(&side, &t, &n, &n, &n, X, &lda, tau, c, 
-                &lda, work, &lwork, &info);
+                &lda, work, &lwork, &info, 1, 1);
 #endif
         if(info != 0){
             return false;
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Dec 12, 2023
GCTA should modify the LAPACK functios calls, this is a temporary fix.

See <jianyangqt/gcta#59>.

PR:		273219
Approved by:	jwb@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant