Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28945 Discussions

How to Use Intel's Fortran Compiler with Abaqus

Barbara_P_Intel
Employee
12,078 Views

For those who want to use Intel's Fortran compiler with Abaqus on Windows, read this blog for detailed instructions.

 

1 Solution
Ron_Green
Moderator
561 Views

That file is not owned by the compiler development team.  It's part of the oneAPI files.  I opened a bug report to get the Forum link fixed:

bug ID is ONEAPI-835

View solution in original post

0 Kudos
18 Replies
JohnNichols
Valued Contributor III
12,060 Views

A really good set of instructions.  The young lady who developed the notes does some interesting work on unusual materials.  

Steve_Lionel
Honored Contributor III
12,051 Views

In the past this did not always work, with issues related to uppercase and lowercase letters. The user subroutine(s) could then not be found. If the .log file shows that the compiler is linked, and the .msg file mentions that the user subroutine is missing, then try this workaround (mentioned by Raul Munoz on our previous blog):

The following line can be added at the end of your environment file:

compile_fortran += ['/names:lowercase',]

AUGH! DO NOT DO THIS!!!!!! It will make things increasingly difficult for you. If you do have this issue, I'd suggest BIND(C) for your routine, or maybe !DEC$ ATTRIBUTES ALIAS. Lots of things won't work if you make everything lowercase.

0 Kudos
Cao__Yanmei
Beginner
12,021 Views

Hi Steve, I did everything as the link said except the lowercase stuff. ABAQUS verification shows errors related to user subroutines. I have no idea where is the problem... Any suggestion? Many thanks

 

0 Kudos
Ron_Green
Moderator
12,012 Views

Steve is suggesting using !DEC$ ATTRIBUTES ALIAS. 

 

 

As an example, let's say you have a subroutine "AbbyNormal" that you want to call and you want the subroutine name in all lower case, "abbynormal".  The code would look like this, roughly

 

 

!DEC$ ATTRIBUTES ALIAS:'abbynormal' :: AbbyNormal
subroutine AbbyNormal( x, n )
real :: x(n)
!do stuff
end subroutine AbbyNormal

 

 

I do not know Abaqus.  I was assuming somewhere in your Abaqus code/script you want to call your Fortran subroutine AbbyNormal with this example. I was just showing how to use ATTRIBUTES ALIAS to force the symbol for AbbyNormal to be all lower case.

 

 

0 Kudos
davidwarner
Beginner
9,034 Views

I followed all the steps mentioned in the link you provided, except for the lowercase modification. However, when I ran the ABAQUS verification, I encountered errors related to user subroutines. I am unsure where the issue lies. Do you have any suggestions?

Thank you very much.

 
0 Kudos
mecej4
Honored Contributor III
8,938 Views

There is not much that can be said based on "I encountered errors". You have to describe what commands you used, and report the exact wording of the error messages, if they are from the Intel Fortran compiler or other tools in the Fortran build system.

If the error messages are from Abaqus routines, you will have to wait until one of the few Abaqus users in this forum reads your post or, perhaps better, ask in an Abaqus forum.

I_Putu_Widiantara
7,887 Views

Dear Sir,

I think I have been able to link my Abaqus with the Fortran since I can run subroutine called UMAT. However, in some case, it will show error like this 

