ACCOPTION causes pymapdl run to fail
mcMunich opened this issue Β· comments
π€ Before submitting the issue
- I have visited the Troubleshooting section.
- I have searched among the existing issues.
- I am using a Python virtual environment.
- I am using the latest version of PyMAPDL and its dependencies (fully updated virtual environment). You can update them using
pip install --upgrade --upgrade-strategy eager ansys-mapdl-core
in your activated virtual environment.
π Description of the bug
The ACCOPTION command should allow the user to accelerate an analysis using their GPU. However, it seems to cause my analysis to fail.
π΅οΈ Steps To Reproduce
from ansys.mapdl.core import launch_mapdl
import os
here = os.getcwd()
# parameters
x = 1 # create a square block
f = 1e6 # force over 1 side of block
ndiv = 4 # element/line division
numElem = (ndiv/x)**3
loadDirection = 'y'
##### modeling
#elemSize = (x**3)/numElem**(1/3)
#### Launch pymapdl
mapdl = launch_mapdl(run_location=here, version = 232)
mapdl.prep7()
#### Materials
mapdl.mp("EX", 1, 200e9)
mapdl.mp("PRXY", 1, 0.3)
#### Geometry
mapdl.csys(0)
mapdl.blc4(0, 0,x, x, x)
#### Elements and meshing
mapdl.et(1, "SOLID186")
mapdl.type(1)
mapdl.keyopt(1, 2, 1)
#mapdl.esize(elemSize)
mapdl.vmesh("ALL")
mapdl.eplot()
#### Boundary Conditions: fixed constraint
mapdl.nsel("s", "loc", loadDirection, 0)
mapdl.d("all", "all")
#### Boundary Conditions: load
mapdl.nsel("s", "loc", loadDirection, x)
nnodes = mapdl.get("NumNodes" , "NODE" ,0 , "COUNT" )
mapdl.f("all", "fy",f/nnodes)
mapdl.allsel()
#### Solve
mapdl.run("/solu")
mapdl.accoption(activate='ON')
sol_output = mapdl.solve()
#### Plot Results
# plot the normalized global displacement
mapdl.post_processing.plot_nodal_displacement(lighting=False, show_edges=True)
mapdl.exit()
π» Which Operating System are you using?
Windows
π Which Python version are you using?
3.11
π PyMAPDL Report
na
π Installed packages
na
π Logger output file
na
@mcMunich check the file0.err file and see if it shows that the CUDA driver needs to be updated. Mike
this is going to be a bit tricky. Delaying to the next week (I need my Windows laptop)
I got the following error:
*** ERROR *** CP = 0.641 TIME= 15:59:19
The GPU accelerator capability cannot be activated with the ACCOPTION
command. Please read the following message for more details.
*** ERROR *** CP = 0.641 TIME= 15:59:19
The capability GPU was either not ordered with this Ansys installation
or the appropriate product was not selected for this session.
Contact your Ansys support person for more information.
@germa89 most laptops don't have a GPU that would be automatically used - have you set the following environment variable?
ANSGPU_OVERRIDE=1
Mike
So it seems that to use ACCOPTION
you need to also do something like:
mapdl = launch_mapdl(additional_switches="-acc NVIDIA")
Notes
To inject env vars in MAPDL process:
mapdl = launch_mapdl(additional_switches="-acc NVIDIA", add_env_vars={"ANSGPU_OVERRIDE": "1"})
I acknowledge PyMAPDL should return something more explicit than Connection terminated
.
PyMAPDL needs a better error catching... either at launching or during runtime.
I'm closing this issue because there is no PyMAPDL issue per se.