Add support for BLAS/LAPACK ILP64 libraries#16
Conversation
|
Do we need the code duplication of blas.f90 and blas64.f90 here? It would be preferable if we can just have a single file rather than two to avoid divergence. |
|
It is not necessary. Let me remove blas64.f90 and work with macros |
|
You could define a kind parameter For the macro I would go with something along the lines of #ifndef IK
#define IK i4
#endif
module mchrg_blas
use mctc_env, only : sp, dp, ik => IK
implicit none
! ...
end module mchrg_blas |
|
Let me know if this works for you. If this is ok with you, I would also prepare PR's for |
CMakeLists.txt
Outdated
| project( | ||
| "multicharge" | ||
| LANGUAGES "Fortran" | ||
| LANGUAGES "Fortran" "C" |
There was a problem hiding this comment.
I would prefer to only depend on a Fortran compiler here.
There was a problem hiding this comment.
I have removed this in my latest commit, but the automatic MKL detection with cmake will not longer work. See bottom of https://cmake.org/cmake/help/latest/module/FindLAPACK.html
|
Actually, I was thinking the macros are not needed. If someone (like me) wants to use the ILP64 interface, then one can handle that with the What's your preference @awvwgk ? I can close this PR and open a new one with a clean commit history |
|
Indeed, promoting default integers to 8 bytes ( However, I'm still open to officially support ilp64 with the tblite stack as well. |
Co-authored-by: Sebastian Ehlert <[email protected]>
Co-authored-by: Sebastian Ehlert <[email protected]>
Co-authored-by: Sebastian Ehlert <[email protected]>
|
If the C compiler is needed for MKL detection, we could add it optionally in Findcustom-blas.cmake, if the correct |
|
The following works for either LP64 or ILP64 if diff --git a/config/cmake/Findcustom-blas.cmake b/config/cmake/Findcustom-blas.cmake
index 3dfe5c1..7f71e62 100644
--- a/config/cmake/Findcustom-blas.cmake
+++ b/config/cmake/Findcustom-blas.cmake
@@ -13,6 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+if ((BLA_VENDOR MATCHES ^Intel) OR (DEFINED ENV{MKLROOT}))
+ enable_language("C")
+endif()
+
+if(WITH_ILP64)
+ set(BLA_SIZEOF_INTEGER 8)
+endif()
+
if(NOT BLAS_FOUND)
find_package("BLAS")
if(NOT TARGET "BLAS::BLAS")
diff --git a/config/cmake/Findcustom-lapack.cmake b/config/cmake/Findcustom-lapack.cmake
index c78569d..8cd9a6a 100644
--- a/config/cmake/Findcustom-lapack.cmake
+++ b/config/cmake/Findcustom-lapack.cmake
@@ -13,6 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+if ((BLA_VENDOR MATCHES ^Intel) OR (DEFINED ENV{MKLROOT}))
+ enable_language("C")
+endif()
+
+if(WITH_ILP64)
+ set(BLA_SIZEOF_INTEGER 8)
+endif()
+
if(NOT LAPACK_FOUND)
find_package("LAPACK")
|
|
This seems like a good solution to me. |
awvwgk
left a comment
There was a problem hiding this comment.
Thanks for this patch. Looks good to me now.
No description provided.