Begin Linking Abaqus/Standard User Subroutines
Creating library standardU.lib and object standardU.exp
libirc.lib(fast_mem_ops.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
End Linking Abaqus/Standard User Subroutines

 

and after that, Abaqus is not linked with the subroutines, which lead to error.

If you need more information, I'd be happy to provide it. 

 

Best regards

0 Kudos
Barbara_P_Intel
Employee
7,863 Views

Another developer suggests:

I had trouble running Abaqus with a “user subroutine” that I had built using oneAPI (on Windows in this case).  The simulation would start and then abruptly end without any error message.

The root cause was as follows.  I had (incorrectly) used a Fortran “stop” statement in my Abaqus user subroutine instead of the vendor-recommended XIT() procedure (I should have used “call XIT()”).

In oneAPI versions of ifort, the “stop” statement is linking to a for_stop_quiet() procedure in the runtime libs.  Apparently, older compilers called for_stop() and it seems for_stop_quiet() is new to oneAPI versions so the new procedure does not exist in older ifort runtime libs.

The problem is that recent versions of Abaqus are still distributed with older (pre-oneAPI) versions of the ifort runtime which do not contain the needed for_stop_quiet() procedure.  As a result, if you compile your user subroutine with oneAPI but then do not make sure the oneAPI runtime libs are first in the Abaqus path, the dll will try to link to the older ifort runtime that is missing the needed for_stop_quiet() procedure so the code just aborts.

I believe the newest versions of Abaqus finally have a oneAPI version of the ifort runtime libs.

The forum user may be able to resolve their issue by eliminating any “stop” or “error stop” statements and replacing with “call XIT()”.  Alternatively, they could also make sure that the oneAPI “setvars” is properly integrated into the Abaqus environment.

 

I_Putu_Widiantara
7,846 Views

Hello,

 

Thank you very much for your suggestion. I tried to change all "stop" or "error stop" statement and replacing them with "call XIT()" as instructed. I still see the "warning LNK4210" BUT my Abaqus analysis was COMPLETED instead of reporting error. I was wondering whether that warning means something. Anyway, so far the result showed convergent with the expected result. I am grateful for all the help I get in this forum. Thank you again for your help and everyone in this forum, I hope you and your family are well. 

In case you need my script, I'd be happy to provide it...

 

Best regards

 

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
8,909 Views

In the past, many years ago, when I experienced linker issues with names not matching between what I compiled and what the library had for entry points, I found it useful to produce the ASM listing to see what the compiler was generating. While this may have been done by looking at a linker map or one of the various object file tools (e.g. DUMPBIN.EXE), I found it more informative to look at the assembler listing. YMMV

 

Jim Dempsey

0 Kudos
I_Putu_Widiantara
7,890 Views

Dear Mrs. Barbara,

 

I have read the blog you mentioned and I found the instruction in the blog is no longer relevant. For instance, the blog instruct us to download the one API Base of 2019 in accordance to the Visual studio we are using. But when I click the link, I could not find the one API Base of 2019 and they only provide the newest version which is 2023.  Is there any way to obtain the old version of 2019?

 

Best regards,

0 Kudos
Barbara_P_Intel
Employee
7,864 Views

The current release of oneAPI should work just fine with Abaqus. 

You can only get previous versions if you pay for priority support

0 Kudos
ALOK_05
Beginner
1,042 Views

I am trying to link Abaqus 2021 with Fortran in Windows 10 system. VS version is 2022 and the tool kit is the latest version  2025,  after following every prescribed step. while verification asks me to add the infortvars.bat file which is not available in the present version. even I tried with setvars

0 Kudos
Steve_Lionel
Honored Contributor III
971 Views

setvars.bat is in C:\Program Files (x86)\Intel\oneAPI - ifortvars.bat (correct spelling) is obsolete.

0 Kudos
JohnNichols
Valued Contributor III
962 Views

 ifortvars.bat (correct spelling) is obsolete.  True.  

@Echo off

rem Copyright © Intel Corporation
rem SPDX-License-Identifier: MIT

rem Permission is hereby granted, free of charge, to any person obtaining a copy
rem of this software and associated documentation files (the "Software"), to deal
rem in the Software without restriction, including without limitation the rights
rem to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
rem copies of the Software, and to permit persons to whom the Software is
rem furnished to do so, subject to the following conditions:
rem
rem The above copyright notice and this permission notice shall be included in all
rem copies or substantial portions of the Software.
rem
rem THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
rem IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
rem FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
rem AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
rem LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
rem OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
rem SOFTWARE.


rem ===========================================================================
rem location of this bat file, without a trailing \ (backslash character)
set "ONEAPI_ROOT=%~dp0"
set "ONEAPI_ROOT=%ONEAPI_ROOT:~0,-1%"
set "script_name=%~nx0"
set topargs=%*

rem SETVARS_CALL
set SETVARS_CALL=1


goto :EndUsage
rem ===========================================================================
rem To be called if we encounter bad command-line args or user asks for help.

:Usage
  echo:
  echo: usage: setvars [--force] [--config=file] [--help] [...]
  echo:   --force        force setvars to re-run, doing so may overload environment
  echo:   --config=file  customize env vars using a setvars configuration file
  echo:   ...            additional args are passed to individual env\vars.bat scripts
  echo:                  additional args must follow this script's arguments
  echo:
  echo:   --help         display this help message and exit
  echo:   -? or /?       display this help message and exit
  echo:
  echo: The oneAPI toolkits no longer support 32-bit libraries, starting with the 2025.0 toolkit release. See the oneAPI release notes for more details.
  echo:
goto :eofCleanup
:EndUsage


rem ===========================================================================
rem setup default arguments
set configpath=""
set config_arg_found=""
set force=-1
set ia32=0

rem Parse command-line arguments passed to this script.
rem --config removal from topargs may result in a dangling ' = ' that is safely ignored.
rem Unable to capture path/filenames containing right parenthesis characters.
rem see: https://ss64.com/nt/syntax-brackets.html
rem see: https://www.dostips.com/DtTipsStringManipulation.php#Snippets.Remove
setlocal EnableDelayedExpansion
set "_topargs=%topargs%"
set "_force=%force%"
:ParseParam
  if [%~1] == [--config] (
    set "_config_arg_found=1"
    if NOT ["%~2"] == [""] (
      set "_configpath="%~2""
      set "_tempconfigpath=%~2"
      call set _topargs=%%_topargs:--config=%%
      call set _topargs=%%_topargs:!_tempconfigpath!=%%
      shift
    ) else (
      set _configpath=""
      call set _topargs=%%_topargs:--config=%%
    )
  ) else if [%~1] == [--force] (
      set "_force=1"
      set "_topargs=%_topargs:--force=%"
  ) else if [%~1] == [--ia32] (
      set "_ia32=1"
      set "_topargs=%_topargs:--ia32=%" 
  ) else if [%~1] == [ia32] (
      set "_ia32=1"
      set "_topargs=%_topargs:ia32=%" 
  ) else if [%~1] == [--help] (
      call :Usage
      goto :eofCleanup
  ) else if [%~1] == [-?] (
      call :Usage
      goto :eofCleanup
  ) else if [%~1] == [/?] (
      call :Usage
      goto :eofCleanup
  )

  shift

  if [%~1] neq [] (
    goto :ParseParam
  )
:EndParseParam
endlocal & set "topargs=%_topargs%" & set "config_arg_found=%_config_arg_found%" & set "configpath=%_configpath%" & set "force=%_force%" & set "ia32=%_ia32%"

rem Handle special case where "" are missing around %configpath% variable.
if [%configpath%] == [] (
  set configpath=""
)

rem Setvars design only accommodates single word arguments.
rem Some of the env\vars.bat scripts choke on quoted arguments.
rem Remove any remaining " characters from passed argument array.
rem Removing " chars is touchy, removing "=" chars seems to be impossible.
rem First line (below) ensures that at least one " is found by second line.
set topargs=%topargs%"
set topargs=%topargs:"=%

if ["%ia32%"] == ["1"] (
  echo :: ERROR: The oneAPI toolkits no longer support 32-bit libraries, starting with the 2025.0 toolkit release. See the oneAPI release notes for more details.
  call :Usage
  goto :eofCleanup
)

rem ===========================================================================
rem Override default 64-bit target if 32-bit Visual Studio env already exists.
rem Primarily affects "classic" compilers and some libraries (e.g., IPP, MKL).
if defined VSCMD_VER (
  if /i [%VSCMD_ARG_TGT_ARCH%] == [x86] (
    echo :: ERROR: The oneAPI toolkits no longer support 32-bit libraries, starting with the 2025.0 toolkit release. See the oneAPI release notes for more details.
    call :Usage
    goto :eofCleanup
  ) else (
    set TARGET_ARCH=intel64
  )
)
set "topargs=%topargs% %TARGET_ARCH%"


rem ===========================================================================
rem Capture bad config files first helps prevent confusing error messages.
rem Especially when no config file was provided, potentially consuming a valid option.
if ["%config_arg_found%"] == ["1"] (
  if [%configpath%] == [""] (
    echo :: ERROR: --config option specified but no config filename provided.
    call :Usage
    goto :eofCleanup
  )
  if NOT EXIST %configpath% (
    echo :: ERROR: --config file not found: %configpath%
    call :Usage
    goto :eofCleanup
  )
)


rem ===========================================================================
if ["%SETVARS_COMPLETED%"] == ["1"] (
  if [%force%] == [-1] (
    echo :: WARNING: %script_name% has already been run. Skipping re-execution.
    echo:   To force a re-execution of %script_name%, use the '--force' option.
    echo:   Using '--force' can result in excessive use of your environment variables.
    goto :eofCleanup
  )
)


rem ===========================================================================
rem setup default configuration
set componentArray[default]=latest

rem load configuration from file
if ["%config_arg_found%"] == ["1"] (
  for /F "usebackq tokens=1,2 delims==" %%i in (%configpath%) do call :BuildConfigList %%i %%j
)
goto :EndBuildConfigList

:BuildConfigArray
  rem Creates componentArray members in the global environment space and
  rem trims any whitespace from the component name and version name/value.
  set "componentArray[%1]=%2"
  set "componentName=%1"
  set "componentVersion=%2"
exit /b

:BuildConfigList
  call :BuildConfigArray %1 %2
  if "%componentName%" == "default" (
    if NOT "%componentVersion%" == "exclude" (
      if NOT "%componentVersion%" == "latest" (
        echo :: ERROR: Bad "default=%componentVersion%" entry in %configpath% file.
        echo:   Only "default=latest" and "default=exclude" are supported.
        call :eofCleanup
        goto :nonExistentLabel || exit /b 1
      )
    ) else (
      echo :: NOTE: "default=exclude" entry found in %configpath% file.
      echo:   Only explicitly specified components will be processed by "%script_name%".
    )
  ) else if EXIST "%ONEAPI_ROOT%\%componentName%\" (
      if NOT "exclude" == "%componentVersion%" (
        if NOT EXIST "%ONEAPI_ROOT%\%componentName%\%componentVersion%\env\vars.bat" (
          echo :: ERROR: Bad config file entry.
          echo:   Unrecognized version "%componentVersion%" for "%componentName%" component specified in %configpath% file.
          call :eofCleanup
          goto :nonExistentLabel || exit /b 1
        )
      ) else (
        echo :: NOTE: Exclude flag found for "%componentName%" component.
        echo:   The "%componentName%" env\vars.bat script will not be processed by "%script_name%".
      )
  ) else (
      echo :: ERROR: Bad config file entry.
      echo:   Unrecognized component "%componentName%" specified in %configpath% file.
      call :eofCleanup
      goto :nonExistentLabel || exit /b 1
  )
