pythongoogle-cloud-platformrecurrent-neural-network

Python killed on GCP


I have been working on comparison to run deep learning code on local machine and Google Cloud Platform. The code is about recurrent neural network and it ran perfectly well on local machine. But on GCP cloud shell, when I want to compile my python file, it shows "Killed"

userID@projectID:~$ python rnn.py

Killed

Is it because that I am out of memory? (because I tried to run line by line, and on the second time I assigned large data to a variable, it stuck.) My code is somewhat like this

imdb = np.load('imdb_word_emb.npz') X_train = imdb['X_train'] X_test = imdb['X_test']

on the third line, the machine stuck and showed "Killed"

I tried to change the order of the second and third line, it still stuck at the third line. My training data is a (25000,80,128)-array. So is my testing data. The data set works perfectly well on my local machine. I am sure there are no problem with this data set.

Or is it because of other reasons? It would be awesome if people who know how to solve or even few key words tell me how to deal with this. Thank you :D


Solution

  • The error you are getting is because Cloud Shell is not intended for computational or network intensive processes, see Cloud Shell limitations.

    I understand you want to compare your local machine with Google Cloud Platform. As stated in the public docs:

    "When you start Cloud Shell, it provisions a g1-small Google Compute Engine"

    A g1-small machine type has 1.70GB RAM and a shared physical core. Keeping this in mind and also that is a limited as stated before, your local machine is likely more powerful than Cloud Shell so you'd not see any improvement.

    I recommend you to create a Compute Engine instance with a different machine type, you can use a custom machine type to set the number of cores and GB of RAM you want to have. I guess you want to benefit from running your workload faster in Google Compute Engine so you can choose a better machine type than your local one in terms of resources and compare how much it improves.