{"id":27641281,"url":"https://github.com/udthegooner/distributed-ml","last_synced_at":"2026-05-16T01:32:47.945Z","repository":{"id":288374811,"uuid":"967825222","full_name":"udthegooner/Distributed-ML","owner":"udthegooner","description":"Distributed training of  a VGG-11 network on the CIFAR-10 dataset","archived":false,"fork":false,"pushed_at":"2025-04-17T04:53:56.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T23:47:02.186Z","etag":null,"topics":["allreduce","ddp","gloo","pytorch","vgg-11"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/udthegooner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-17T04:10:32.000Z","updated_at":"2025-04-17T04:54:00.000Z","dependencies_parsed_at":"2025-04-17T19:03:28.813Z","dependency_job_id":"c1f8972a-0f9b-499f-84e4-391a504721f0","html_url":"https://github.com/udthegooner/Distributed-ML","commit_stats":null,"previous_names":["udthegooner/distributed-ml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/udthegooner/Distributed-ML","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udthegooner%2FDistributed-ML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udthegooner%2FDistributed-ML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udthegooner%2FDistributed-ML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udthegooner%2FDistributed-ML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/udthegooner","download_url":"https://codeload.github.com/udthegooner/Distributed-ML/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udthegooner%2FDistributed-ML/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274005336,"owners_count":25205934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allreduce","ddp","gloo","pytorch","vgg-11"],"created_at":"2025-04-23T23:43:03.697Z","updated_at":"2026-05-16T01:32:47.916Z","avatar_url":"https://github.com/udthegooner.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed Training with AllReduce, DDP, and Custom Gather/Scatter\n\nThis repository contains an implementation of distributed training techniques using PyTorch, including **AllReduce**, **Distributed Data Parallel (DDP)**, and custom **Gather/Scatter** operations. The code is designed for training models using the CIFAR-10 dataset with a **VGG11** architecture. The setup is intended for **CPU-only** execution.\n\n## Files\n\n### 1. `allreduce.py`\nContains the implementation of the **AllReduce** technique for averaging gradients across multiple nodes in a distributed setup. This helps synchronize the model weights during training.\n\n### 2. `ddp.py`\nImplements **Distributed Data Parallel (DDP)**, a PyTorch feature that improves training efficiency by distributing the model across multiple processes and updating the gradients in parallel. This file sets up the environment for DDP training.\n\n### 3. `gather_scatter.py`\nIncludes custom **Gather** and **Scatter** operations, which collect and distribute model gradients across nodes. This allows for synchronized updates to the model parameters during training.\n\n### 4. `model.py`\nDefines the **VGG11** model architecture, which is used for training on the CIFAR-10 dataset. The model consists of several convolutional layers followed by fully connected layers for classification.\n\n## Requirements\n- Python 3.x\n- PyTorch\n- NumPy\n- CIFAR-10 dataset (automatically downloaded)\n\n## Setup\nTo set up and run the code:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/distributed-training.git\n   cd distributed-training\n   ```\n\n2. Install the required dependencies:\n   ```bash\n   pip install torch torchvision numpy\n   ```\n\n## Running the Code\n\n### Starting the Distributed Training\n\nThe code uses **PyTorch's Distributed** framework. To start training on multiple nodes, run the `ddp.py` script with the appropriate arguments. Example for running on 2 nodes:\n\n```bash\npython ddp.py --master-ip \"127.0.0.1\" --num-nodes 2 --rank 0\n```\n\n- `--master-ip` is the IP address of the master node.\n- `--num-nodes` specifies the number of nodes in the distributed setup.\n- `--rank` is the rank of the current node (0 for the master node).\n\n### Training Flow\n1. **Gather/Scatter Operations**: The model's parameters are updated during training using custom gather and scatter functions, ensuring that all gradients are synchronized across nodes.\n2. **DDP Setup**: The Distributed Data Parallel framework ensures efficient training by parallelizing the process and updating gradients in parallel.\n3. **Model**: The VGG11 model is trained on the CIFAR-10 dataset using the **CrossEntropyLoss** criterion and **SGD optimizer**.\n\n### Model and Dataset\n\n- **Model**: VGG11 - A deep neural network with convolutional layers, batch normalization, and ReLU activation.\n- **Dataset**: CIFAR-10 - A benchmark dataset for image classification with 60,000 32x32 color images in 10 classes.\n\n## Output\n- The code will output the training loss and accuracy after each epoch.\n- For each node, the model will synchronize gradients using the AllReduce or custom gather-scatter operations.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudthegooner%2Fdistributed-ml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fudthegooner%2Fdistributed-ml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudthegooner%2Fdistributed-ml/lists"}