mindspore.set_ps_context

mindspore.set_ps_context(**kwargs)[source]

Set parameter server training mode context.

Note

Parameter server mode is only supported in graph mode. Some other environment variables should also be set for parameter server training mode. These environment variables are listed below:

  • MS_SERVER_NUM: Server number

  • MS_WORKER_NUM: Worker number

  • MS_SCHED_HOST: Scheduler IP address

  • MS_SCHED_PORT: Scheduler port

  • MS_ROLE: The role of this process:

    • MS_SCHED: represents the scheduler,

    • MS_WORKER: represents the worker,

    • MS_PSERVER/MS_SERVER: represents the Server

Parameters
  • enable_ps (bool) – Whether to enable parameter server training mode. Only after enable_ps is set True, the environment variables will be effective. Default: False .

  • config_file_path (string) – Configuration file path used by recovery, parameter server training mode only supports Server disaster recovery currently. Default: '' .

  • scheduler_manage_port (int) – Scheduler manage port used to scale out/in. Default: 11202 .

  • enable_ssl (bool) – Set PS SSL mode enabled or disabled. Default: False .

  • client_password (str) – Password to decrypt the secret key stored in the client certificate. Default: '' .

  • server_password (str) – Password to decrypt the secret key stored in the server certificate. Default: '' .

Raises

ValueError – If input key is not the attribute in parameter server training mode context.

Examples

>>> import mindspore as ms
>>> ms.set_ps_context(enable_ps=True, enable_ssl=True, client_password='123456', server_password='123456')