Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26732 Discussions

How to modify ABAQUS env file to include external fortran libraries

fam__fen
Beginner
810 Views

As I know, ABAQUS use IVF as default fortran compiler. I want to call external libraries in ABAQUS subroutine but I don't know how to include them during compiling and linking. I have searched many documents, then I fould the win86_64.env(my pc is WIN10, 64bit) might need to be modified.

compile_fortran

Fortran compile command. The command used at SIMULIA is included in the platform-specific environment file (win86_64.env or lnx86_64.env) in the solvers_install_dir/os/SMA/site/ subdirectory of the Abaqus services installation. This command should not normally be changed. It may be either a string or a tuple of strings. If the command is a tuple of strings, each string must represent a single command line argument.

The compilation of Fortran files using Fortran 90 freeform specifications is not supported by default. The abaqus_v6.env file in the /SMA/site/ subdirectory of the Abaqus installation includes comments that discuss the compile options.

link_exe

Command to link a postprocessing program. The command used at SIMULIA is included in the platform-specific environment file (win86_64.env or lnx86_64.env) in the solvers_install_dir/os/SMA/site/ subdirectory of the Abaqus services installation. This command should not normally be changed. It can be either a string or a tuple of strings. If the command is a tuple of strings, each string must represent a single command line argument. The values of the placemarkers are determined by the Abaqus execution procedure or by the command line options and cannot be modified by the user. User-specified external libraries can be linked with the usual link commands. The following placemarkers are used in link_exe:

%J

The job name (in this case the name of the executable to be created).

%F

The name of the object file created from the user's source file.

%M

The name of the internally created main object file.

%B

The name of the shared library of utility functions.

%O

The list of utility shared libraries for the output database application public interface.

%L

The list of directories containing shared libraries (HP only).

link_sl

Command to link a shared library. The command used at SIMULIA is included in the platform-specific environment file (win86_64.env or lnx86_64.env) in the solvers_install_dir/os/SMA/site/ subdirectory of the Abaqus services installation. This command, once its placemarkers have been exchanged, must be a valid command on the computer system where the shared library is linked. This command can be either a string or a tuple of strings. If the command is a tuple of strings, each string must represent a single command line argument. The values of the placemarkers are determined by the Abaqus execution procedure or by the command line options and cannot be modified by the user. The values of the placemarkers replace the placemarkers in the link_sl string. User-specified external libraries can be linked with the usual link commands. The following placemarkers are available:

%F

The name of the compiled object file.

%U

The name of the shared library.

%A

The name of the archive of compiled object files to be linked into the shared library.

%B

The name of the shared library of utility functions.

%E

The name of the file containing the names of the symbols to be exported from the shared library.

%L

The list of directories containing shared libraries (HP only).

These are several paragraphs that might be important as below

compile_cpp=['cl', '/c', '/W0', '/MD', '/TP',
             '/EHsc', '/DNDEBUG', '/DWIN32', '/DTP_IP', '/D_CONSOLE',
             '/DNTI', '/DFLT_LIC', '/DOL_DOC', '/D__LIB__', '/DHKS_NT',
             '/D_WINDOWS_SOURCE', '/DFAR=', '/D_WINDOWS', '/DABQ_WIN86_64', '%P',
             # '/O1', # <-- Optimization
             # '/Zi', # <-- Debug symbols
             '/I%I', '/I'+abaHomeInc]

compile_fmu=['win64CmpWrp', '-m64', '-msvc9', 'cl', '/LD', 
             '/D_WINDOWS', '/TC', '/W0',  '/I%I', '/I'+abaHomeInc]

compile_fortran=['ifort',
                 '/c', '/fpp', '/extend-source', 
                 '/DABQ_WIN86_64','/Qmkl:sequential',  '/DABQ_FORTRAN',
                 '/iface:cref',  '/recursive',
                 '/Qauto',  # <-- important for thread-safety of parallel user subroutines
                 '/align:array64byte',
                 '/Qpc64',                    # set FPU precision to 53 bit significand
                 '/Qprec-div', '/Qprec-sqrt', # improve precision of FP divides and sqrt
                 '/Qfma-',                    # disable floating point fused multiply-add
                 '/fp:precise',               # floating point model: precise 
                 '/Qimf-arch-consistency:true', # math library consistent results
                 '/Qfp-speculation:safe',     # floating point speculations only when safe
                 '/Qprotect-parens',          # honor parenthesis during expression evaluation
                 '/Qfp-stack-check',          # enable stack overflow protection checks
                 '/reentrancy:threaded',      # important for thread-safety
                 #'/Qinit=zero','/Qinit=arrays',  # automatically initialize all arrays to zero
                 '/Qinit=snan', '/Qinit=arrays',  # automatically initialize all arrays to SNAN
                 '/QxSSE3', '/QaxAVX',        # generate SSE3, SSE2, and SSE instructions
				 '/heap-arrays:10000000',
                 # '/Od', '/Ob0',  # <-- Disable Optimization for Debugging
                 # '/Zi',          # <-- Debugging Information
                 '/include:%I', '/include:'+abaHomeInc, '%P']

link_sl=['LINK',
         '/nologo', '/NOENTRY', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64',
         '/NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB',
         '/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:LIBIFCOREMD.LIB', '/DEFAULTLIB:LIBIFPORTMD.LIB', '/DEFAULTLIB:LIBMMD.LIB',
         '/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib',
         '/FIXED:NO', '/dll',
         #'/debug', # <-- Debugging
         '/def:%E', '/out:%U', '%F', '%A', '%L', '%B', 
         'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib',
         'advapi32.lib', 'msvcrt.lib', 'vcruntime.lib', 'ucrt.lib']

link_exe=['LINK',
          '/nologo', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64', '/STACK:20000000',
          '/NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB', '/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:LIBIFCOREMD.LIB',
          '/DEFAULTLIB:LIBIFPORTMD.LIB', '/DEFAULTLIB:LIBMMD.LIB', '/DEFAULTLIB:kernel32.lib',
          '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib',
          '/FIXED:NO', '/LARGEADDRESSAWARE',
          # '/debug', # <-- Debugging
          '/out:%J', '%F', '%M', '%L', '%B', '%O',
          'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib',
          'advapi32.lib', 'msvcrt.lib', 'vcruntime.lib', 'ucrt.lib']

If I want to include external lib files, where should I modify?

Thanks  for any help.

0 Kudos
4 Replies
S4JJ4D
Beginner
380 Views

Hi,
I'm having the same issue. Did you find a solution? I am trying to link SPICELIB.LIB with Abaqus subroutine and I've successfully tested this library with a simple FORTRAN code through the following cmd command:

ifort test_program.for spicelib.lib


 I tired to add 'spicelib.lib' in compile_fortran, but it results in error.

usub-C2.obj : error LNK2019: unresolved external symbol m2eul referenced in function uexternaldb
standardU.dll : fatal error LNK1120: 1 unresolved externals


where "m2eul" is a function from .lib and "uexternaldb" is the user-subroutine.

S4JJ4D
Beginner
408 Views

Hi,

I'm having the same issue. Did you find a solution?
I'm trying to use SPICELIB.LIB (from xxx) library file in Abaqus subroutines but I am not sure what changes I need to make in Abaqus .env files.

Before trying to link it to Abaqus subroutine, I successfully tested a simple fortran program that uses this library using the following command in cmd:

 

ifort testCode.for spicelib.lib

 

 

edited by Moderator

MaryT_Intel
Community Manager
404 Views

Hi @S4JJ4D ,  if no one answers here, you may need to post this as a new question instead of on an old thread. We don't monitor old threads. Also, do not include the hotlink as it will be filtered out as spam.

Kind regards,

Mary T.

Support Community Manager

JohnNichols
Valued Contributor II
400 Views

I suggest a search on this forum for the word abaqus and that will turn up a lot of past help - read that first and then if needed ask again 

You may need to use the latest Intel ONEAPI compiler -- abaqus start file needs to be configured to point to it -- that is shown here 

Once yo uhave tried that see if you need help - but few people here use abaqus 

Reply