如何在Abaqus子例程中包含英特尔MKL

时间:2017-03-08 13:16:36

标签: fortran subroutine intel-mkl abaqus

我正在尝试在ABAQUS UMAT中包含英特尔数学核心库的内置子程序。 我包括了' mkl.fi'但它显示的错误如下所示(这是ABAQUS生成的作业文件):

Abaqus JOB Job-1
Abaqus 6.13-1

Begin Compiling Abaqus/Standard User Subroutines

3/8/2017 6:14:23 PM

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on 
Intel(R) 64, Version 17.0.1.143 Build 20161005

Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.


C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(29): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE CGEJSV( JOBA, JOBU, JOBV, JOBR, JOBT, JOBP,            &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(30): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                  M, N, A, LDA, SVA, U, LDU, V, LDV,              &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(34): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      COMPLEX           A( LDA, * ),  U( LDU, * ), V( LDV, * ),         &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(43): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE ZGEJSV( JOBA, JOBU, JOBV, JOBR, JOBT, JOBP,            &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(44): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                   M, N, A, LDA, SVA, U, LDU, V, LDV,             &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(48): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      DOUBLE COMPLEX     A( LDA, * ),  U( LDU, * ), V( LDV, * ),        &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(57): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE DGESVDX( JOBU, JOBVT, RANGE, M, N, A, LDA, VL, VU,     &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(58): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                   IL, IU, NS, S, U, LDU, VT, LDVT, WORK,         &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(64): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      DOUBLE PRECISION   A( LDA, * ), S( * ), U( LDU, * ),              &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(70): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE SGESVDX( JOBU, JOBVT, RANGE, M, N, A, LDA, VL, VU,     &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(71): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                   IL, IU, NS, S, U, LDU, VT, LDVT, WORK,         &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(77): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      REAL               A( LDA, * ), S( * ), U( LDU, * ),              &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(83): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE CGESVDX( JOBU, JOBVT, RANGE, M, N, A, LDA, VL, VU,     &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(84): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                   IL, IU, NS, S, U, LDU, VT, LDVT, WORK,         &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(91): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      COMPLEX            A( LDA, * ), U( LDU, * ), VT( LDVT, * ),       &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(97): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE ZGESVDX( JOBU, JOBVT, RANGE, M, N, A, LDA, VL, VU,     &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(98): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                   IL, IU, NS, S, U, LDU, VT, LDVT, WORK,         &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(105): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      COMPLEX*16         A( LDA, * ), U( LDU, * ), VT( LDVT, * ),       &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(111): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE CGESVJ( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,    &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(121): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE ZGESVJ( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,    &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(131): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE DGGSVD3( JOBU, JOBV, JOBQ, M, N, P, K, L, A, LDA, B,   &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(132): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                   LDB, ALPHA, BETA, U, LDU, V, LDV, Q, LDQ, WORK,&
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(135): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      INTEGER            INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, P,  &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(138): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      DOUBLE PRECISION   A( LDA, * ), ALPHA( * ), B( LDB, * ),          &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(139): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
     &                   BETA( * ), Q( LDQ, * ), U( LDU, * ),           &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(145): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
      SUBROUTINE SGGSVD3( JOBU, JOBV, JOBQ, M, N, P, K, L, A, LDA, B,   &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(146): error #5082: Syntax error, found '&' when expecting one of: * <IDENTIFIER>
     &                   LDB, ALPHA, BETA, U, LDU, V, LDV, Q, LDQ, WORK,&
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(149): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      INTEGER            INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, P,  &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(152): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
      REAL               A( LDA, * ), ALPHA( * ), B( LDB, * ),          &
------------------------------------------------------------------------^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\mkl\include\MKL_lapack.FI(153): error #5082: Syntax error, found '&' when expecting one of: <IDENTIFIER> %FILL
     &                   BETA( * ), Q( LDQ, * ), U( LDU, * ),           &
------------------------------------------------------------------------^
AFEM.for(170): catastrophic error: Too many errors, exiting
compilation aborted for AFEM.for (code 1)
Abaqus Error: Problem during compilation - D:\Google Drive\Friday_May_27_2016\Mtech Thesis Job\All new work\TA\AFEM.for
Abaqus/Analysis exited with errors

如果未包含MKL库,作业文件将显示以下错误:

----------
Abaqus JOB Job-1

Abaqus 6.13-1

Abaqus License Manager checked out the following licenses:


Begin Compiling Abaqus/Standard User Subroutines
3/8/2017 6:18:48 PM

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.1.143 Build 20161005

Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.


End Compiling Abaqus/Standard User Subroutines

Begin Linking Abaqus/Standard User Subroutines


Creating library standardU.lib and object standardU.exp

AFEM.obj : error LNK2019: unresolved external symbol dgemm referenced in function umat.R

standardU.dll : fatal error LNK1120: 1 unresolved externals

Abaqus Error: Problem during linking - Abaqus/Standard User Subroutines.

This error may be due to a mismatch in the Abaqus user subroutine arguments.

这些参数有时会在发行版之间发生变化,因此用户子程序也是如此   与之前版本的Abaqus一起使用可能需要进行调整。

Abaqus / Analysis退出时出现错误

源代码在ABAQUS外部编译时工作正常,没有错误。 如果我无法在ABAQUS UMAT子例程中包含此lapack库,我可能必须在我的代码本身中附加lapack源代码。这可能会引发其他问题。

那么有没有办法成功地在ABAQUS中编译这些lapack子程序。 请注意,ABAQUS用户子程序(UMAT)写在&#39; .for&#39;格式。 我已经包含了UMAT(ABAQUS子程序)以供参考。它有&mul_big_mat&#39; (表示乘以大矩阵)子程序使用lapack&#39; dgemm&#39;子程序。

    C================================================================

          SUBROUTINE UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,
         1RPL,DDSDDT,DRPLDE,DRPLDT,STRAN,DSTRAN,
         2TIME,DTIME,TEMP,DTEMP,PREDEF,DPRED,MATERL,NDI,NSHR,NTENS,
         3NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,CELENT,
         4DFGRD0,DFGRD1,NOEL,NPT,KSLAY,KSPT,KSTEP,KINC)
    C
          INCLUDE 'ABA_PARAM.INC'
    C
          CHARACTER*80 MATERL
          DIMENSION STRESS(NTENS),STATEV(NSTATV),
         1DDSDDE(NTENS,NTENS),DDSDDT(NTENS),DRPLDE(NTENS),
         2STRAN(NTENS),DSTRAN(NTENS),TIME(2),PREDEF(1),DPRED(1),
         3PROPS(NPROPS),COORDS(3),DROT(3,3),
         4DFGRD0(3,3),DFGRD1(3,3)
    C
          DIMENSION EELAS(6),EPLAS(6),FLOW(6)
          PARAMETER (ONE=1.0D0,TWO=2.0D0,THREE=3.0D0,SIX=6.0D0)
          DATA NEWTON,TOLER/10,1.D-6/
    C
    C ============================================================================
    C     UMAT FOR 1D BAR
    C 

    ============================================================================
        C     Note :- This UMAT can only be used by 1D elements
        C
        C     Number of material properties, nprops = 1
        C     props(1)         Young's modulus in x direction
        C ---------------------------------------------------------------------
        C
              ! --- local variables
              DOUBLE PRECISION E
              DOUBLE PRECISION C(ntens, ntens)
              integer z
        !***********************************************************************

        ! *** Get Elastic properties
              E = props(1)
              write(*,*)''
              write(*,*) z
              write(*,*)''
        ! *** Elastic stiffness Cijkl *** !
              C(1,1) = E
              !call hello_world3
              CALL mul_big_mat

        ! *** calculate the stress *** !
              stress(1) = C(1,1)*(stran(1) + dstran(1))

        !     Updating Jacobian matrix
              ddsdde(1,1) = C(1,1)
              return
              END

              subroutine hello_world3
              implicit none
              character*32 text
        c
              write(*,*)'Hello World'
        c
              END

              subroutine mul_big_mat    
        c
        c
              integer m, n, k, i, j
              parameter (m=100,  k= 200, n=100)
              double precision a(m,k), b(k,n), c(m,n), alpha, beta
              alpha=1.0
              beta=0.0
        c      matrix a declaration       
              do i=1,m
                  do j=1,k
                      a(i,j)=i+j
                  enddo
              enddo
              write(*,*) a(100,200)
        c      matrix b declaration       
              do i=1,k
                  do j=1,n
                      b(i,j)=i-j
                  enddo
              enddo
              write(*,*) b(200,100)
        c      matrix c declaration       
              do i=1,m
                  do j=1,n
                      c(i,j)=0.0
                  enddo
              enddo
              call dgemm('n','n',m,n,k,alpha,a,m,b,k,beta,c,m)
! THIS IS THE SUBROUTINE I WANT TO USE FROM INTEL MKL LIBRARY
! I COULD USE MATMUL (AND THAT WORKS FINE), BUT ITS JUST AN EXAMPLE
! I HAVE TO USE 'DGETRI' AND MANY MORE
              write(*,*) c(1,1)
              do i=1,m
                  do j=1,n
                      write(*,*) ' '
                      write(*,*) c(i,j)
                  enddo
              enddo
              END

1 个答案:

答案 0 :(得分:1)

看起来您正在将自由格式(.f90)文件编译为固定格式(旧FORTRAN 77样式)文件。你不能使用&amp;在固定形式.f或.for文件的行和。

您的源文件是.for文件(AFEM.for),您的代码应采用固定格式。您可以尝试ABAQUS是否支持-free编译器标志以强制执行自由格式。如果没有,你必须在任何地方使用固定的表格。

小心不要将固定格式和自由格式的部分混合在一个文件中。文件MKL_lapack.FI似乎与原始来源不兼容。遗憾的是,你没有表明你是如何将此包括在内的。

但是,您根本不需要包含include文件!您应该只使用正确的库链接。使用英特尔MKL Link Line Advisor https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor派生正确的链接器标志。