Skip to content

Commit

Permalink
Adding documentation about remote mapdl pool
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Apr 30, 2024
1 parent 8920809 commit ce0c6a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions doc/source/user_guide/pool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ at the current directory within their own isolated directories:
>>> pool = MapdlPool(10, nproc=1, run_location=my_path)
Creating Pool: 100%|########| 10/10 [00:01<00:00, 1.43it/s]
Additionally, you can group already running MAPDL instances by connecting to
them by specifying their ports when creating the pool.

.. code:: pycon
>>> from ansys.mapdl.core import MapdlPool
>>> pool = MapdlPool(port=[50082, 50083, 50084, 50085, 50086])
'MAPDL Pool with 5 active instances'
>>> pool.exit(block=True)
You can access each individual MAPDL instance with this code:

.. code:: pycon
Expand Down
4 changes: 3 additions & 1 deletion src/ansys/mapdl/core/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class MapdlPool:

def __init__(
self,
n_instances: int,
n_instances: int = None,
wait: bool = True,
run_location: Optional[str] = None,
port: Union[int, List[int]] = MAPDL_DEFAULT_PORT,
Expand Down Expand Up @@ -240,6 +240,7 @@ def __init__(
ports = available_ports(n_instances, port)
else:
ports = port
n_instances = len(ports)

if self._root_dir is not None:
if not os.path.isdir(self._root_dir):
Expand All @@ -249,6 +250,7 @@ def __init__(
ports = [port + i for i in range(n_instances)]
else:
ports = port
n_instances = len(ports)

if len(ports) != n_instances:
raise ValueError(
Expand Down

0 comments on commit ce0c6a3

Please sign in to comment.