ansys / pyfluent

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

Job scheduling via PyFluent #726

Closed seanpearsonuk closed 2 years ago

seanpearsonuk commented 2 years ago

For job scheduler environments we can implement a capability where launch_fluent() automatically spins up Fluent (in distributed parallel) using the requested/allocated cluster resources.

dnwillia-work commented 2 years ago

First step is to introduce the modules that can parse the run time environment for the machine list and core counts to pass to Fluent.

Ultimate goal will be that users can run qsub runFluent.sh in a job scheduler, such as UGE, and in the shell wrapper you would have:

#!/bin/bash -l
# Job options for the queue system
#$ -S /bin/bash
#$ -N PyFluent-dnwillia
#$ -pe mpi 40 // Use the process environment "mpi" with a total of 40 cores
#$ -cwd       // Run the job in the directory where the job is submitted
#$ -j y       // Combine standard error with the standard output

# Setup a Python virtual environment for the job
cd /scratch/dnwillia/jobs/mixing-elbow
python -m venv venv
. venv/bin/activate
pip install ansys-fluent-core

# Run Fluent and launch_fluent() will use the resources from the job scheduler
python mixing_elbow.py

In principle support for this could be introduced into the other Python client libraries for APDL or AEDT. Might be worth pulling it out to a separate package.

dnwillia-work commented 2 years ago

It's not quite done.

dnwillia-work commented 2 years ago

This is done. If you submit a PyFluent run into a scheduler environment the machines and cores are automatically extracted to launch fluent within the scheduler environment.

Note that this feature does not cover interactive use of PyFluent when Fluent is running inside a scheduler environment. You cannot starting Fluent within a scheduler environment from PyFluent (interactively or non-interactively).