From 8fe3555792f7a30df787721fe8e9e63883e5b58a Mon Sep 17 00:00:00 2001 From: "Larson, Eric" Date: Fri, 24 Sep 2021 13:03:59 -0700 Subject: [PATCH] ILP support long's in windows are 4 bytes (MSVS, intel compilers). Use int64_t and int32_t to ensure 8 byte integers for ILP interface. support 8 byte integer flag for intel ifort compiler --- lapack-netlib/CBLAS/include/cblas.h | 5 +++-- lapack-netlib/CBLAS/include/cblas_f77.h | 8 +++++++- lapack-netlib/CMAKE/CheckLAPACKCompilerFlags.cmake | 13 +++++++++++++ lapack-netlib/CMakeLists.txt | 2 +- lapack-netlib/LAPACKE/include/lapacke_config.h | 5 +++-- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/lapack-netlib/CBLAS/include/cblas.h b/lapack-netlib/CBLAS/include/cblas.h index 9e93796..7593064 100644 --- a/lapack-netlib/CBLAS/include/cblas.h +++ b/lapack-netlib/CBLAS/include/cblas.h @@ -1,6 +1,7 @@ #ifndef CBLAS_H #define CBLAS_H #include +#include #ifdef __cplusplus @@ -11,9 +12,9 @@ extern "C" { /* Assume C declarations for C++ */ * Enumerated and derived types */ #ifdef WeirdNEC - #define CBLAS_INDEX long + #define CBLAS_INDEX int64_t #else - #define CBLAS_INDEX int + #define CBLAS_INDEX int32_t #endif typedef enum {CblasRowMajor=101, CblasColMajor=102} CBLAS_LAYOUT; diff --git a/lapack-netlib/CBLAS/include/cblas_f77.h b/lapack-netlib/CBLAS/include/cblas_f77.h index 36d4a71..bb3f3a4 100644 --- a/lapack-netlib/CBLAS/include/cblas_f77.h +++ b/lapack-netlib/CBLAS/include/cblas_f77.h @@ -9,6 +9,8 @@ #ifndef CBLAS_F77_H #define CBLAS_F77_H +#include + #ifdef CRAY #include #define F77_CHAR _fcd @@ -17,8 +19,12 @@ #define F77_STRLEN(a) (_fcdlen) #endif +#ifndef F77_INT #ifdef WeirdNEC - #define F77_INT long + #define F77_INT int64_t +#else + #define F77_INT int32_t +#endif #endif #ifdef F77_CHAR diff --git a/lapack-netlib/CMAKE/CheckLAPACKCompilerFlags.cmake b/lapack-netlib/CMAKE/CheckLAPACKCompilerFlags.cmake index add0d17..15a8f01 100644 --- a/lapack-netlib/CMAKE/CheckLAPACKCompilerFlags.cmake +++ b/lapack-netlib/CMAKE/CheckLAPACKCompilerFlags.cmake @@ -14,6 +14,19 @@ macro( CheckLAPACKCompilerFlags ) set( FPE_EXIT FALSE ) +# FORTRAN ILP default +if ( FORTRAN_ILP ) + if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) + if ( WIN32 ) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /integer-size:64") + else () + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -integer-size 64") + endif() + else() + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8") + endif() +endif() + # GNU Fortran if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" ) if( "${CMAKE_Fortran_FLAGS}" MATCHES "-ffpe-trap=[izoupd]") diff --git a/lapack-netlib/CMakeLists.txt b/lapack-netlib/CMakeLists.txt index a30efbb..b704e72 100644 --- a/lapack-netlib/CMakeLists.txt +++ b/lapack-netlib/CMakeLists.txt @@ -53,7 +53,7 @@ if(BUILD_INDEX64) set(LAPACKELIB "lapacke64") set(TMGLIB "tmglib64") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWeirdNEC -DLAPACK_ILP64 -DHAVE_LAPACK_CONFIG_H") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8") + set(FORTRAN_ILP TRUE) else() set(BLASLIB "blas") set(CBLASLIB "cblas") diff --git a/lapack-netlib/LAPACKE/include/lapacke_config.h b/lapack-netlib/LAPACKE/include/lapacke_config.h index 8262c34..c654295 100644 --- a/lapack-netlib/LAPACKE/include/lapacke_config.h +++ b/lapack-netlib/LAPACKE/include/lapacke_config.h @@ -49,12 +49,13 @@ extern "C" { #endif /* __cplusplus */ #include +#include #ifndef lapack_int #if defined(LAPACK_ILP64) -#define lapack_int long +#define lapack_int int64_t #else -#define lapack_int int +#define lapack_int int32_t #endif #endif -- 2.7.4