编译 intel MKL的一个fortran77 example DSYEV Example Program in Fortran

阅读: 评论:0

编译 intel MKL的一个fortran77 example DSYEV Example Program in Fortran

编译 intel MKL的一个fortran77 example DSYEV Example Program in Fortran

DSYEV Example Program in Fortran

.html

1. 示例代码

 copy from hyperlink up:

*  Copyright (C) 2009-2015 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.
*  =============================================================================
*
*  DSYEV Example.
*  ==============
*
*  Program computes all eigenvalues and eigenvectors of a real symmetric
*  matrix A:
*
*    1.96  -6.49  -0.47  -7.20  -0.65
*   -6.49   3.80  -6.39   1.50  -6.34
*   -0.47  -6.39   4.17  -1.51   2.67
*   -7.20   1.50  -1.51   5.70   1.80
*   -0.65  -6.34   2.67   1.80  -7.10
*
*  Description.
*  ============
*
*  The routine computes all eigenvalues and, optionally, eigenvectors of an
*  n-by-n real symmetric matrix A. The eigenvector v(j) of A satisfies
*
*  A*v(j) = lambda(j)*v(j)
*
*  where lambda(j) is its eigenvalue. The computed eigenvectors are
*  orthonormal.
*
*  Example Program Results.
*  ========================
*
* DSYEV Example Program Results
*
* Eigenvalues
* -11.07  -6.23   0.86   8.87  16.09
*
* Eigenvectors (stored columnwise)
*  -0.30  -0.61   0.40  -0.37   0.49
*  -0.51  -0.29  -0.41  -0.36  -0.61
*  -0.08  -0.38  -0.66   0.50   0.40
*   0.00  -0.45   0.46   0.62  -0.46
*  -0.80   0.45   0.17   0.31   0.16
*  =============================================================================
*
*     .. Parameters ..INTEGER          NPARAMETER        ( N = 5 )INTEGER          LDAPARAMETER        ( LDA = N )INTEGER          LWMAXPARAMETER        ( LWMAX = 1000 )
*
*     .. Local Scalars ..INTEGER          INFO, LWORK
*
*     .. Local Arrays ..DOUBLE PRECISION A( LDA, N ), W( N ), WORK( LWMAX )DATA             A/$  1.96, 0.00, 0.00, 0.00, 0.00,$ -6.49, 3.80, 0.00, 0.00, 0.00,$ -0.47,-6.39, 4.17, 0.00, 0.00,$ -7.20, 1.50,-1.51, 5.70, 0.00,$ -0.65,-6.34, 2.67, 1.80,-7.10$                  /
*
*     .. External Subroutines ..EXTERNAL         DSYEVEXTERNAL         PRINT_MATRIX
*
*     .. Intrinsic Functions ..INTRINSIC        INT, MIN
*
*     .. Executable Statements ..WRITE(*,*)'DSYEV Example Program Results'
*
*     Query the optimal workspace.
*LWORK = -1CALL DSYEV( 'Vectors', 'Upper', N, A, LDA, W, WORK, LWORK, INFO )LWORK = MIN( LWMAX, INT( WORK( 1 ) ) )
*
*     Solve eigenproblem.
*CALL DSYEV( 'Vectors', 'Upper', N, A, LDA, W, WORK, LWORK, INFO )
*
*     Check for convergence.
*IF( INFO.GT.0 ) THENWRITE(*,*)'The algorithm failed to compute eigenvalues.'STOPEND IF
*
*     Print eigenvalues.
*CALL PRINT_MATRIX( 'Eigenvalues', 1, N, W, 1 )
*
*     Print eigenvectors.
*CALL PRINT_MATRIX( 'Eigenvectors (stored columnwise)', N, N, A,$                   LDA )STOPEND
*
*     End of DSYEV Example.
*
*  =============================================================================
*
*     Auxiliary routine: printing a matrix.
*SUBROUTINE PRINT_MATRIX( DESC, M, N, A, LDA )CHARACTER*(*)    DESCINTEGER          M, N, LDADOUBLE PRECISION A( LDA, * )
*INTEGER          I, J
*WRITE(*,*)WRITE(*,*) DESCDO I = 1, MWRITE(*,9998) ( A( I, J ), J = 1, N )END DO
*9998 FORMAT( 11(:,1X,F6.2) )RETURNEND

将上面代码存储为: ex_dsyev.f

2. 下载lapack-3.11:
wget .
3. 解压lapack并copy make.inc:
tar zxvf v3.
cd lapack-3.11
cp ample make.inc

并且编辑 lapack-3.11/make.inc,将其中的-O3 -O2等等,改成-g

编译lapack-3.11/Makefile,将其中

lib: lapacklib tmglib
修改为:
lib:  blaslib variants lapacklib tmglib lapackelib lapacke_example
 

4. 编译lapack:
make -j
5. 安装lapack lib:
cp LAPACKE/include/*.h /home/hipper/ex/ex_fortran/sdk_lapack/include/
cp *.a /home/hipper/ex/ex_fortran/sdk_lapack/lib/

 其中的*.a 如下:

liblapack.a  liblapacke.a  librefblas.a  libtmglib.a

6. 编译fortran示例:
gfortran -g ex_dsyev.f -L /home/hipper/ex/ex_fortran/sdk_lapack/lib/ -llapack -lrefblas
7. 运行:

 

本文发布于:2024-02-01 21:02:15,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170679253439399.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:MKL   intel   Fortran   Program   DSYEV
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23