Skip to content

Commit

Permalink
minor fixed for distributed mode
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyxclack committed Apr 20, 2022
1 parent 7815265 commit 869e491
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,17 @@ To run with distributed mode, you only need to:

- Prepare isolated data file and set up `cfg.distribute.data_file = PATH/TO/DATA` for each participant;
- Change `cfg.federate.model = 'distributed'`, and specify the role of each participant by `cfg.distributed.role = 'server'/'client'`.
- Set up a valid address by `cfg.distribute.host = x.x.x.x` and `cfg.distribute.host = xxxx`. (Note that for a server, you need to set up server_host/server_port for listening messge, while for a client, you need to set up client_host/client_port for listening and server_host/server_port for sending join-in applications when building up an FL course)
- Set up a valid address by `cfg.distribute.host = x.x.x.x` and `cfg.distribute.port = xxxx`. (Note that for a server, you need to set up server_host/server_port for listening messge, while for a client, you need to set up client_host/client_port for listening and server_host/server_port for sending join-in applications when building up an FL course)

We prepare a synthetic example for running with distributed mode:

```bash
# For server
python main.py --cfg federatedscope/example_configs/distributed_server.yaml data_path 'PATH/TO/DATA' server.host x.x.x.x client.port xxxx
python main.py --cfg federatedscope/example_configs/distributed_server.yaml data_path 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx

# For client
python main.py --cfg federatedscope/example_configs/distributed_client.yaml data_path 'PATH/TO/DATA' server.host x.x.x.x server.port xxxx client.host x.x.x.x client.port xxxx
# For clients
python main.py --cfg federatedscope/example_configs/distributed_client_1.yaml data_path 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx
python main.py --cfg federatedscope/example_configs/distributed_client_2.yaml data_path 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx
```

And you can observe the results as (the IP addresses are anonymized with 'x.x.x.x'):
Expand Down
9 changes: 5 additions & 4 deletions federatedscope/example_configs/distributed_client_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ federate:
make_global_eval: False
online_aggr: False
distribute:
server_host: 'xx.xx.xx.xx'
server_port: x
client_host: 'xx.xx.xx.xx'
client_port: x
use: True
server_host: '127.0.0.1'
server_port: 50051
client_host: '127.0.0.1'
client_port: 50052
role: 'client'
data_file: 'toy_data/client_1_data'
trainer:
Expand Down
9 changes: 5 additions & 4 deletions federatedscope/example_configs/distributed_client_2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ federate:
make_global_eval: False
online_aggr: False
distribute:
server_host: 'xx.xx.xx.xx'
server_port: x
client_host: 'xx.xx.xx.xx'
client_port: x
use: True
server_host: '127.0.0.1'
server_port: 50051
client_host: '127.0.0.1'
client_port: 50053
role: 'client'
data_file: 'toy_data/client_2_data'
trainer:
Expand Down
5 changes: 3 additions & 2 deletions federatedscope/example_configs/distributed_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ federate:
make_global_eval: False
online_aggr: False
distribute:
server_host: ''xx.xx.xx.xx
server_port: x
use: True
server_host: '127.0.0.1'
server_port: 50051
role: 'server'
data_file: 'toy_data/server_data'
trainer:
Expand Down

0 comments on commit 869e491

Please sign in to comment.