Constructs the DGL server-specific env vars string that are required for DGL code to behave in the correct server role. Convenience function. Args: num_samplers: num_server_threads: tot_num_clients: part_config: Partition config. Relative path
(
num_samplers: int,
num_server_threads: int,
tot_num_clients: int,
part_config: str,
ip_config: str,
num_servers: int,
graph_format: str,
pythonpath: Optional[str] = "",
)
| 321 | |
| 322 | |
| 323 | def construct_dgl_server_env_vars( |
| 324 | num_samplers: int, |
| 325 | num_server_threads: int, |
| 326 | tot_num_clients: int, |
| 327 | part_config: str, |
| 328 | ip_config: str, |
| 329 | num_servers: int, |
| 330 | graph_format: str, |
| 331 | pythonpath: Optional[str] = "", |
| 332 | ) -> str: |
| 333 | """Constructs the DGL server-specific env vars string that are required for DGL code to behave in the correct |
| 334 | server role. |
| 335 | Convenience function. |
| 336 | |
| 337 | Args: |
| 338 | num_samplers: |
| 339 | num_server_threads: |
| 340 | tot_num_clients: |
| 341 | part_config: Partition config. |
| 342 | Relative path to workspace. |
| 343 | ip_config: IP config file containing IP addresses of cluster hosts. |
| 344 | Relative path to workspace. |
| 345 | num_servers: |
| 346 | graph_format: |
| 347 | pythonpath: Optional. If given, this will pass this as PYTHONPATH. |
| 348 | |
| 349 | Returns: |
| 350 | server_env_vars: The server-specific env-vars in a string format, friendly for CLI execution. |
| 351 | |
| 352 | """ |
| 353 | server_env_vars_template = ( |
| 354 | "DGL_ROLE={DGL_ROLE} " |
| 355 | "DGL_NUM_SAMPLER={DGL_NUM_SAMPLER} " |
| 356 | "OMP_NUM_THREADS={OMP_NUM_THREADS} " |
| 357 | "DGL_NUM_CLIENT={DGL_NUM_CLIENT} " |
| 358 | "DGL_CONF_PATH={DGL_CONF_PATH} " |
| 359 | "DGL_IP_CONFIG={DGL_IP_CONFIG} " |
| 360 | "DGL_NUM_SERVER={DGL_NUM_SERVER} " |
| 361 | "DGL_GRAPH_FORMAT={DGL_GRAPH_FORMAT} " |
| 362 | "{suffix_optional_envvars}" |
| 363 | ) |
| 364 | suffix_optional_envvars = "" |
| 365 | if pythonpath: |
| 366 | suffix_optional_envvars += f"PYTHONPATH={pythonpath} " |
| 367 | return server_env_vars_template.format( |
| 368 | DGL_ROLE="server", |
| 369 | DGL_NUM_SAMPLER=num_samplers, |
| 370 | OMP_NUM_THREADS=num_server_threads, |
| 371 | DGL_NUM_CLIENT=tot_num_clients, |
| 372 | DGL_CONF_PATH=part_config, |
| 373 | DGL_IP_CONFIG=ip_config, |
| 374 | DGL_NUM_SERVER=num_servers, |
| 375 | DGL_GRAPH_FORMAT=graph_format, |
| 376 | suffix_optional_envvars=suffix_optional_envvars, |
| 377 | ) |
| 378 | |
| 379 | |
| 380 | def construct_dgl_client_env_vars( |