-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some issues regarding the use of pyvumat in Windows systems #1
Comments
Thank you for your interest in the code and I apologize for the delay in responding. I was trying to get access to Abaqus on a Windows machine, but I do not use Windows regularly, nor do I have access to one that has Abaqus on it. Could you provide an example of the errors you are receiving, perhaps they are not specific to Windows. Feel free to reach out via email, response times should be quicker. |
Thank you very much for your reply. I will try to use Linux to configure the project in the future. If there are similar problems, I hope to obtain some answers from you. |
I found that I couldn't find your contact information in the project. Can you provide an email so that I can contact you quickly? |
It is harder to find within the user's guide than I thought. Please email me at [email protected] and we can coordinate the best way to provide an example for Abaqus. Thanks. |
I tried to compile it using the abaqus2024windows version, but I found that it still reported an error, which prompted me: End Compiling Single Precision Abaqus/Explicit User Subroutines |
Unfortunately I am not familiar with running Abaqus on Windows or general c++ code compilation with Microsoft VS. What is in your local abaqus_v6.env file for 'compile_cpp' and 'link_sl'? |
There should be no error in the configuration of 'compilale_cpp' and 'link_stl'. I followed the instructions to add the Python. h file directory and numpy directory. When compiling pyVUMAT.cpp, including<Python. h>, there was no error prompt, |
The linking issue you are seeing would not be related to the PyTorch install (or any python package besides Numpy). I would like to see what commands are being called to compile and link the vumat. Can you provide 'compilale_cpp' and 'link_stl' or the output from Abaqus showing the commands for these steps? To answer your question, which will be relevant after you get the vumat compiled: I have been successful in creating a separate Python environment using conda and installing PyTorch there. This eliminates the need to install PyTorch in the Abaqus directory. You should make sure the version of Python is close to the version in the Abaqus build. For example, my Abaqus install uses Python3.10.5, so when I created my conda environment I specified 'python=3.10'. The actual version installed was 3.10.14, but that has not seemed to cause any issues. Once you have your PyTorch install, you will want to ensure Python can find that path, as well as the path to the PyVUMAT modules. I do that by: export PYTHONPATH=${PYVUMAT_DIR}:${HOME}/.conda/envs/pytorch3.10/lib/python3.10/site-packages:${PYTHONPATH} where PYVUMAT_DIR is the top-level PyVUMAT directory, which should contain pyvumat/driver.py and |
I'm very sorry, my Python version is incorrect, but I found that my Abauqs2022 has a built-in Python 3.7 folder. Does this mean that even Abaqus 2022 can use this program? |
I am unable to view the png. Is it possible to copy the text into the comments? |
Computer /usr/SIMULIA/Est...ucts/2022 /linux_a64 /tools / sMApy / python3.7; |
I had tried previously to use Python3 with older versions of Abaqus, but was unsuccessful. Despite that Python3 directory, my experience is that Abaqus still uses Python2 at runtime. I was unable to figure out how to force older Abaqus versions to use Python3 and the Abaqus support staff said Python3 is only available in the 2024 version. If you are going to use older versions of Abaqus, I would stick to Python packages that are compatible with Python2. |
As you said, if I use Python 2 and PyTorch only supports Python on its own Does version 3.5 or above mean that I cannot use pyVUMAT on Abaqus 2022? |
I'm not sure what you are asking, but Abaqus 2022 runs Python2 and therefore any PyVUMAT model running on Abaqus 2022 must use Python2. |
What I mean is that the deep learning module in pyVUMAT is built on PyTorch. However, PyTorch currently supports only Python 3.5 and above and does not support Python 2. Can we still use PyTorch with Python 2? Or do we need to independently construct a neural network model in Python 2 and complete its training and deployment? |
I have not used PyTorch with Python 2. I believe it is technically possible, but the version of PyTorch you need to use is quite old. If it is at all possible, I would recommend using Abaqus 2024. |
This is unfortunate; I do not have the Linux version of Abaqus 2024, only the Windows version. Obtaining the Linux version might be difficult for me. Moreover, the Windows version of Abaqus cannot link to pyVUMAT, even though I have set Abaqus's Python as the PATH system variable. I believe there are many differences between the Windows and Linux versions of Abaqus. I will continue to try in hopes of achieving a better result. |
Yes, it is unfortunate that Abaqus did not convert to Python3 until this year. I am willing to help you try to get PyVUMAT working with your Windows install. I can't promise we will get it working, but if we did, I imagine it would help other users in the future. To do so, I would need to see the commands Abaqus is calling for the compilation and linking in Windows. |
Thank you very much. I am currently trying to use pyVUMAT on abaqus2024 for windows. windows version does not have libpython3.x.os file, it only has lib and dll files, I am trying to replace libpython3.x.os function, below I use compile_cpp and link_sl, in addition, I added the directory of the python310.dll dynamic library to the environment variable path, but unfortunately I failed. If you can provide some suggestions or comments, I would be very grateful! 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 /I%I /I"D:/abaqus" - I "D: / / win_b64 of abaqus/tools/SMApy/python3.10 / include" - I "D: / / win_b64 of abaqus/tools/SMApy/python3.10 / lib/site - packages/numpy/core/include" -I"D:/abaqus/SMABase/PublicInterfaces"' 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 /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 / LIBPATH: "D: / / win_b64 of abaqus/tools/SMApy/python3.10 / libs"/DEFAULTLIB: python310. Lib ' Here's what I tried to run Times wrong: pyVUMAT.cpp |
It looks like you are using Abaqus/Standard. The VUMAT interface is separate from the UMAT interface. UMATs are for Abaqus/Standard and VUMATs are for Abaqus/Explicit. Therefore, PyVUMAT is used for Abaqus/Explicit. Please add the following lines in your input file, within the "STEP" block: *DYNAMIC,EXPLICIT,DIRECT USER CONTROL where the first number is the time step and the second is the total time. The provided example would simulate 1 unit of time in 1000 time steps. Adjust as necessary for your problem. Also, if possible please add 'verbose=2' to your command line arguments to Abaqus. This should print the full commands Abaqus is using to compile pyVUMAT.cpp. Also, try adding 'double' to the command line so that double precision is used. I don't know that this will matter, but it will be consistent with how I run PyVUMAT in Abaqus. |
I modified the code as you requested, and now I have a new error message: Abaqus License Manager checked out the following licenses:
pyVUMAT.cpp
|
This is all the operations I perform using Windows; 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 /I%I /IE:/abaqus2024/Products /IE:/abaqus2024/Products/win_b64/tools/SMApy/python3.10/include /IE:/abaqus2024/Products/win_b64/tools/SMApy/python3.10/lib/site-packages/numpy/core/include' 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 /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 /LIBPATH:"D:/abaqus/win_b64/tools/SMApy/python3.10/libs" /DEFAULTLIB:python310.lib' Set PYTHONPATH, with the first being the pyvumat directory and the second being the path to packages such as pytorch: set PYTHONPATH=E:\abaqus2024\temp\PyVUMAT-main;E:\anaconda\envs\pytorch\Lib\site-packages At the same time, add the directory of python310.dll to the system variable path: E:\abaqus2024\Products\win_b64\tools\SMApy\python3.10 Set configuration file: set PYVUMAT_CONF_FILE=E:\abaqus2024\temp\PyVUMAT-main\pyvumat\svk\pyVumat_Conf_svkNN.ini Execute program: abaqus job=Job user=E:\abaqus2024\temp\PyVUMAT-main\pyvumat.cpp verbose=2 double |
I would like to confirm that the linking issue is related to Python and not other C++ libraries. Please copy the code below as a separate vumat and try running it with Abaqus to see if you can get past the compilation and linking. I have removed everything related to Python. #include #if defined(ABQ_LINUX) namespace { //
} //
} /* End initialization */ extern "C" void vumat( |
Looks like the include commands at the top of the code got partially stripped. They should read like this, but without spaces around the names of the headers: #include < fstream > |
Unfortunately, the error still exists when Python related parts are raised in a timely manner. I used a simple umat.cpp to execute without any problems. Do I need any corrections to the following code when using Windows? The following is the core information of the error message:
|
It seems that an error occurred during compilation, and I also encountered the same error when using abaqus make library=test.cpp |
This is the executable Umat subroutine, and I have used it for calculations without any issues #include |
You may be right about the aba_for_c.h, but let's first try removing all of the C++ features. Here is a test that only uses C. Please try running this code: #include < stdio.h > #if defined(ABQ_LINUX) // static FILE *_logFile; //
} /* End initialization */ return; extern "C" void vumat( |
This seems to be no problem, using abaqu make library can compile, and at the same time, abaqus job=Job user=E: \ abaqus2024 \ temp \ PyVUMAT main \ test. cpp verbose=2 double also has almost no errors. Just my input file has some errors:: 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 /def:export.def /out:explicitU-D.dll test.obj "explicitU-D_static.lib" /LIBPATH:"E:\abaqus2024\Products\win_b64\code\lib" ABQSMAShaShared-D.lib ABQSMAAspSupport.lib ABQSMAUsubsLib.lib ABQDMP_Core.lib ABQMPI_api.lib ABQSMAAbuBasicUtils.lib explicitB-D.lib ABQSMABasCoreUtils.lib ABQSMAEliLicenseModule.lib oldnames.lib user32.lib ws2_32.lib netapi32.lib advapi32.lib msvcrt.lib vcruntime.lib ucrt.lib /LIBPATH:E:/abaqus2024/Products/win_b64/tools/SMApy/python3.10/libs /DEFAULTLIB:python310.lib
|
Well that is progress at least. Could you please try the previous C++ code again but I've changed the abaqus header (aba_for_c.h -> omi_for_c.h) and added FOR_NAME as you did in your UMAT. Note the extra spaces I had to include in the #include lines just to ensure GitHub does not remove them. #include < fstream > #include < omi_for_c.h > namespace { //
} } // //
} /* End initialization */ return; |
The problem seems to be here, an error occurred in this step, and the error message is similar to the previous one, which also cannot be compiled using abaqus make library. Analysis initiated from SIMULIA established products
test.cpp
|
Hmm...unfortunately I don't know anything about C++ compatibility on Windows, so without the ability to reproduce the error, I won't be able to figure out which C++ functionality is triggering this error. I can rewrite the pyVUMAT.cpp file to only use standard C, but it will take some time to implement, test across the various codes we use, and get it approved for public release by my organization. It will likely be a month or so before it would be ready to share. I understand if that is too long for your research needs. |
Thank you very much for your help. I think if you can implement pyVUMAT using standard C, your work will help more people. As far as I know, most universities and individuals cannot obtain the free Linux version of abaqus2024, and Windows is still the first choice for non computer majors to use abaqus. If this job can be used on Windows, it will significantly enhance its influence. |
Yes, I agree. Thank you for the insight. It should not be hard to do, it will just take time to get it approved to share. When it is ready, I will reach out for you to test before pushing it to the repository. Expect to hear from me in a month, maybe sooner if the process moves quicker. |
Thank you very much for your efforts. Your work may help a considerable number of students like me. |
Version 2.0 of PyVUMAT has been pushed to the repo. The C++ functionality has been removed. Based on preliminary testing, this should eliminate the issues you were seeing on Windows. But if any users continue to encounter issues, please reach out. |
I'm very grateful for your help! The new code you provided works well on Windows, which is a significant help for us. The process is identical to what you described for Linux, and it works with Conda and other environments too. On Windows, we need to place the pyvumat program in the same folder as pytorch, such as path/to/anaconda/env/xxx/lib/site-packages. This folder should contain both the pyvumat and pytorch packages, because Windows doesn't allow multiple PYTHONPATH settings. |
Your work is very commendable, but there are too many errors when running Abaqus using Windows system. Can you provide some simple examples for Windows system?
The text was updated successfully, but these errors were encountered: