Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Reference-LAPACK/lapack
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaypanyala committed Dec 15, 2021
2 parents 9c2380c + 1782d90 commit f3e8010
Show file tree
Hide file tree
Showing 57 changed files with 231 additions and 174 deletions.
6 changes: 3 additions & 3 deletions BLAS/SRC/crotg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
! CROTG constructs a plane rotation
! [ c s ] [ a ] = [ r ]
! [ -conjg(s) c ] [ b ] [ 0 ]
! where c is real, s ic complex, and c**2 + conjg(s)*s = 1.
! where c is real, s is complex, and c**2 + conjg(s)*s = 1.
!
!> \par Purpose:
! =============
Expand All @@ -28,8 +28,8 @@
!> r = sgn(a)*sqrt(|a|**2 + |b|**2)
!> c = a / r
!> s = b / r
!> the same as in CROTG when |a| > |b|. When |b| >= |a|, the
!> sign of c and s will be different from those computed by CROTG
!> the same as in SROTG when |a| > |b|. When |b| >= |a|, the
!> sign of c and s will be different from those computed by SROTG
!> if the signs of a and b are not the same.
!>
!> \endverbatim
Expand Down
6 changes: 3 additions & 3 deletions BLAS/SRC/zrotg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
! ZROTG constructs a plane rotation
! [ c s ] [ a ] = [ r ]
! [ -conjg(s) c ] [ b ] [ 0 ]
! where c is real, s ic complex, and c**2 + conjg(s)*s = 1.
! where c is real, s is complex, and c**2 + conjg(s)*s = 1.
!
!> \par Purpose:
! =============
Expand All @@ -28,8 +28,8 @@
!> r = sgn(a)*sqrt(|a|**2 + |b|**2)
!> c = a / r
!> s = b / r
!> the same as in ZROTG when |a| > |b|. When |b| >= |a|, the
!> sign of c and s will be different from those computed by ZROTG
!> the same as in DROTG when |a| > |b|. When |b| >= |a|, the
!> sign of c and s will be different from those computed by DROTG
!> if the signs of a and b are not the same.
!>
!> \endverbatim
Expand Down
4 changes: 1 addition & 3 deletions CBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ FortranCInterface_HEADER(${LAPACK_BINARY_DIR}/include/cblas_mangling.h
MACRO_NAMESPACE "F77_"
SYMBOL_NAMESPACE "F77_")
if(NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
configure_file(include/lapacke_mangling_with_flags.h.in
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h)
message(WARNING "Reverting to pre-defined include/cblas_mangling.h")
configure_file(include/cblas_mangling_with_flags.h.in
${LAPACK_BINARY_DIR}/include/cblas_mangling.h)
endif()
Expand Down
7 changes: 5 additions & 2 deletions CBLAS/include/cblas.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef CBLAS_H
#define CBLAS_H
#include <stddef.h>
#include <stdint.h>


#ifdef __cplusplus
Expand All @@ -15,10 +16,12 @@ extern "C" { /* Assume C declarations for C++ */
/*
* Integer type
*/
#ifndef CBLAS_INT
#ifdef WeirdNEC
#define CBLAS_INT long
#define CBLAS_INT int64_t
#else
#define CBLAS_INT int
#define CBLAS_INT int32_t
#endif
#endif

typedef enum CBLAS_LAYOUT {CblasRowMajor=101, CblasColMajor=102} CBLAS_LAYOUT;
Expand Down
13 changes: 10 additions & 3 deletions CBLAS/include/cblas_f77.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define CBLAS_F77_H

#include <stdarg.h>
#include <stdint.h>

/* It seems all current Fortran compilers put strlen at end.
* Some historical compilers put strlen after the str argument
Expand All @@ -24,10 +25,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 int
#define F77_INT int32_t
#endif
#endif

#ifdef F77_CHAR
Expand Down Expand Up @@ -527,7 +530,11 @@
extern "C" {
#endif

void F77_xerbla(FCHAR, void *);
#ifdef BLAS_FORTRAN_STRLEN_END
#define F77_xerbla(...) F77_xerbla_base(__VA_ARGS__, 1)
#else
#define F77_xerbla(...) F77_xerbla_base(__VA_ARGS__)
#endif
void F77_xerbla_base(FCHAR, void *
#ifdef BLAS_FORTRAN_STRLEN_END
, size_t
Expand Down
11 changes: 7 additions & 4 deletions CBLAS/src/xerbla.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ void
#ifdef HAS_ATTRIBUTE_WEAK_SUPPORT
__attribute__((weak))
#endif
F77_xerbla
F77_xerbla_base
#ifdef F77_CHAR
(F77_CHAR F77_srname, void *vinfo)
(F77_CHAR F77_srname, void *vinfo
#else
(char *srname, void *vinfo)
(char *srname, void *vinfo
#endif

#ifdef BLAS_FORTRAN_STRLEN_END
, size_t len
#endif
)
{
#ifdef F77_CHAR
char *srname;
Expand Down
20 changes: 20 additions & 0 deletions CMAKE/CheckLAPACKCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ 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(CPE_ENV $ENV{PE_ENV})
if(CPE_ENV STREQUAL "CRAY")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -sinteger64")
elseif(CPE_ENV STREQUAL "NVIDIA")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -i8")
else()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8")
endif()
endif()
endif()

# GNU Fortran
if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
if( "${CMAKE_Fortran_FLAGS}" MATCHES "-ffpe-trap=[izoupd]")
Expand Down
49 changes: 29 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +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(CPE_ENV $ENV{PE_ENV})
if(CPE_ENV STREQUAL "CRAY")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -sinteger64")
elseif(CPE_ENV STREQUAL "NVIDIA")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -i8")
else()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8")
endif()
set(FORTRAN_ILP TRUE)
else()
set(BLASLIB "blas")
set(CBLASLIB "cblas")
Expand Down Expand Up @@ -98,28 +91,44 @@ include(PreventInBuildInstalls)

# Check if recursive flag exists
include(CheckFortranCompilerFlag)
check_fortran_compiler_flag("-recursive" _recursiveFlag)
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
if(CMAKE_Fortran_COMPILER_ID STREQUAL Flang)
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
check_fortran_compiler_flag("-recursive" _recursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
check_fortran_compiler_flag("-qrecur" _qrecurFlag)
else()
message(WARNING "Fortran local arrays should be allocated on the stack."
" Please use a compiler which guarantees that feature."
" See https://github.com/Reference-LAPACK/lapack/pull/188 and references therein.")
endif()

# Add recursive flag
if(_recursiveFlag)
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(_MrecursiveFlag)
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
CACHE STRING "Recursive flag must be set" FORCE)
endif()
elseif(_frecursiveFlag)
string(REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
CACHE STRING "Recursive flag must be set" FORCE)
CACHE STRING "Recursive flag must be set" FORCE)
endif()
elseif(_MrecursiveFlag)
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
elseif(_recursiveFlag)
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
CACHE STRING "Recursive flag must be set" FORCE)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
CACHE STRING "Recursive flag must be set" FORCE)
endif()
elseif(_qrecurFlag)
string(REGEX MATCH "-qrecur" output_test <string> "${CMAKE_Fortran_FLAGS}")
if(NOT output_test)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur"
CACHE STRING "Recursive flag must be set" FORCE)
endif()
endif()

Expand All @@ -128,7 +137,7 @@ if(UNIX)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
endif()
if(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict")
endif()
# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
Expand Down
4 changes: 2 additions & 2 deletions INSTALL/make.inc.XLF
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ CFLAGS = -O3 -qnosave
# the compiler options desired when NO OPTIMIZATION is selected.
#
FC = xlf
FFLAGS = -O3 -qfixed -qnosave
FFLAGS = -O3 -qfixed -qnosave -qrecur
# For -O2, add -qstrict=none
FFLAGS_DRV = $(FFLAGS)
FFLAGS_NOOPT = -O0 -qfixed -qnosave
FFLAGS_NOOPT = -O0 -qfixed -qnosave -qrecur

# Define LDFLAGS to the desired linker options for your machine.
#
Expand Down
5 changes: 5 additions & 0 deletions INSTALL/make.inc.gfortran
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ CBLASLIB = $(TOPSRCDIR)/libcblas.a
LAPACKLIB = $(TOPSRCDIR)/liblapack.a
TMGLIB = $(TOPSRCDIR)/libtmglib.a
LAPACKELIB = $(TOPSRCDIR)/liblapacke.a

# DOCUMENTATION DIRECTORY
# If you generate html pages (make html), documentation will be placed in $(DOCSDIR)/explore-html
# If you generate man pages (make man), documentation will be placed in $(DOCSDIR)/man
DOCSDIR = $(TOPSRCDIR)/DOCS
5 changes: 3 additions & 2 deletions LAPACKE/include/lapacke_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ extern "C" {
#endif /* __cplusplus */

#include <stdlib.h>
#include <stdint.h>

#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

Expand Down
18 changes: 12 additions & 6 deletions SRC/cgeqrf.f
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
*> The dimension of the array WORK. LWORK >= max(1,N).
*> The dimension of the array WORK.
*> LWORK >= 1, if MIN(M,N) = 0, and LWORK >= N, otherwise.
*> For optimum performance LWORK >= N*NB, where NB is
*> the optimal blocksize.
*>
Expand Down Expand Up @@ -175,30 +176,35 @@ SUBROUTINE CGEQRF( M, N, A, LDA, TAU, WORK, LWORK, INFO )
*
* Test the input arguments
*
K = MIN( M, N )
INFO = 0
NB = ILAENV( 1, 'CGEQRF', ' ', M, N, -1, -1 )
LWKOPT = N*NB
WORK( 1 ) = LWKOPT
LQUERY = ( LWORK.EQ.-1 )
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
ELSE IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN
INFO = -7
ELSE IF( .NOT.LQUERY ) THEN
IF( LWORK.LE.0 .OR. ( M.GT.0 .AND. LWORK.LT.MAX( 1, N ) ) )
$ INFO = -7
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CGEQRF', -INFO )
RETURN
ELSE IF( LQUERY ) THEN
IF( K.EQ.0 ) THEN
LWKOPT = 1
ELSE
LWKOPT = N*NB
END IF
WORK( 1 ) = LWKOPT
RETURN
END IF
*
* Quick return if possible
*
K = MIN( M, N )
IF( K.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
Expand Down
8 changes: 5 additions & 3 deletions SRC/cgerqf.f
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
*> The dimension of the array WORK. LWORK >= max(1,M).
*> The dimension of the array WORK.
*> LWORK >= 1, if MIN(M,N) = 0, and LWORK >= M, otherwise.
*> For optimum performance LWORK >= M*NB, where NB is
*> the optimal blocksize.
*>
Expand Down Expand Up @@ -188,8 +189,9 @@ SUBROUTINE CGERQF( M, N, A, LDA, TAU, WORK, LWORK, INFO )
END IF
WORK( 1 ) = LWKOPT
*
IF( LWORK.LT.MAX( 1, M ) .AND. .NOT.LQUERY ) THEN
INFO = -7
IF ( .NOT.LQUERY ) THEN
IF( LWORK.LE.0 .OR. ( N.GT.0 .AND. LWORK.LT.MAX( 1, M ) ) )
$ INFO = -7
END IF
END IF
*
Expand Down
2 changes: 1 addition & 1 deletion SRC/cla_gbrfsx_extended.f
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
*> In addition to normwise error bound, the code provides maximum
*> componentwise error bound if possible. See comments for ERR_BNDS_NORM
*> and ERR_BNDS_COMP for details of the error bounds. Note that this
*> subroutine is only resonsible for setting the second fields of
*> subroutine is only responsible for setting the second fields of
*> ERR_BNDS_NORM and ERR_BNDS_COMP.
*> \endverbatim
*
Expand Down
2 changes: 1 addition & 1 deletion SRC/cla_gerfsx_extended.f
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
*> In addition to normwise error bound, the code provides maximum
*> componentwise error bound if possible. See comments for ERRS_N
*> and ERRS_C for details of the error bounds. Note that this
*> subroutine is only resonsible for setting the second fields of
*> subroutine is only responsible for setting the second fields of
*> ERRS_N and ERRS_C.
*> \endverbatim
*
Expand Down
2 changes: 1 addition & 1 deletion SRC/cla_herfsx_extended.f
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
*> In addition to normwise error bound, the code provides maximum
*> componentwise error bound if possible. See comments for ERR_BNDS_NORM
*> and ERR_BNDS_COMP for details of the error bounds. Note that this
*> subroutine is only resonsible for setting the second fields of
*> subroutine is only responsible for setting the second fields of
*> ERR_BNDS_NORM and ERR_BNDS_COMP.
*> \endverbatim
*
Expand Down
2 changes: 1 addition & 1 deletion SRC/cla_porfsx_extended.f
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
*> In addition to normwise error bound, the code provides maximum
*> componentwise error bound if possible. See comments for ERR_BNDS_NORM
*> and ERR_BNDS_COMP for details of the error bounds. Note that this
*> subroutine is only resonsible for setting the second fields of
*> subroutine is only responsible for setting the second fields of
*> ERR_BNDS_NORM and ERR_BNDS_COMP.
*> \endverbatim
*
Expand Down
2 changes: 1 addition & 1 deletion SRC/cla_syrfsx_extended.f
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
*> In addition to normwise error bound, the code provides maximum
*> componentwise error bound if possible. See comments for ERR_BNDS_NORM
*> and ERR_BNDS_COMP for details of the error bounds. Note that this
*> subroutine is only resonsible for setting the second fields of
*> subroutine is only responsible for setting the second fields of
*> ERR_BNDS_NORM and ERR_BNDS_COMP.
*> \endverbatim
*
Expand Down
Loading

0 comments on commit f3e8010

Please sign in to comment.