TarletonGroup / CrystalPlasticity

CP UMAT and CZM UEL for Abaqus
138 stars 64 forks source link

issue of parallelization computation by abaqus #56

Closed feelrockLee closed 4 months ago

feelrockLee commented 4 months ago

Hello Enralp, Thank you for sharing your work There seems to be an error that the solution does not converge when I try to do the calculation through the CPU parallelization computing supported by ABAQUS. If I don't do parallel calculations with the exact same input file, it works fine, but if I do it in parallel, it iterates in the first step and stops with an error. I'm guessing it's because the nodes are distributed per CPU core, but do you have any experience with parallel computation? Thank you

vikramroybarc commented 4 months ago

Hi,

The code works well in parallel mode.

In my experience whenever I change the abaqus configuration file (abaqus.env) adding additional lines for debugging support then it runs only in serial mode.

When I run the code using default configuration file it runs well in parallel mode.

My abaqus version is 2022.

feelrockLee commented 4 months ago

Hi ! Thank you for your very kind and fast reply

Can you provide which additional lines you added in abaqus.env file?

I only added "compile_fortran += ['/names:lowercase',]" after the default env file for the Fortran compiler linking

There was no problem during parallel mode for other simulations.

Thank you again

vikramroybarc commented 4 months ago

Hi, This the file with which I can run my simulations in parallel

#-*- mode: python -*-

#############################################################################
#                                                                           #
#     Compile and Link commands for ABAQUS on the Windows 64 Platform       #
#                                                                           #
#############################################################################

# import os # <-- Debugging
# os.environ['GLOBAL_ENABLE_FPE'] = 'TRUE' # <-- Debugging

# Location of the /include directory in the ABAQUS installation
abaHomeInc = os.path.abspath(os.path.join(os.environ.get('ABA_HOME', ''), os.pardir)) 

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]

## Fortran compile command for User Subroutines

compile_fortran=['ifort',
                 '/c', '/fpp', '/extend-source', 
                 '/DABQ_WIN86_64',  '/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
                 # '/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']

## Link command to be used for ABAQUS/MAKE on machines without the Fortran compiler.
## Uncomment it to enable.
#
#link_exe=['LINK', '/nologo', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64', '/NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB',
#          '/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:MSVCRT.LIB', '/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib',
#          '/FIXED:NO', '/LARGEADDRESSAWARE', '/out:%J', '%F', '%M', '%L', '%B', '%O',
#         'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib',
#         'advapi32.lib', 'msvcrt.lib', 'vcruntime.lib', 'ucrt.lib']

# Remove the temporary names from the namespace
del abaHomeInc

This is the original.env of 2022 version. With these .env settings I can run my simulations using UMAT both in serial and parallel mode.

My Modified .env file is shown below:

#-*- mode: python -*-

#############################################################################
#                                                                           #
#     Compile and Link commands for ABAQUS on the Windows 64 Platform       #
#                                                                           #
#############################################################################

# import os # <-- Debugging
# os.environ['GLOBAL_ENABLE_FPE'] = 'TRUE' # <-- Debugging

# Location of the /include directory in the ABAQUS installation
abaHomeInc = os.path.abspath(os.path.join(os.environ.get('ABA_HOME', ''), os.pardir)) 

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]

## Fortran compile command for User Subroutines

compile_fortran=['ifort',
                 '/c', '/fpp', '/extend-source', 
                 '/debug', '/pdbfile'
                 '/DABQ_WIN86_64',  '/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
                  '/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']

## Link command to be used for ABAQUS/MAKE on machines without the Fortran compiler.
## Uncomment it to enable.
#
#link_exe=['LINK', '/nologo', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64', '/NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB',
#          '/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:MSVCRT.LIB', '/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib',
#          '/FIXED:NO', '/LARGEADDRESSAWARE', '/out:%J', '%F', '%M', '%L', '%B', '%O',
#         'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib',
#         'advapi32.lib', 'msvcrt.lib', 'vcruntime.lib', 'ucrt.lib']

# Remove the temporary names from the namespace
del abaHomeInc

I did some modifications so as to have debugging support. When I use my Modified file I can run the simulations only in serial mode and not in parallel mode.

vikramroybarc commented 4 months ago

I carried out following Modifications in the modified file: https://answerrs.wordpress.com/2016/03/04/debugging-abaqus-user-subroutines-in-windows/

EralpDemir commented 4 months ago

Thanks Vikram, I close this issue.