exit /b
:EndBuildConfigList


rem ===========================================================================
title Intel(r) oneAPI
echo :: initializing oneAPI environment...

rem ===========================================================================
rem Call Microsoft Visual Studio env scripts, if not already configured.
echo:   Initializing Visual Studio command-line environment...

rem The check for an existing install of the Visual Studio command-line
rem environment is honored, even if this is a --force run. In other words, we will
rem always retain any prior init of the Visual Studio environment, which may be
rem due to a prior run of setvars.bat or because the end-user opened one of the
rem Visual Studio terminal sessions from the Windows Start Menu (in the Visual
rem Studio group) and then ran setvars.bat in that terminal session. This is done
rem because running the Visual Studio command-line environment scripts more then
rem once in the same session has been shown to result in unpredictable
rem side-effects, indicating that it is designed to only be run once in a terminal
rem session.

if not defined VSCMD_VER (
  call "%ONEAPI_ROOT%\setvars-vcvarsall.bat" %topargs%
)
if defined VSCMD_VER (
  echo:   Visual Studio version %VSCMD_VER% environment configured.
  echo:   "%VSINSTALLDIR%"
  if "%VSCMD_ARG_HOST_ARCH%" NEQ "%VSCMD_ARG_TGT_ARCH%" (
    echo:   Visual Studio command-line environment initialized for: '%VSCMD_ARG_HOST_ARCH%_%VSCMD_ARG_TGT_ARCH%'
  ) else (
    echo:   Visual Studio command-line environment initialized for: '%VSCMD_ARG_TGT_ARCH%'
  )
) else (
  echo:   Visual Studio command-line environment was not configured.
)


