tensorpack icon indicating copy to clipboard operation
tensorpack copied to clipboard

alexnet_dorefa could not utilize all GPUs, training is slow

Open tunghoang290780 opened this issue 7 years ago • 10 comments

@ppwwyyxx

1. What you did:

(1) If you're using examples, what's the command you run: python ./alexnet-dorefa.py --gpu 0,1,2,3,4,5,6,7,8 --dorefa 1,2,6 --data ImageNet_2012

(2) **If you're using examples, have you made any changes to the examples? ** No change except set the number of GPU to 8x

2. What you observed:

(1) Include the ENTIRE logs here: We see the training process started and the dataset was allocated all over all 8xGPU (NVIDIA Tesla V100). However, only one GPU is used for training at a time and its utilization is very low image

4. Your environment:

  • Latest Tensorpack, install via pip
  • Output of this command: python -c 'import tensorpack.tfutils as u; print(u.collect_env_info())' import tensorpack.tfutils as u image

tunghoang290780 avatar Oct 22 '19 23:10 tunghoang290780

Hi, Is the top 1 accuracy calculation used in the alexnet-dorefa.py correct? I am using a different architecture like MobileNet and 1,1,32 dorefa structure to train and the top 1 accuracy seems quite good.

roshan-gopalakrishnan avatar Oct 23 '19 07:10 roshan-gopalakrishnan

The speed is not slow when I run it. You can follow https://tensorpack.readthedocs.io/tutorial/performance-tuning.html#figure-out-the-bottleneck to see whether your training is bottlenecked by data loading.

ppwwyyxx avatar Oct 23 '19 14:10 ppwwyyxx

I din't mean speed but the top 1 accuracy calculation whether it is correct in the tensorpack package? I see some issue with the implementation of top 1 accuracy and top 5 accuracy. Can you check if the implementation is correct or not ?

roshan-gopalakrishnan avatar Oct 23 '19 15:10 roshan-gopalakrishnan

I mean speed because the original post is about speed.

If you believe there is an issue, please point out where. Otherwise I don't know what to check.

ppwwyyxx avatar Oct 23 '19 15:10 ppwwyyxx

The speed is not slow when I run it. You can follow https://tensorpack.readthedocs.io/tutorial/performance-tuning.html#figure-out-the-bottleneck to see whether your training is bottlenecked by data loading.

@ppwwyyxx: Thanks for tips. I will deep dive into the link. I also thought that is due to data loading from CPU to GPU. I have upto 40 cores so the data loading should be fast. I will get back to you later when I have more information.

tunghoang290780 avatar Oct 23 '19 18:10 tunghoang290780

@ppwwyyxx: btw, I installed tensorflow-1.14 and tensorpack-0.9.8 via "conda" environment. Is it same to the one that you used to runDoReFa alexnet or others (virtualenv, install from source, docker etc.)

tunghoang290780 avatar Oct 23 '19 21:10 tunghoang290780

I use tensorflow 1.14 from pip but I don't think tensorflow version matters here.

ppwwyyxx avatar Oct 23 '19 21:10 ppwwyyxx

If I use the 1 bit activation for my last layer, I see there is an error in the accuracy calculation. Is that right? How is the calculation becoming wrong?

roshan-gopalakrishnan avatar Oct 24 '19 08:10 roshan-gopalakrishnan

@roshan-gopalakrishnan I could not understand what you're asking and it also seems unrelated to this issue.

ppwwyyxx avatar Oct 24 '19 08:10 ppwwyyxx

I use tensorflow 1.14 from pip but I don't think tensorflow version matters here.

@ppwwyyxx: I remove anaconda3 (conda) and use system "pip3" to directly install tensorflow-1.15. The training performance is tremendously improved. With 8xGPU V100 and 40 cores CPU, training one epoch took 14 minutes which is pretty good. Thank for your help.

tunghoang290780 avatar Oct 25 '19 16:10 tunghoang290780