SLRUM for PyMechanical.?

Member Posts: 80
10 Comments 5 Likes First Answer First Anniversary
**

Hello @James Derrick

I’m reaching out to seek your advice on the best strategy for submitting jobs from PyAnsys (on a Windows machine) to a SLURM cluster. Currently, our process involves copying the .py file and running it through SLURM. I was wondering if there’s a more streamlined approach, similar to how we use ANSYS RSM for Workbench submissions.

Looking forward to your insights!

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Member, Employee, GitHub-issue-creator Posts: 353
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **

    @Landon Mitchell Kanner whether the HPS works between windows to Linux.?

  • Member, Employee Posts: 4
    Second Anniversary Name Dropper First Comment Ansys Employee
    ✭✭✭
    edited February 3

    @Naveen Kumar Begari HPS is able to connect windows clients to a linux based cluster. There are primarily two worksflows that can be used with pyAnsys:
    1. Inside of (py)Mechanical - add a Solve Process Setting corresponding to HPS server and authentication (this is similar to RSM setup)
    2. Use (py)Mechanical to write an input file that is submitted to the cluster using pyHPS
    - Examples available https://hps.docs.pyansys.com/

  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **

    @Andreas Rydin Thanks for your information

  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **

    @Andreas Rydin said:
    @Naveen Kumar Begari HPS is able to connect windows clients to a linux based cluster. There are primarily two worksflows that can be used with pyAnsys:
    1. Inside of (py)Mechanical - add a Solve Process Setting corresponding to HPS server and authentication (this is similar to RSM setup)
    2. Use (py)Mechanical to write an input file that is submitted to the cluster using pyHPS
    - Examples available https://hps.docs.pyansys.com/

    @Andreas Rydin

    For First work flow i,e:
    1. Inside of (py)Mechanical - add a Solve Process Setting corresponding to HPS server and authentication (this is similar to RSM setup) --- Can you please share me the examples or workflow setup.?

  • Member, Employee Posts: 4
    Second Anniversary Name Dropper First Comment Ansys Employee
    ✭✭✭
    edited February 6

    @Naveen Kumar Begari Here is a short script to add a HPS queue in solve process settings:

    You can replace the url server with the appropriate HPS server.

    1. import os, webbrowser
    2.  
    3. new_hps_config = 'hps_mech'
    4. n_cores = 20
    5. url = 'https://<server>:8443/hps'
    6.  
    7. configs = ExtAPI.Application.SolveConfigurations
    8. hps_config = [i.Name for i in configs if i.Settings.SolutionExecutionTarget == 'HPC Platform Services']
    9.  
    10. if hps_config: # exists
    11. print('HPS configuration found')
    12. config_name = hps_config[0]
    13. print(config_name)
    14. config = ExtAPI.Application.SolveConfigurations[config_name]
    15. ExtAPI.Log.WriteMessage('Solver now changed to ' + config_name)
    16. webbrowser.open(url)
    17. Model.Analyses[0].Solve( True , config_name)
    18. if not hps_config: # doesn't exist
    19. print('No HPS configuration found')
    20. config = Ansys.ACT.Mechanical.Application.SolveProcessSettings.SolveConfiguration()
    21. config.Settings.License = 'Ansys Mechanical Enterprise'
    22. config.SolveProcessSettings.MaxNumberOfCores = n_cores
    23. config.SolveProcessSettings.LicenseQueuing = True
    24. config.Settings.SolutionExecutionTarget = 'HPC Platform Services'
    25. config.Settings.DCSUrl = url
    26. config.Name = new_hps_config
    27. config.Settings.DCSUsername = os.getenv('username')
    28. configs.Add(config)
    29. emsg = HPSConfiguration + ' has been added to your Solver Configurations. Please authenticate and validate. Next time you press this button, you will run your analysis with that configuration.'
    30. msg = Ansys.Mechanical.Application.Message(emsg, MessageSeverityType.Warning)
    31. ExtAPI.Application.Messages.Add(msg)
  • Member Posts: 80
    10 Comments 5 Likes First Answer First Anniversary
    **

    @Andreas Rydin Thank you for sharing the script. Will get back if any

Welcome!

It looks like you're new here. Sign in or register to get started.