The default compiler for Abaqus user subroutines is Intel Fortran, which is usually too heavy to install in the system. It is preferred to use GNU Fortran compiler in Linux platform.
Settings in original
SMA/site/abaqus_v6.env file configures many settings. In fact, the setting file for Linux
SMA/site/lnx86_64.env provides more valuable information:
fortCmd = "ifort" # <-- Fortran compiler # Avoid signal trapping by the Fortran RTE os.environ["FOR_IGNORE_EXCEPTIONS"] = "1" # Disable messages from the Fotran RTE os.environ["FOR_DISABLE_STACK_TRACE"] = "1" # Do not let QLogic InfiniPath driver set processor affinity. os.environ["IPATH_NO_CPUAFFINITY"] = "1" # Add the flag "-free" to the compile_fortran command below to use free-format FORTRAN 90 syntax. compile_fortran = [fortCmd, '-V', '-c', '-fPIC', '-auto', '-mP2OPT_hpo_vec_divbyzero=F', '-extend_source', '-WB', '-I%I'] link_sl = [fortCmd, '-V', '-cxxlib', '-fPIC', '-threads', '-shared', '%E', '-Wl,-soname,%U', '-o', '%U', '%F', '%A', '%L', '%B', '-parallel', '-Wl,-Bdynamic', '-i-dynamic', '-lifport', '-lifcoremt'] # Remove the temporary names from the namespace del fortCmd
First step: compiling
gfortran is installed in your Linux system and works properly, an intuitive change we would make should be substituting
If we run test command
$ abaqus veryfy -user_std, there will be mistakes:
Begin Compiling Abaqus/Standard User Subroutines gfortran: error: unrecognized command line option ‘-V’ gfortran: error: unrecognized command line option ‘-auto’ gfortran: error: unrecognized command line option ‘-mP2OPT_hpo_vec_divbyzero=F’ gfortran: error: unrecognized command line option ‘-WB’ Abaqus Error: Problem during compilation - std_user.f
This is because the compiling flags used by
gfortran is not compatible with
ifort. So we look into the flags a little bit:
-VDisplays the compiler version information (same as the -logo option). We can simply remove it.
-autoCauses all local, non
-saved variables to be allocated on the run-time stack (same as
-nosave). The default is
-auto-scalar. However, if you specify
-openmp, the default is
-automatic. We can remove it since there is no counterpart in
-mP2OPT_hpo_vec_divbyzero=FSeems for dealing with divided by zero. No reference found yet. Simply remove it.
-WBTurns a compile-time bounds check into a warning. Normally, compile-time bounds checks are errors. This is a relaxation of the code strictness, we can remove it or replace with
Second step: linking
After correction, the compilation error would gone but linking error occurs:
Begin Linking Abaqus/Standard User Subroutines gfortran: error: unrecognized command line option ‘-cxxlib’ gfortran: error: unrecognized command line option ‘-threads’ gfortran: error: unrecognized command line option ‘-parallel’ gfortran: error: unrecognized command line option ‘-i-dynamic’ Abaqus Error: Problem during linking - Abaqus/Standard User Subroutines Abaqus/Analysis exited with errors
Then we do the same analysis of the incompatible flags:
-cxxlibTells the compiler to link using certain C++ run-time libraries. For Linux, it should be removed.
-threadsSpecifies that multithreaded libraries should be linked. I guess in
gfortranwe could use
-pthread, but it would be preferred to use
-fopenmpif OpenMP is used in the user subroutine.
-parallelTells the auto-parallelizer to generate multi-threaded code for loops that can be safely executed in parallel. To use this option, you must also specify
-O3. We can use
-fopenmpin case of need, or just remove it.
-i-dynamicCauses Intel-provided libraries to be linked in dynamically. It is the opposite of
-i-static. It should be removed. If static libraries are preferred, one can use
Finally, the working modified
abaqus_v6.env file in user path looks like:
fortCmd = 'gfortran' compile_fortran = [fortCmd, '-c', '-fPIC', '-extend_source', '-Warray-bounds', '-I%I'] link_sl = [fortCmd, '-fPIC', '-pthread', '-shared', '%E', '-Wl,-soname,%U', '-o', '%U', '%F', '%A', '%L', '%B', '-Wl,-Bdynamic', '-lifport', '-lifcoremt'] del fortCmd
Although this could pass the test command, further optimization of the file may be applied.