def parallel_gpu_jobs(allow_growth=True, fraction=0.5):
    """Sets the max used memory as a fraction for tensorflow
    backend

    allow_growth :: True of False

    fraction :: a float value (e.g. 0.5 means 4gb out of 8gb)

    """
    import keras.backend as K
    import tensorflow as tf
    gpu_options = tf.GPUOptions(allow_growth=allow_growth,
        per_process_gpu_memory_fraction=fraction)
    config = tf.ConfigProto(gpu_options=gpu_options)
    session = tf.Session(config=config)
    K.set_session(session)
