rayjang
rayjang

Reputation: 140

Only 'Import keras' takes 10GB in GPU

I am using EC2 GPU machine with pre-made AMIs. I just put 'import keras' and run it. It takes 11519MiB ( out of 12181MiB). It's non-sense right?

I did googling it. I guess it might come from the path setting. I don't know which causes memory leak.

Anyone who know the solution or experience similar with me??

--UPDATE-- It is the LD_LIBRARY_PATH in my company's GPU server When I used the server at the first time, Only tensorflow was installed, not tensorflow-gpu. So I just did 'pip install --upgrade tensorflow-gpu' enter image description here

Upvotes: 2

Views: 442

Answers (1)

rayjang
rayjang

Reputation: 140

I solved the problem.

It is related to Keras & Tensorflow Memory allocation problem. My setting automatically allocated all memory in GPU. I solve it by the below. Anyway, Thanks all

import tensorflow as tf
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.2)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
from keras import backend as K
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.2
session = tf.Session(config=config)
K.set_session(session)

Upvotes: 6

Related Questions