{
  "id": 423939,
  "title": "What is the key codes for 2 GPUs?",
  "url": "/competitions/google-research-identify-contrails-reduce-global-warming/discussion/423939",
  "author_name": "Wood Carter",
  "post_date": "2023-07-12T02:08:42.107000",
  "votes": 3,
  "comment_count": 5,
  "views": 0,
  "content": "<p>Trying to train with 2 GPUs ,failed again and again. What is the key codes for training by 2 GPUs? </p>",
  "messages": [
    {
      "id": 2342205,
      "postDate": "2023-07-12T15:43:06.700Z",
      "content": "<p>yup .something like </p>\n<pre><code> = UNet(Config)\n\n torch.cuda.device_count() &gt; :\n    (f)\n     = torch.nn.DataParallel()\n     = .cuda() \n</code></pre>",
      "rawMarkdown": "yup .something like \n\n```\nmodel = UNet(Config)\n# If there are multiple GPUs, wrap the model with DataParallel\nif torch.cuda.device_count() > 1:\n    print(f\"Using {torch.cuda.device_count()} GPUs\")\n    model = torch.nn.DataParallel(model)\n    model = model.cuda() \n```",
      "votes": 4,
      "replies": [
        {
          "id": 2346093,
          "postDate": "2023-07-16T02:43:10Z",
          "content": "<p>The codes are working! Thank you very much!</p>",
          "rawMarkdown": "The codes are working! Thank you very much!",
          "replies": [
            {
              "id": 2352754,
              "postDate": "2023-07-21T08:29:31.133Z",
              "content": "<p>just you need to do same at infer remember 😁</p>",
              "rawMarkdown": "just you need to do same at infer remember 😁"
            }
          ]
        }
      ]
    },
    {
      "id": 2341267,
      "postDate": "2023-07-12T02:08:42.107Z",
      "content": "<p>Trying to train with 2 GPUs ,failed again and again. What is the key codes for training by 2 GPUs? </p>",
      "rawMarkdown": "Trying to train with 2 GPUs ,failed again and again. What is the key codes for training by 2 GPUs? ",
      "votes": 2
    },
    {
      "id": 2341554,
      "postDate": "2023-07-12T06:55:00.627Z",
      "content": "<p>If you are using torch, check DistributedDataParallel and DataParallel</p>",
      "rawMarkdown": "If you are using torch, check DistributedDataParallel and DataParallel",
      "replies": [
        {
          "id": 2341587,
          "postDate": "2023-07-12T07:17:56.293Z",
          "content": "<p>Will try.Thank you very much.</p>",
          "rawMarkdown": "Will try.Thank you very much."
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2342205,
      "author_name": "Gaurav Rawat",
      "author_url": "",
      "post_date": "2023-07-12T15:43:06.700000",
      "content": "<p>yup .something like </p>\n<pre><code> = UNet(Config)\n\n torch.cuda.device_count() &gt; :\n    (f)\n     = torch.nn.DataParallel()\n     = .cuda() \n</code></pre>",
      "votes": 4,
      "replies": [
        {
          "id": 2346093,
          "author_name": "Wood Carter",
          "author_url": "",
          "post_date": "2023-07-16T02:43:10",
          "content": "<p>The codes are working! Thank you very much!</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2352754,
              "author_name": "Gaurav Rawat",
              "author_url": "",
              "post_date": "2023-07-21T08:29:31.133000",
              "content": "<p>just you need to do same at infer remember 😁</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2341554,
      "author_name": "olivepicker",
      "author_url": "",
      "post_date": "2023-07-12T06:55:00.627000",
      "content": "<p>If you are using torch, check DistributedDataParallel and DataParallel</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2341587,
          "author_name": "Wood Carter",
          "author_url": "",
          "post_date": "2023-07-12T07:17:56.293000",
          "content": "<p>Will try.Thank you very much.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2342205": "yup .something like \n\n```\nmodel = UNet(Config)\n# If there are multiple GPUs, wrap the model with DataParallel\nif torch.cuda.device_count() > 1:\n    print(f\"Using {torch.cuda.device_count()} GPUs\")\n    model = torch.nn.DataParallel(model)\n    model = model.cuda() \n```",
    "2341267": "Trying to train with 2 GPUs ,failed again and again. What is the key codes for training by 2 GPUs? ",
    "2341554": "If you are using torch, check DistributedDataParallel and DataParallel"
  }
}