ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
276 stars 41 forks source link

Fluent launch process is very slow giving warnings. #2187

Closed anskgiannok closed 12 months ago

anskgiannok commented 1 year ago

🔍 Before submitting the issue

🐞 Description of the bug

When try to launch Fluent session, it takes a long time to get launched getting warnings messages regarding run-time issues.

Input:

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(show_gui=False)

Output:

pyfluent.launcher WARNING: Exception caught - RuntimeError: The launch process has been timed out.
pyfluent.launcher WARNING: Retrying Fluent launch with less robust command: C:\Program Files\ANSYS Inc\v241\fluent\ntbin\win64\fluent.exe 3ddp   -sifile="C:\Users\kgiannok\AppData\Local\Temp\serverinfo-zy71n9vz.txt" -nm -hidden

The session starts but the launching time is quite high.

I get the same behavior for pyFluent 0.16.dev0 - 0.19.dev1 versions and for Fluent 23R2 and 24R1. I have no issues with v0.15.0.

📝 Steps to reproduce

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(show_gui=False)

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

tested pyfluent versions : 0.16.dev0 - 0.19.dev1 tested Fluent versions : 23R2, 24R1

🐍 Which Python version are you using?

3.10

📦 Installed packages

accessible-pygments==0.0.4
alabaster==0.7.13
ansys-api-fluent==0.3.18
ansys-api-platform-instancemanagement==1.0.0
ansys-api-systemcoupling==0.1.0
ansys-dpf-core==0.9.0
ansys-dpf-gate==0.4.1
ansys-dpf-gatebin==0.4.1
ansys-fluent-core==0.17.0
ansys-grpc-dpf==0.8.1
ansys-platform-instancemanagement==1.1.2
ansys-sphinx-theme==0.12.3
-e git+https://github.com/pyansys/pysystem-coupling.git@82e50fe7c81a1d59c888df28a99760e4b64bb614#egg=ansys_systemcoupling_core
appdirs==1.4.4
asttokens==2.4.0
attrs==23.1.0
Babel==2.13.0
backcall==0.2.0
beautifulsoup4==4.12.2
black==23.10.0
bleach==6.1.0
cachetools==5.3.1
certifi==2023.7.22
charset-normalizer==3.3.0
click==8.1.7
colorama==0.4.6
comm==0.1.4
contourpy==1.1.1
cycler==0.12.1
decorator==5.1.1
defusedxml==0.7.1
docker==6.1.3
docutils==0.20.1
exceptiongroup==1.1.3
executing==2.0.0
fastjsonschema==2.18.1
fonttools==4.43.1
google-api-core==2.12.0
google-api-python-client==2.104.0
google-auth==2.23.3
google-auth-httplib2==0.1.1
googleapis-common-protos==1.61.0
grpcio==1.59.0
grpcio-health-checking==1.48.2
grpcio-status==1.48.2
h5py==3.10.0
httplib2==0.22.0
idna==3.4
imagesize==1.4.1
importlib-metadata==6.8.0
iniconfig==2.0.0
ipython==8.16.1
ipywidgets==8.1.1
isort==5.12.0
jedi==0.19.1
Jinja2==3.1.2
jsonschema==4.19.1
jsonschema-specifications==2023.7.1
jupyter-sphinx==0.4.0
jupyter_client==8.4.0
jupyter_core==5.4.0
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.9
kiwisolver==1.4.5
livereload==2.6.3
lxml==4.9.3
MarkupSafe==2.1.3
matplotlib==3.8.0
matplotlib-inline==0.1.6
mistune==3.0.2
mypy-extensions==1.0.0
nbclient==0.8.0
nbconvert==7.9.2
nbformat==5.9.2
numpy==1.26.1
numpydoc==1.6.0
packaging==23.2
pandas==2.1.1
pandocfilters==1.5.0
parso==0.8.3
pathspec==0.11.2
pickleshare==0.7.5
Pillow==10.1.0
platformdirs==3.11.0
pluggy==1.3.0
prompt-toolkit==3.0.39
protobuf==3.20.3
psutil==5.9.6
pure-eval==0.2.2
pyasn1==0.5.0
pyasn1-modules==0.3.0
pydata-sphinx-theme==0.14.1
Pygments==2.16.1
pypandoc==1.12
pyparsing==3.1.1
pytest==7.4.2
pytest-sphinx==0.5.0
python-dateutil==2.8.2
pytz==2023.3.post1
pywin32==306
PyYAML==6.0.1
pyzmq==25.1.1
referencing==0.30.2
requests==2.31.0
rpds-py==0.10.6
rsa==4.9
six==1.16.0
snowballstemmer==2.2.0
soupsieve==2.5
Sphinx==7.2.6
sphinx-autobuild==2021.3.14
sphinx-autodoc-typehints==1.24.0
sphinx-copybutton==0.5.2
sphinx-gallery==0.14.0
sphinx-notfound-page==1.0.0
sphinxcontrib-applehelp==1.0.7
sphinxcontrib-devhelp==1.0.5
sphinxcontrib-htmlhelp==2.0.4
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.6
sphinxcontrib-serializinghtml==1.1.9
sphinxcontrib-websupport==1.2.6
sphinxemoji==0.2.0
stack-data==0.6.3
tabulate==0.9.0
tinycss2==1.2.1
tomli==2.0.1
tornado==6.3.3
tqdm==4.66.1
traitlets==5.11.2
typing_extensions==4.8.0
tzdata==2023.3
uritemplate==4.1.1
urllib3==2.0.7
wcwidth==0.2.8
webencodings==0.5.1
websocket-client==1.6.4
widgetsnbextension==4.0.9
zipp==3.17.0
hpohekar commented 1 year ago

@giannoko

Could you please confirm once again with python 3.11.

It works fine for me with python 3.11 - '0.19.dev1' - 23R2 and 24R1.

Python 3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ansys.fluent.core as pyfluent
>>> pyfluent.version_info()
'0.19.dev1'
>>> session_241 = pyfluent.launch_fluent(show_gui=False)
>>> 
>>> import os
>>> os.environ["PYFLUENT_FLUENT_ROOT"] = r"D:\Installations\Ansys\v232_14092023\ANSYS Inc\v232\fluent"
>>> session_232 = pyfluent.launch_fluent(show_gui=False)
>>> 
>>> 

Thank you.

raph-luc commented 1 year ago

The reason why it is slow is because your system for some reason fails to launch Fluent in the standard detached (and more robust) way, and that times out after 60 seconds by default when it notices Fluent isn't working. After timeout, it tries launching Fluent again, but now as a child of the Python process, which isn't good for multiple reasons, but mainly because it leaves Fluent vulnerable to bad termination attempts from IDEs such as Visual Studio (jupyter notebook "restart kernel" options and others like that) which may leave zombie processes behind that would need to be cleaned up manually.

As a quick workaround, can use the start_timeout argument (see launch_fluent documentation) to reduce the default timeout from 60 seconds to something like 10 seconds for example (don't make it too short or it will fail to launch Fluent in both attempts).

If Python 3.11 as Harshal suggested doesn't work, and neither does updating Windows, I am going to be in touch with @giannoko to try to debug this properly and see if we can figure out a better solution.

anskgiannok commented 1 year ago

@hpohekar I get the same issue with python 3.11 also.