start#

ansys.mapdl.core.cli.start.start(exec_file=None, run_location=None, jobname='file', nproc=2, ram=None, override=False, additional_switches='', start_timeout=45, port=None, license_type=None, version=None, loglevel='')#

Launch an MAPDL instance without connecting a client to it.

Parameters:
exec_filestr, optional

Location of the MAPDL executable. The cached location is used when left at None and no environment variable is set. The executable path can also be set through the PYMAPDL_MAPDL_EXEC environment variable.

run_locationstr, optional

MAPDL working directory. Defaults to a temporary working directory. The directory is created when it does not exist.

jobnamestr, default: “file”

MAPDL jobname.

nprocint, default: 2

Number of processors.

ramint, optional

Fixed amount of memory to request for MAPDL, in megabytes. When None, MAPDL uses as much as available on the host machine.

overridebool, default: False

Whether to delete the lock file at run_location. Useful when a previous MAPDL session exited prematurely.

additional_switchesstr, default: “”

Additional switches for MAPDL, for example "aa_r" for the academic research license. Avoid switches such as -i, -o or -b, which are already included.

start_timeoutint, default: 45

Maximum allowable time to connect to the MAPDL server.

portint, optional

Port to launch the MAPDL gRPC server on. The final port is the first one available after (or including) this port. Defaults to 50052, or to the PYMAPDL_PORT environment variable when it is set.

license_typestr, optional

License name (for example "meba") or description (for example "enterprise solver"). When None, the license server decides which license to provide.

versionstr, optional

Version of MAPDL to launch. When None, the latest installed version is used.

loglevelstr, default: “”

Logging level of the MAPDL process.

Returns:
tuple of (str, int, int or None)

IP address, port, and process ID of the launched instance. The process ID is None when the process is not managed locally, such as on HPC schedulers.

Raises:
LaunchError

When the MAPDL instance cannot be launched.

Return type:

Tuple[str, int, Optional[int]]

Examples

Launch an instance on port 50054:

>>> from ansys.mapdl.core.cli.start import start
>>> ip, port, pid = start(port=50054)
>>> print(f"{ip}:{port}")
127.0.0.1:50054