# Getting error to use Multiple GPU in pytorch

**URL:** <https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600>\
**Category:** vision\
**Created:** [August 7, 2018, 2:11pm UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600 "2018-08-07T14:11:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmreza](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mmreza/32/6020_2.png) [@mmreza](https://discuss.pytorch.org/u/mmreza)\
**Post date:** [August 7, 2018, 2:11pm UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600/1 "2018-08-07T14:11:18Z")

</div>

Hi, I am running my deep learning model using pytorch. When I am using single GUP, my model is running fine but facing problem using multiple GPU. I searched this problem in google and got idea to downgrade pytorch version 0.3.0. I don’t know where this is the way to rid of my problem or not. However I was trying to downgrade pytorch using  
pip install torch=0.3.0  
But getting error to install. Is there someone to help me to downgrade pytorch using pip.

I got below error during running multiple GPU:  
Exception NameError: “global name ‘FileNotFoundError’ is not defined” in \<bound method \_DataLoaderIter. **del** of \<torch.utils.data.dataloader.\_DataLoaderIter object at 0x7fb3bbaba8d0\>\> ignored  
Traceback (most recent call last):  
File “train.py”, line 61, in   
Variable(data[‘image’]), Variable(data[‘feat’]), infer=save\_fake)  
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 491, in **call**  
result = self.forward(\*input, \*\*kwargs)  
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/parallel/data\_parallel.py”, line 114, in forward  
outputs = self.parallel\_apply(replicas, inputs, kwargs)  
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/parallel/data\_parallel.py”, line 124, in parallel\_apply  
return parallel\_apply(replicas, inputs, kwargs, self.device\_ids[:len(replicas)])  
File “/netscratch/reza/venv/lib/python2.7/site-packages/torch/nn/parallel/parallel\_apply.py”, line 65, in parallel\_apply  
raise output  
TypeError: forward() takes at least 5 arguments (2 given)

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [August 7, 2018, 2:32pm UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600/2 "2018-08-07T14:32:10Z")

</div>

I don’t think downgrading is an optimal solution. I would rather want to fix the issue using the latest release.  
Which PyTorch version are you currently using? If `< 0.4.1`, could you update to it?

Also, could you share a bit of executable code so that we can have a look at this problem?

---

<div class="post-metadata">

**Author:** ![mmreza](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mmreza/32/6020_2.png) [@mmreza](https://discuss.pytorch.org/u/mmreza)\
**Post date:** [August 7, 2018, 3:27pm UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600/3 "2018-08-07T15:27:07Z")

</div>

Hi ptrblck, thanks for your quick reply. Earlier I was using torch 0.4.0. After getting your reply I updated it into torch 0.4.1 but facing the same problem.

Actually I am running pix2pixHD pytorch model for my image dataset. It run smoothly when I use single GPU but getting error if I want to use multiple GPU. My image size is big and having large dataset so I have to use multiple GPU to save time. Please help me to rid of this problem.

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [August 7, 2018, 3:28pm UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600/4 "2018-08-07T15:28:59Z")

</div>

Could you post a small executable code snippet reproducing this error?  
This would make it easier to debug this issue.

---

<div class="post-metadata">

**Author:** ![mmreza](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mmreza/32/6020_2.png) [@mmreza](https://discuss.pytorch.org/u/mmreza)\
**Post date:** [August 7, 2018, 3:35pm UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600/5 "2018-08-07T15:35:18Z")

</div>

Here is the screen shot of the error.

 ![Screenshot%20from%202018-08-07%2017-33-36](https://discuss.pytorch.org/uploads/default/original/2X/2/2ff7b9ff8656baa06765b4ece016849b35cf5f85.png)

---

<div class="post-metadata">

**Author:** ![mmreza](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mmreza/32/6020_2.png) [@mmreza](https://discuss.pytorch.org/u/mmreza)\
**Post date:** [August 7, 2018, 7:48pm UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600/6 "2018-08-07T19:48:31Z")

</div>

The above problem has solved. To see the error it seems the error come from torch but actually there was a limitation in pix2pixHD model and also for torch version 0.4.0. Finally the model ran with multiple GPU after update torch version (0.4.1) and avoid model limitation.

---

<div class="post-metadata">

**Author:** ![yjt2018](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/y/b9e5f3/32.png) [@yjt2018](https://discuss.pytorch.org/u/yjt2018)\
**Post date:** [January 9, 2020, 3:30am UTC](https://discuss.pytorch.org/t/getting-error-to-use-multiple-gpu-in-pytorch/22600/8 "2020-01-09T03:30:51Z")

</div>

> [@mmreza](#):
>
> limitation in pix2pixHD model

I have get error to use Multiple GPU in pytorch when i train pix2pixHD，how to solve the limitation in pix2pixHD model？