rem ===========================================================================
rem loop thru component directories (see :DoIt), calling vars.bat for each one
rem see: https://stackoverflow.com/a/17113667/2914328 regarding the '^' character
for /f "delims=" %%d in ( 'dir /a:d /b "%ONEAPI_ROOT%" 2^>nul' ) do call :DoIt "%%d"
goto EndDoIt

:DoIt
  set "componentpath=%ONEAPI_ROOT%\%~1"
  set "cname=%~n1"

  rem Grab component version from componentArray if specified by a config file.
  setlocal EnableDelayedExpansion
  set version=!componentArray[%cname%]!
  endlocal & set "version=%version%"

  rem Else if not specified in a config file, use default version.
  if "%version%" equ ""  (
    set version=%componentArray[default]%
  )

  if "exclude" == "%version%"  (
    rem echo:   "excluding"
  ) else (
    if EXIST "%componentpath%\%version%\env\vars.bat" (
      echo :  %cname% -- %version%
      rem 'call' command is not properly handling special characters, even when quoted, use pushd/popd
      pushd "%componentpath%\%version%\env"
      call vars.bat %topargs%
      popd
    ) else (
      rem echo:   %cname% vars.bat file not found in "%componentpath%\%version%\env\vars.bat"
    )
  )
exit /b
:EndDoIt

