def _environment_variable_overrides(self, port: int = 6105) -> dict[str, str]:
        """Set the MPI environment variables required for multinode distributed training.

        Args:
            port (int): Used to set MASTER_PORT environment variable if its not present.

        """
        overrides = {}

        overrides["RANK"] = os.environ["OMPI_COMM_WORLD_RANK"]
        overrides["WORLD_SIZE"] = os.environ["OMPI_COMM_WORLD_SIZE"]

        single_node = int(os.environ["OMPI_COMM_WORLD_LOCAL_SIZE"]) == int(overrides["WORLD_SIZE"])
        if not single_node:
            master_node_params = os.environ["AZ_BATCH_MASTER_NODE"].split(":")
            overrides["MASTER_ADDR"] = master_node_params[0]

            # Do not overwrite master port with that defined in AZ_BATCH_MASTER_NODE
            if "MASTER_PORT" not in os.environ:
                overrides["MASTER_PORT"] = str(port)
        else:
            overrides["MASTER_ADDR"] = os.environ["AZ_BATCHAI_MPI_MASTER_NODE"]
            overrides["MASTER_PORT"] = "54965"

        overrides["NCCL_SOCKET_IFNAME"] = "^docker0,lo"

        # set local rank, compute node rank
        overrides["LOCAL_RANK"] = os.environ.get("OMPI_COMM_WORLD_LOCAL_RANK", "-1")
        world_size = os.environ.get("OMPI_COMM_WORLD_SIZE", "1")
        if int(world_size) == 1:
            overrides["NODE_RANK"] = "0"
        else:
            local_size = int(os.environ["OMPI_COMM_WORLD_LOCAL_SIZE"])
            node_rank = (int(overrides["RANK"]) - int(overrides["LOCAL_RANK"])) // local_size
            overrides["NODE_RANK"] = str(node_rank)

        return overrides
Set the MPI environment variables required for multinode distributed training.

        Args:
            port (int): Used to set MASTER_PORT environment variable if its not present.

        
olive/passes/pytorch/cluster.py