ray-project / ray

Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
https://ray.io
Apache License 2.0
33.57k stars 5.7k forks source link

Virtual environment RayOutOfMemoryError #9068

Closed SaiVinay007 closed 4 years ago

SaiVinay007 commented 4 years ago

What is the problem?

I am getting RayOutOfMemoryError and The maximum usage is from the virtual environment

PID MEM COMMAND 25583 3.19GiB /home/saivinay/Documents/RL_project/venv/bin/python -u /home/saivinay/Documents/RL_project/venv/lib/

This started showing up recently and didn't face this before. My assumption is that, I recently used jupyter notebook and tried registering a custom environment and test the environment.

Ray 0.8.4 Python 3.6 Tensorflow 1.15 Ubuntu 16.04

The code i tried in the jupyter notebook.


import rllib_helpers as helpers
helpers.register_madras()

from MADRaS.envs.gym_madras import MadrasEnv

def test_madras_vanilla():
    env = MadrasEnv()
    # print("Started env")
    logging.info("Testing reset...")
    # os.system("pkill torcs")
    obs = env.reset()
    exit()
    logging.info("Initial observation: {}."
                 " Verify if the number of dimensions {} is right.".format(obs, len(obs)))
    logging.info("Testing step...")
    for t in range(20000):
        obs, r, done, _ = env.step([0.0, 1.0, -1.0])
        logging.info("{}: reward={}, done={}".format(t, r, done))
        if done:
            env.reset()
    os.system("pkill torcs")

test_madras_vanilla()

The code from helpers:

import ray
from ray.tune.registry import register_env

def env_creator(env_config):
    env = gym.make('Madras-v0')
    return env

def register_madras():
    register_env("madras_env", env_creator)

Setup:

  1. virtualenv --python=python3.6 venv
  2. ipython kernel install --user --name=.venv (for installing ipython kernal in this environment)
  3. Open jupyter notebook and I tried to register a custom environment (I am assuming the error started after using ray inside jupyter notebook. )

I thought it was from the virtual environment so i created a new virtual environment and tried running my training code, again I encountered the same issue but this time without even using any jupyter notebook in the new environment. So it seems like it started somehow and keeps occurring in every new environment.

Can someone help me in solving this problem. Thanks.

edoakes commented 4 years ago

@SaiVinay007 can you reproduce this with a standard benchmark environment? I'm going to close this for now, please re-open if you can.