karpathy / char-rnn

Multi-layer Recurrent Neural Networks (LSTM, GRU, RNN) for character-level language models in Torch
11.58k stars 2.58k forks source link

Question about computational speed when using different numbers of CPUs #191

Closed Rick-McCoy closed 7 years ago

Rick-McCoy commented 7 years ago

Since my laptop's not that powerful when it comes to computing, I've been using Amazon Web Services Elastic Compute Cloud(EC2) to run these programs. But I've noticed that the computational speed doesn't change when I use different options.

For example, the basic t2.micro model consists of 1 CPU and 1 GB of RAM, and takes around 3 seconds when training on a 128-2 model, and 12 to 15 seconds on a 256-2 model. The compute-optimized c4.xlarge model consists of 36 CPUs and 60 GBs of RAM, and also takes around 3 seconds on a 128-2 model, 12 to 15 seconds on a 256-2 model. My laptop using Intel i7 6600U(Skylake) also takes a similar amount of time. All of these were trained on a single 10MB input.

Is this supposed to happen? If so, is there a way to decrease the time?

~P.S. I've tried to use GPU, but due to my infinitesimal amount of knowledge of Ubuntu, I've failed to install CUDA and all the tidbits that are necessary. I formatted my laptop 3 times while trying this, and don't want to lose all my files again. It's a miracle that I succeeded in the CPU version. Does anyone have an 'Idiot's version' of using GPU that I can follow line-by-line? I'm using Ubuntu 16.04.~

Edit: Fixed. Blood for the blood god, Sacrificial Servers for the Computer God.

danindiana commented 7 years ago

I narrowly avoided not being able to get the system to run when installing Cuda on Ubuntu 14.04, I think the only thing that saved me was a make clean command during the process which allowed me to continue.

I followed several of the links in this article: https://hackernoon.com/learning-ai-if-you-suck-at-math-p7-the-magic-of-natural-language-processing-f3819a689386

That may be of some help.

Can you provide the command line functions, flags, etc. you are entering? That might help/

Rick-McCoy commented 7 years ago

Thanks for the link! I learned a lot.

I could not salvage my files, but after using several EC2 instances as sacrificial offerings to the Computer God, I finally identified my problem, and succeeded in installing CUDA. But thanks anyway for your help.

Rick-McCoy commented 7 years ago

Never mind, figured out that increasing seq_length&batch_size works.