set SETVARS_COMPLETED=1
echo :: oneAPI environment initialized ::
title Intel(r) oneAPI
goto :keepTitle

rem Call or jump to in order to insure a clean exit from this script.
rem see: https://ss64.com/nt/exit.html
:eofCleanup
title cmd
:keepTitle
set "SETVARS_CALL="
set "script_name="
set "topargs="
set "configpath="
set "config_arg_found="
set "force="
set "ia32="
set "componentpath="
set "cname="
set "version="
set "componentArray[default]="
set "componentName="
set "componentVersion="
set "TARGET_ARCH="
for /f "delims=" %%d in ( 'dir /a:d /b "%ONEAPI_ROOT%"' ) do set "componentArray[%%d]="

goto:eof

 Setvars is entirely old DOS, but the text component in the INTEL FORUM does not recognize the style?   I feel sorry for the poor person who has to dig into 40 year old code.  

0 Kudos
JohnNichols
Valued Contributor III
952 Views

Immediately underneath the setvar.bat file is a file with the README sign named SUPPORT.TXT

It is interesting, 

For support options please see: https://software.intel.com/en-us/oneapi/support

For user forum support please see: https://software.intel.com/en-us/forum

Forums are critical to a developing system. Luckily Intel has an excellent system, not true elsewhere. 

 

0 Kudos
Steve_Lionel
Honored Contributor III
897 Views

I'm not surprised that the support comment in that file hasn't been updated in years.

0 Kudos
Ron_Green
Moderator
562 Views

That file is not owned by the compiler development team.  It's part of the oneAPI files.  I opened a bug report to get the Forum link fixed:

bug ID is ONEAPI-835

0 Kudos
Reply