Skip to content
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

ACCOPTION causes pymapdl run to fail #2798

Closed
4 tasks done
mcMunich opened this issue Feb 20, 2024 · 7 comments
Closed
4 tasks done

ACCOPTION causes pymapdl run to fail #2798

mcMunich opened this issue Feb 20, 2024 · 7 comments

Comments

@mcMunich
Copy link
Contributor

mcMunich commented Feb 20, 2024

🤓 Before submitting the issue

🔍 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.
image

🕵️ 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

@mikerife
Copy link

@mcMunich check the file0.err file and see if it shows that the CUDA driver needs to be updated. Mike

@germa89
Copy link
Collaborator

germa89 commented Feb 20, 2024

this is going to be a bit tricky. Delaying to the next week (I need my Windows laptop)

@germa89
Copy link
Collaborator

germa89 commented Feb 27, 2024

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.                

@mikerife
Copy link

mikerife commented Feb 27, 2024

@germa89 most laptops don't have a GPU that would be automatically used - have you set the following environment variable?
ANSGPU_OVERRIDE=1

Mike

@germa89
Copy link
Collaborator

germa89 commented Feb 27, 2024

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.

@germa89
Copy link
Collaborator

germa89 commented Feb 27, 2024

PyMAPDL needs a better error catching... either at launching or during runtime.

@germa89
Copy link
Collaborator

germa89 commented Feb 27, 2024

I'm closing this issue because there is no PyMAPDL issue per se.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants