theislab / scgen

Single cell perturbation prediction
https://scgen.readthedocs.io
GNU General Public License v3.0
260 stars 52 forks source link

scgen running on GPU? #22

Closed vkedlian closed 4 years ago

vkedlian commented 4 years ago

Hi,

Can I wonder if it is possible to use scgen on GPU and if yes - do I need to add any specific parameters for that?

Thanks, Veronika

M0hammadL commented 4 years ago

Hi Veronika,

Yes, scGen by default downloads the CPU version of TensorFlow and does not use GPU. to use GPU, please remove TensorFlow CPU and then install TensorFlow GPU. Please be careful about the version of TF. please have look at here and here .

vkedlian commented 4 years ago

Hi @M0hammadL ! Thanks a lot for the explanation - it works for me now with GPU! The only thing I have noticed that when I try small batches ( like 30-500 cells) - GPU utilization is very low (between 0-5%) and it takes long time for one epoch to run (from 1 hour to 3-4 min). In contrast, when I increase batch size to 4000 cells - GPU utilization is higher (between 0-35%) and each epoch takes substantially less time. Thus, my question is if it is Ok to use big batches and if you can suggest any guidance on how to choose batch size for specific dataset to get the optimal performance ? For example, is 1/20 of dataset would be optimal to use as a batch size (as I am using now)?

M0hammadL commented 4 years ago

please use the Keras version in this case scgen.VAEArithKeras(..)