diff options
37 files changed, 558 insertions, 610 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b8705ef..3da538bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ option(BUILD_SINGLE "Build LAPACK Single Precision" ON) option(BUILD_DOUBLE "Build LAPACK Double Precision" ON) option(BUILD_COMPLEX "Build LAPACK Complex Precision" ON) option(BUILD_COMPLEX16 "Build LAPACK Double Complex Precision" ON) + # -------------------------------------------------- # Subdirectories that need to be processed @@ -141,6 +142,13 @@ if(BUILD_TESTING) endif(BUILD_TESTING) # -------------------------------------------------- +# LAPACKE +option(LAPACKE "Build LAPACKE" OFF) +if(LAPACKE) + add_subdirectory(lapacke) +endif(LAPACKE) + +# -------------------------------------------------- # CPACK Packaging SET(CPACK_PACKAGE_NAME "LAPACK") diff --git a/INSTALL/make.inc.ALPHA b/INSTALL/make.inc.ALPHA index 0d69d7c3..824458e2 100644 --- a/INSTALL/make.inc.ALPHA +++ b/INSTALL/make.inc.ALPHA @@ -33,6 +33,18 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = cc +CFLAGS = -O4 +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.HPPA b/INSTALL/make.inc.HPPA index 0aac30c3..8aa71414 100644 --- a/INSTALL/make.inc.HPPA +++ b/INSTALL/make.inc.HPPA @@ -33,6 +33,18 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = cc +CFLAGS = +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.IRIX64 b/INSTALL/make.inc.IRIX64 index 69c95707..79074d28 100644 --- a/INSTALL/make.inc.IRIX64 +++ b/INSTALL/make.inc.IRIX64 @@ -36,6 +36,19 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = cc +CFLAGS = -O3 +# +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.O2K b/INSTALL/make.inc.O2K index ed2bd241..5d0bda47 100644 --- a/INSTALL/make.inc.O2K +++ b/INSTALL/make.inc.O2K @@ -36,6 +36,19 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = cc +CFLAGS = -O3 +# +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.RS6K b/INSTALL/make.inc.RS6K index 05a4595f..6399a4ab 100644 --- a/INSTALL/make.inc.RS6K +++ b/INSTALL/make.inc.RS6K @@ -33,6 +33,19 @@ TIMER = EXT_ETIME_ # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = xlc +CFLAGS = -O3 -qmaxmem=-1 +# +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.SGI5 b/INSTALL/make.inc.SGI5 index 44c99d51..8375aa45 100644 --- a/INSTALL/make.inc.SGI5 +++ b/INSTALL/make.inc.SGI5 @@ -33,6 +33,18 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = cc +CFLAGS = -O4 +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.SUN4 b/INSTALL/make.inc.SUN4 index 7844fd4c..6d27db0a 100644 --- a/INSTALL/make.inc.SUN4 +++ b/INSTALL/make.inc.SUN4 @@ -33,6 +33,18 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = cc +CFLAGS = -O3 +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.SUN4SOL2 b/INSTALL/make.inc.SUN4SOL2 index 09e671fd..0b461622 100644 --- a/INSTALL/make.inc.SUN4SOL2 +++ b/INSTALL/make.inc.SUN4SOL2 @@ -37,6 +37,18 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = cc +CFLAGS = -O3 +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.gfortran b/INSTALL/make.inc.gfortran index 2672f8ea..95e8d315 100644 --- a/INSTALL/make.inc.gfortran +++ b/INSTALL/make.inc.gfortran @@ -33,6 +33,18 @@ TIMER = INT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = gcc +CFLAGS = -O3 +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.gfortran_debug b/INSTALL/make.inc.gfortran_debug index 459e06fe..8bfc6fbc 100644 --- a/INSTALL/make.inc.gfortran_debug +++ b/INSTALL/make.inc.gfortran_debug @@ -33,6 +33,18 @@ TIMER = INT_CPU_TIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = gcc +CFLAGS = -g +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.ifort b/INSTALL/make.inc.ifort index c07a9cfc..c4d18724 100644 --- a/INSTALL/make.inc.ifort +++ b/INSTALL/make.inc.ifort @@ -33,6 +33,18 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = icc +CFLAGS = -O3 +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # diff --git a/INSTALL/make.inc.pghpf b/INSTALL/make.inc.pghpf index 9b23868e..0d1437fa 100644 --- a/INSTALL/make.inc.pghpf +++ b/INSTALL/make.inc.pghpf @@ -33,6 +33,18 @@ TIMER = EXT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = pghpc +CFLAGS = +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # @@ -23,6 +23,12 @@ blaslib: lapacklib: lapack_install ( cd SRC; $(MAKE) ) +lapackelib: lapacklib + ( cd lapacke; $(MAKE) ) + +lapacke_example: lapackelib + ( cd lapacke/example; $(MAKE) ) + variants: ( cd SRC/VARIANTS ; $(MAKE)) @@ -87,6 +93,8 @@ cleanlib: ( cd SRC; $(MAKE) clean ) ( cd SRC/VARIANTS; $(MAKE) clean ) ( cd TESTING/MATGEN; $(MAKE) clean ) + ( cd lapacke; $(MAKE) clean ) + cleanblas_testing: ( cd BLAS/TESTING; $(MAKE) -f Makeblat1 clean ) diff --git a/lapacke/CMakeLists.txt b/lapacke/CMakeLists.txt new file mode 100644 index 00000000..df2fef98 --- /dev/null +++ b/lapacke/CMakeLists.txt @@ -0,0 +1,32 @@ +message(STATUS "LAPACKE enable") +enable_language(C) + +include_directories( include ) +#add_subdirectory(include) +add_subdirectory(src) +add_subdirectory(utils) + +macro(append_subdir_files variable dirname) +get_directory_property(holder DIRECTORY ${dirname} DEFINITION ${variable}) +foreach(depfile ${holder}) + list(APPEND ${variable} "${depfile}") +endforeach() +endmacro() + + +append_subdir_files(SRC_OBJ "src") +append_subdir_files(UTILS_OBJ "utils") + +add_library(lapacke ${SRC_OBJ} ${UTILS_OBJ}) +target_link_libraries(lapacke ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${XBLAS_LIBRARY}) +lapack_install_library(lapacke) + +if(BUILD_TESTING) + add_subdirectory(example) +endif(BUILD_TESTING) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lapacke.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc) + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/lapacke.pc + DESTINATION ${PKG_CONFIG_DIR} + ) diff --git a/lapacke/Makefile b/lapacke/Makefile index 5e04fbf8..5374697a 100644 --- a/lapacke/Makefile +++ b/lapacke/Makefile @@ -40,7 +40,7 @@ # To clean everything including lapacke library type # 'make cleanall' # -include make.inc +include ../make.inc all: lapacke @@ -48,6 +48,9 @@ lapacke: cd src && $(MAKE) cd utils && $(MAKE) +example: + cd example && $(MAKE) + clean: cleanlib cleanlib: @@ -56,4 +59,5 @@ cleanlib: cleanall: clean rm -f $(LAPACKE) + cd example && $(MAKE) clean diff --git a/lapacke/example/CMakeLists.txt b/lapacke/example/CMakeLists.txt new file mode 100644 index 00000000..4e1a4c9e --- /dev/null +++ b/lapacke/example/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(xexample_DGESV_rowmajor example_DGESV_rowmajor.c) +add_executable(xexample_ZGESV_rowmajor example_ZGESV_rowmajor.c) + +target_link_libraries(xexample_DGESV_rowmajor lapacke lapack ${BLAS_LIBRARIES}) +target_link_libraries(xexample_ZGESV_rowmajor lapacke lapack ${BLAS_LIBRARIES}) + +add_test(example_DGESV_rowmajor ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample_DGESV_rowmajor) +add_test(example_ZGESV_rowmajor ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample_ZGESV_rowmajor) diff --git a/lapacke/example/Makefile b/lapacke/example/Makefile new file mode 100644 index 00000000..ee9a017e --- /dev/null +++ b/lapacke/example/Makefile @@ -0,0 +1,16 @@ +include ../../make.inc + +all: xexample_DGESV_rowmajor xexample_ZGESV_rowmajor + +xexample_DGESV_rowmajor: example_DGESV_rowmajor.o ../../$(LAPACKLIB) ../../$(LAPACKELIB) + $(LOADER) $(LOADOPTS) example_DGESV_rowmajor.o \ + ../../$(LAPACKELIB) ../../$(LAPACKLIB) $(BLASLIB) -o $@ + ./$@ + +xexample_ZGESV_rowmajor: example_ZGESV_rowmajor.o ../../$(LAPACKLIB) ../../$(LAPACKELIB) + $(LOADER) $(LOADOPTS) example_ZGESV_rowmajor.o \ + ../../$(LAPACKELIB) ../../$(LAPACKLIB) $(BLASLIB) -o $@ + ./$@ + +.c.o: + $(CC) -c $(CFLAGS) -I ../include -o $@ $< diff --git a/lapacke/example/example_DGESV_rowmajor.c b/lapacke/example/example_DGESV_rowmajor.c new file mode 100644 index 00000000..274faa1b --- /dev/null +++ b/lapacke/example/example_DGESV_rowmajor.c @@ -0,0 +1,151 @@ +/******************************************************************************* +* Copyright (C) 2009-2011 Intel Corporation. All Rights Reserved. +* The information and material ("Material") provided below is owned by Intel +* Corporation or its suppliers or licensors, and title to such Material remains +* with Intel Corporation or its suppliers or licensors. The Material contains +* proprietary information of Intel or its suppliers and licensors. The Material +* is protected by worldwide copyright laws and treaty provisions. No part of +* the Material may be copied, reproduced, published, uploaded, posted, +* transmitted, or distributed in any way without Intel's prior express written +* permission. No license under any patent, copyright or other intellectual +* property rights in the Material is granted to or conferred upon you, either +* expressly, by implication, inducement, estoppel or otherwise. Any license +* under such intellectual property rights must be express and approved by Intel +* in writing. +* +******************************************************************************** +*/ +/* + LAPACKE_dgesv Example. + ====================== + + The program computes the solution to the system of linear + equations with a square matrix A and multiple + right-hand sides B, where A is the coefficient matrix: + + 6.80 -6.05 -0.45 8.32 -9.67 + -2.11 -3.30 2.58 2.71 -5.14 + 5.66 5.36 -2.70 4.35 -7.26 + 5.97 -4.44 0.27 -7.17 6.08 + 8.23 1.08 9.04 2.14 -6.87 + + and B is the right-hand side matrix: + + 4.02 -1.56 9.81 + 6.19 4.00 -4.09 + -8.22 -8.67 -4.57 + -7.57 1.75 -8.61 + -3.03 2.86 8.99 + + Description. + ============ + + The routine solves for X the system of linear equations A*X = B, + where A is an n-by-n matrix, the columns of matrix B are individual + right-hand sides, and the columns of X are the corresponding + solutions. + + The LU decomposition with partial pivoting and row interchanges is + used to factor A as A = P*L*U, where P is a permutation matrix, L + is unit lower triangular, and U is upper triangular. The factored + form of A is then used to solve the system of equations A*X = B. + + Example Program Results. + ======================== + + LAPACKE_dgesv (row-major, high-level) Example Program Results + + Solution + -0.80 -0.39 0.96 + -0.70 -0.55 0.22 + 0.59 0.84 1.90 + 1.32 -0.10 5.36 + 0.57 0.11 4.04 + + Details of LU factorization + 8.23 1.08 9.04 2.14 -6.87 + 0.83 -6.94 -7.92 6.55 -3.99 + 0.69 -0.67 -14.18 7.24 -5.19 + 0.73 0.75 0.02 -13.82 14.19 + -0.26 0.44 -0.59 -0.34 -3.43 + + Pivot indices + 5 5 3 4 5 +*/ +#include <stdlib.h> +#include <stdio.h> +#include "lapacke.h" + +/* Auxiliary routines prototypes */ +extern void print_matrix( char* desc, lapack_int m, lapack_int n, double* a, lapack_int lda ); +extern void print_int_vector( char* desc, lapack_int n, lapack_int* a ); + +/* Parameters */ +#define N 5 +#define NRHS 3 +#define LDA N +#define LDB NRHS + +/* Main program */ +int main() { + /* Locals */ + lapack_int n = N, nrhs = NRHS, lda = LDA, ldb = LDB, info; + /* Local arrays */ + lapack_int ipiv[N]; + double a[LDA*N] = { + 6.80, -6.05, -0.45, 8.32, -9.67, + -2.11, -3.30, 2.58, 2.71, -5.14, + 5.66, 5.36, -2.70, 4.35, -7.26, + 5.97, -4.44, 0.27, -7.17, 6.08, + 8.23, 1.08, 9.04, 2.14, -6.87 + }; + double b[LDB*N] = { + 4.02, -1.56, 9.81, + 6.19, 4.00, -4.09, + -8.22, -8.67, -4.57, + -7.57, 1.75, -8.61, + -3.03, 2.86, 8.99 + }; + /* Print Entry Matrix */ + print_matrix( "Entry Matrix A", n, n, a, lda ); + /* Print Right Rand Side */ + print_matrix( "Right Rand Side", n, nrhs, b, ldb ); + printf( "\n" ); + /* Executable statements */ + printf( "LAPACKE_dgesv (row-major, high-level) Example Program Results\n" ); + /* Solve the equations A*X = B */ + info = LAPACKE_dgesv( LAPACK_ROW_MAJOR, n, nrhs, a, lda, ipiv, + b, ldb ); + /* Check for the exact singularity */ + if( info > 0 ) { + printf( "The diagonal element of the triangular factor of A,\n" ); + printf( "U(%i,%i) is zero, so that A is singular;\n", info, info ); + printf( "the solution could not be computed.\n" ); + exit( 1 ); + } + /* Print solution */ + print_matrix( "Solution", n, nrhs, b, ldb ); + /* Print details of LU factorization */ + print_matrix( "Details of LU factorization", n, n, a, lda ); + /* Print pivot indices */ + print_int_vector( "Pivot indices", n, ipiv ); + exit( 0 ); +} /* End of LAPACKE_dgesv Example */ + +/* Auxiliary routine: printing a matrix */ +void print_matrix( char* desc, lapack_int m, lapack_int n, double* a, lapack_int lda ) { + lapack_int i, j; + printf( "\n %s\n", desc ); + for( i = 0; i < m; i++ ) { + for( j = 0; j < n; j++ ) printf( " %6.2f", a[i*lda+j] ); + printf( "\n" ); + } +} + +/* Auxiliary routine: printing a vector of integers */ +void print_int_vector( char* desc, lapack_int n, lapack_int* a ) { + lapack_int j; + printf( "\n %s\n", desc ); + for( j = 0; j < n; j++ ) printf( " %6i", a[j] ); + printf( "\n" ); +}
\ No newline at end of file diff --git a/lapacke/example/example_ZGESV_rowmajor.c b/lapacke/example/example_ZGESV_rowmajor.c new file mode 100644 index 00000000..fef9817d --- /dev/null +++ b/lapacke/example/example_ZGESV_rowmajor.c @@ -0,0 +1,145 @@ +/******************************************************************************* +* Copyright (C) 2009-2011 Intel Corporation. All Rights Reserved. +* The information and material ("Material") provided below is owned by Intel +* Corporation or its suppliers or licensors, and title to such Material remains +* with Intel Corporation or its suppliers or licensors. The Material contains +* proprietary information of Intel or its suppliers and licensors. The Material +* is protected by worldwide copyright laws and treaty provisions. No part of +* the Material may be copied, reproduced, published, uploaded, posted, +* transmitted, or distributed in any way without Intel's prior express written +* permission. No license under any patent, copyright or other intellectual +* property rights in the Material is granted to or conferred upon you, either +* expressly, by implication, inducement, estoppel or otherwise. Any license +* under such intellectual property rights must be express and approved by Intel +* in writing. +* +******************************************************************************** +*/ +/* + LAPACKE_zgesv Example. + ====================== + + The program computes the solution to the system of linear + equations with a square matrix A and multiple + right-hand sides B, where A is the coefficient matrix: + + ( 1.23, -5.50) ( 7.91, -5.38) ( -9.80, -4.86) ( -7.32, 7.57) + ( -2.14, -1.12) ( -9.92, -0.79) ( -9.18, -1.12) ( 1.37, 0.43) + ( -4.30, -7.10) ( -6.47, 2.52) ( -6.51, -2.67) ( -5.86, 7.38) + ( 1.27, 7.29) ( 8.90, 6.92) ( -8.82, 1.25) ( 5.41, 5.37) + + and B is the right-hand side matrix: + + ( 8.33, -7.32) ( -6.11, -3.81) + ( -6.18, -4.80) ( 0.14, -7.71) + ( -5.71, -2.80) ( 1.41, 3.40) + ( -1.60, 3.08) ( 8.54, -4.05) + + Description. + ============ + + The routine solves for X the system of linear equations A*X = B, + where A is an n-by-n matrix, the columns of matrix B are individual + right-hand sides, and the columns of X are the corresponding + solutions. + + The LU decomposition with partial pivoting and row interchanges is + used to factor A as A = P*L*U, where P is a permutation matrix, L + is unit lower triangular, and U is upper triangular. The factored + form of A is then used to solve the system of equations A*X = B. + + Example Program Results. + ======================== + + LAPACKE_zgesv (row-major, high-level) Example Program Results + + Solution + ( -1.09, -0.18) ( 1.28, 1.21) + ( 0.97, 0.52) ( -0.22, -0.97) + ( -0.20, 0.19) ( 0.53, 1.36) + ( -0.59, 0.92) ( 2.22, -1.00) + + Details of LU factorization + ( -4.30, -7.10) ( -6.47, 2.52) ( -6.51, -2.67) ( -5.86, 7.38) + ( 0.49, 0.47) ( 12.26, -3.57) ( -7.87, -0.49) ( -0.98, 6.71) + ( 0.25, -0.15) ( -0.60, -0.37) (-11.70, -4.64) ( -1.35, 1.38) + ( -0.83, -0.32) ( 0.05, 0.58) ( 0.93, -0.50) ( 2.66, 7.86) + + Pivot indices + 3 3 3 4 +*/ +#include <stdlib.h> +#include <stdio.h> +#include "lapacke.h" + +/* Auxiliary routines prototypes */ +extern void print_matrix( char* desc, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda ); +extern void print_int_vector( char* desc, lapack_int n, lapack_int* a ); + +/* Parameters */ +#define N 4 +#define NRHS 2 +#define LDA N +#define LDB NRHS + +/* Main program */ +int main() { + /* Locals */ + lapack_int n = N, nrhs = NRHS, lda = LDA, ldb = LDB, info; + /* Local arrays */ + lapack_int ipiv[N]; + lapack_complex_double a[LDA*N] = { + lapack_make_complex_double( 1.23, -5.50), lapack_make_complex_double( 7.91, -5.38), lapack_make_complex_double(-9.80, -4.86), lapack_make_complex_double(-7.32, 7.57), + lapack_make_complex_double(-2.14, -1.12), lapack_make_complex_double(-9.92, -0.79), lapack_make_complex_double(-9.18, -1.12), lapack_make_complex_double( 1.37, 0.43), + lapack_make_complex_double(-4.30, -7.10), lapack_make_complex_double(-6.47, 2.52), lapack_make_complex_double(-6.51, -2.67), lapack_make_complex_double(-5.86, 7.38), + lapack_make_complex_double( 1.27, 7.29), lapack_make_complex_double( 8.90, 6.92), lapack_make_complex_double(-8.82, 1.25), lapack_make_complex_double( 5.41, 5.37) + }; + lapack_complex_double b[LDB*N] = { + lapack_make_complex_double( 8.33, -7.32), lapack_make_complex_double(-6.11, -3.81), + lapack_make_complex_double(-6.18, -4.80), lapack_make_complex_double( 0.14, -7.71), + lapack_make_complex_double(-5.71, -2.80), lapack_make_complex_double( 1.41, 3.40), + lapack_make_complex_double(-1.60, 3.08), lapack_make_complex_double( 8.54, -4.05) + }; + /* Print Entry Matrix */ + print_matrix( "Entry Matrix A", n, n, a, lda ); + /* Print Right Rand Side */ + print_matrix( "Right Rand Side", n, nrhs, b, ldb ); + printf( "\n" ); + /* Executable statements */ + printf( "LAPACKE_zgesv (row-major, high-level) Example Program Results\n" ); + /* Solve the equations A*X = B */ + info = LAPACKE_zgesv( LAPACK_ROW_MAJOR, n, nrhs, a, lda, ipiv, b, ldb ); + /* Check for the exact singularity */ + if( info > 0 ) { + printf( "The diagonal element of the triangular factor of A,\n" ); + printf( "U(%i,%i) is zero, so that A is singular;\n", info, info ); + printf( "the solution could not be computed.\n" ); + exit( 1 ); + } + /* Print solution */ + print_matrix( "Solution", n, nrhs, b, ldb ); + /* Print details of LU factorization */ + print_matrix( "Details of LU factorization", n, n, a, lda ); + /* Print pivot indices */ + print_int_vector( "Pivot indices", n, ipiv ); + exit( 0 ); +} /* End of LAPACKE_zgesv Example */ + +/* Auxiliary routine: printing a matrix */ +void print_matrix( char* desc, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda ) { + lapack_int i, j; + printf( "\n %s\n", desc ); + for( i = 0; i < m; i++ ) { + for( j = 0; j < n; j++ ) + printf( " (%6.2f,%6.2f)", lapack_complex_double_real(a[i*lda+j]), lapack_complex_double_imag(a[i*lda+j]) ); + printf( "\n" ); + } +} + +/* Auxiliary routine: printing a vector of integers */ +void print_int_vector( char* desc, lapack_int n, lapack_int* a ) { + lapack_int j; + printf( "\n %s\n", desc ); + for( j = 0; j < n; j++ ) printf( " %6i", a[j] ); + printf( "\n" ); +}
\ No newline at end of file diff --git a/lapacke/include/CMakeLists.txt b/lapacke/include/CMakeLists.txt new file mode 100644 index 00000000..fd49e270 --- /dev/null +++ b/lapacke/include/CMakeLists.txt @@ -0,0 +1,6 @@ +ADD_CUSTOM_TARGET( include ALL DEPENDS + lapacke.h lapacke_config.h lapacke_utils.h ) + +INSTALL( + FILES lapacke.h lapacke_config.h + DESTINATION include ) diff --git a/lapacke/include/lapacke.h b/lapacke/include/lapacke.h index 03c23bfe..d9abf53a 100644 --- a/lapacke/include/lapacke.h +++ b/lapacke/include/lapacke.h @@ -84,7 +84,7 @@ extern "C" { #endif #ifndef lapack_complex_float_imag -#define lapack_complex_float_imag(z) (imag(z)) +#define lapack_complex_float_imag(z) (cimag(z)) #endif lapack_complex_float lapack_make_complex_float( float re, float im ); @@ -100,7 +100,7 @@ lapack_complex_float lapack_make_complex_float( float re, float im ); #endif #ifndef lapack_complex_double_imag -#define lapack_complex_double_imag(z) (imag(z)) +#define lapack_complex_double_imag(z) (cimag(z)) #endif lapack_complex_double lapack_make_complex_double( double re, double im ); diff --git a/lapacke/lapacke.pc.in b/lapacke/lapacke.pc.in new file mode 100644 index 00000000..9259fd0f --- /dev/null +++ b/lapacke/lapacke.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +libdir=@libdir@ + +Name: lapacke +Description: C Standard Interface to LAPACK Linear Algebra PACKage +Version: @LAPACKE_VERSION@ +URL: http://www.netlib.org/lapack/ +Libs: -L${libdir} -llapacke +Requires: lapack blas diff --git a/lapacke/make.gnu b/lapacke/make.gnu deleted file mode 100644 index f9afa6d5..00000000 --- a/lapacke/make.gnu +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: gcc -# Configuration file: turned off (default) -# Complex types: C99 (default) -# Name pattern: mixed case (default) -# (64-bit) Data model: LP64 (default) -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = gcc -CFLAGS = -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.gnu.complex_cpp b/lapacke/make.gnu.complex_cpp deleted file mode 100644 index 4253b9c6..00000000 --- a/lapacke/make.gnu.complex_cpp +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: g++ -# Configuration file: turned on -# Complex types: C++ -# Name pattern: mixed case (default) -# (64-bit) Data model: LP64 (default) -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -lstdc++ -# - gfortran, set: LINKER = gfortran -# LDFLAGS = -lstdc++ -# -CC = g++ -CFLAGS = -DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_CPP -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.gnu.lc b/lapacke/make.gnu.lc deleted file mode 100644 index 390a9c92..00000000 --- a/lapacke/make.gnu.lc +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: gcc -# Configuration file: turned on -# Complex types: C99 (default) -# Name pattern: lowercase -# (64-bit) Data model: LP64 (default) -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = gcc -CFLAGS = -DHAVE_LAPACK_CONFIG_H -DLAPACK_NAME_PATTERN_LC -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.gnu.uc.ilp64 b/lapacke/make.gnu.uc.ilp64 deleted file mode 100644 index a91fa4fb..00000000 --- a/lapacke/make.gnu.uc.ilp64 +++ /dev/null @@ -1,69 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: gcc -# Configuration file: turned on -# Complex types: C99 (default) -# Name pattern: uppercase -# (64-bit) Data model: ILP64 -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = gcc -CFLAGS = -DHAVE_LAPACK_CONFIG_H -DLAPACK_NAME_PATTERN_UC -DLAPACK_ILP64 -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# ILP64 model means that lapack.a and blas.a are built with -# -i8 option in case of ifort -# -fdefault-integer-8 option in case of gfortran -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.inc b/lapacke/make.inc deleted file mode 100644 index 7ba7f533..00000000 --- a/lapacke/make.inc +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: gcc -# Configuration file: turned off (default) -# Complex types: C99 (default) -# Name pattern: mixed case (default) -# (64-bit) Data model: LP64 (default) -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = gcc -CFLAGS = -LINKER = gfortran -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# -LAPACKE = lapacke.a -LIBS = /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/lapack_LINUX.a \ - /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/blas_LINUX.a -lm -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.intel b/lapacke/make.intel deleted file mode 100644 index a9c3226c..00000000 --- a/lapacke/make.intel +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: icc -# Configuration file: turned off (default) -# Complex types: C99 (default) -# Name pattern: mixed case (default) -# (64-bit) Data model: LP64 (default) -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = icc -CFLAGS = -O3 -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.intel.complex_structure b/lapacke/make.intel.complex_structure deleted file mode 100644 index 9f3d57fd..00000000 --- a/lapacke/make.intel.complex_structure +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: icc -# Configuration file: turned on -# Complex types: C structure -# Name pattern: mixed case (default) -# (64-bit) Data model: LP64 (default) -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = icc -CFLAGS = -O3 -DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.intel.lc.ilp64 b/lapacke/make.intel.lc.ilp64 deleted file mode 100644 index 5c57d833..00000000 --- a/lapacke/make.intel.lc.ilp64 +++ /dev/null @@ -1,69 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: icc -# Configuration file: turned on -# Complex types: C99 (default) -# Name pattern: lowercase -# (64-bit) Data model: ILP64 -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = icc -CFLAGS = -O3 -DHAVE_LAPACK_CONFIG_H -DLAPACK_NAME_PATTERN_LC -DLAPACK_ILP64 -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# ILP64 model means that lapack.a and blas.a are built with -# -i8 option in case of ifort -# -fdefault-integer-8 option in case of gfortran -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/make.intel.uc b/lapacke/make.intel.uc deleted file mode 100644 index 99f33e6a..00000000 --- a/lapacke/make.intel.uc +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################## -# Copyright (c) 2010, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -############################################################################## -# Contents: Native C interface to LAPACK -# Author: Intel Corporation -# September, 2010 -############################################################################## -# This is the make.inc example. The following settings are used: -# -# Compiler: icc -# Configuration file: turned on -# Complex types: C99 (default) -# Name pattern: uppercase -# (64-bit) Data model: LP64 (default) -# -# Basic include options. -# CC is the C compiler, normally invoked with options CFLAGS. -# LINKER is the linker, invoked with LDFLAGS. -# -# If libraries lapack.a and blas.a are built with -# - ifort, set: LINKER = ifort -# LDFLAGS = -nofor-main -# - gfortran, set: LINKER = gfortran -# -CC = icc -CFLAGS = -O3 -DHAVE_LAPACK_CONFIG_H -DLAPACK_NAME_PATTERN_UC -LINKER = $(CC) -LDFLAGS = -# -# The name of the libraries to be created/linked to -# Ensure that the libraries have the same data model (LP64/ILP64). -# -LAPACKE = lapacke.a -LIBS = ../../../lapack-3.2.1/lapack.a ../../../lapack-3.2.1/blas.a -lm -# -# The archiver and the flag(s) to use when building archive (library) -# If your system has no ranlib, set RANLIB = echo. -# -ARCH = ar -ARCHFLAGS = cr -RANLIB = ranlib diff --git a/lapacke/src/CMakeLists.txt b/lapacke/src/CMakeLists.txt new file mode 100644 index 00000000..c7d06ff2 --- /dev/null +++ b/lapacke/src/CMakeLists.txt @@ -0,0 +1,2 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SRC_OBJ) +#message(STATUS "LAPACKE obj= ${SRC_OBJ}") diff --git a/lapacke/src/Makefile b/lapacke/src/Makefile index 547d1809..694caab8 100644 --- a/lapacke/src/Makefile +++ b/lapacke/src/Makefile @@ -32,7 +32,7 @@ ############################################################################## # makefile for LAPACKE, used to build lapacke binary. # -include ../make.inc +include ../../make.inc C_FILES := $(wildcard *.c) OBJ_FILES := $(C_FILES:.c=.o) @@ -40,8 +40,8 @@ OBJ_FILES := $(C_FILES:.c=.o) all: lib lib: $(OBJ_FILES) - $(ARCH) $(ARCHFLAGS) ../$(LAPACKE) $(OBJ_FILES) - $(RANLIB) ../$(LAPACKE) + $(ARCH) $(ARCHFLAGS) ../../$(LAPACKELIB) $(OBJ_FILES) + $(RANLIB) ../../$(LAPACKELIB) .c.o: $(CC) -c $(CFLAGS) -I ../include -o $@ $< diff --git a/lapacke/utils/CMakeLists.txt b/lapacke/utils/CMakeLists.txt new file mode 100644 index 00000000..d2faeaf9 --- /dev/null +++ b/lapacke/utils/CMakeLists.txt @@ -0,0 +1 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} UTILS_OBJ) diff --git a/lapacke/utils/Makefile b/lapacke/utils/Makefile index feabac52..1d785678 100644 --- a/lapacke/utils/Makefile +++ b/lapacke/utils/Makefile @@ -32,7 +32,7 @@ ############################################################################## # makefile for LAPACKE, used to build lapacke binary. # -include ../make.inc +include ../../make.inc OBJ = lapacke_cgb_nancheck.o \ lapacke_cgb_trans.o \ @@ -186,8 +186,8 @@ OBJ = lapacke_cgb_nancheck.o \ all: lib lib: $(OBJ) - $(ARCH) $(ARCHFLAGS) ../$(LAPACKE) $(OBJ) - $(RANLIB) ../$(LAPACKE) + $(ARCH) $(ARCHFLAGS) ../../$(LAPACKELIB) $(OBJ) + $(RANLIB) ../../$(LAPACKELIB) .c.o: $(CC) -c $(CFLAGS) -I ../include -o $@ $< diff --git a/make.inc.example b/make.inc.example index 2672f8ea..95e8d315 100644 --- a/make.inc.example +++ b/make.inc.example @@ -33,6 +33,18 @@ TIMER = INT_ETIME # If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0 # TIMER = NONE # +# Configuration LAPACKE: Native C interface to LAPACK +# To generate LAPACKE library: type 'make lapackelib' +# Configuration file: turned off (default) +# Complex types: C99 (default) +# Name pattern: mixed case (default) +# (64-bit) Data model: LP64 (default) +# +# CC is the C compiler, normally invoked with options CFLAGS. +# +CC = gcc +CFLAGS = -O3 +# # The archiver and the flag(s) to use when building archive (library) # If you system has no ranlib, set RANLIB = echo. # |