question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is running CompilerGym intended to leave cache directories behind?

See original GitHub issue

❓ Questions and Help

Not sure if this is a bug or not, so submitting as a question. Running a CompilerGym experiment leaves behind many cache directories. When running a large experiment, this can create problems through the sheer number of directories in COMPILER_GYM_CACHE. I expected the COMPILER_GYM_CACHE to not have anything after the experiment exited cleanly.

Is there a way to avoid the experiments leaving the directories behind?

Steps to reproduce

Running the following on my machine leaves behind about 270 cache directories.

import compiler_gym
import compiler_gym.wrappers
from ray import tune
from ray.rllib.agents.ppo import PPOTrainer


def make_env(env_config):
    env = compiler_gym.make(env_config['cgym_id'])
    env = compiler_gym.wrappers.TimeLimit(env, env_config['timelimit'])
    dataset = env.datasets[env_config['dataset']]
    env = compiler_gym.wrappers.CycleOverBenchmarks(
        env, dataset.benchmarks())
    return env


config = {
    "env_config": {
        "cgym_id": "llvm-autophase-ic-v0",
        "timelimit": 45,
        "dataset": "benchmark://cbench-v1",
    },
    "env": "CompilerGym",
}

stop = {
    "timesteps_total": 10_000,
}

tune.register_env("CompilerGym", make_env)
tune.run(
    PPOTrainer,
    config=config,
    stop=stop,
    name='cgym_cache_dir_demo',
)

Environment

Please fill in this checklist:

  • CompilerGym: 0.2.2
  • How you installed CompilerGym (conda, pip, source): pip
  • OS: Ubuntu 20.04.1 LTS (x86_64)
  • Python version: 3.9.7
  • Build command you used (if compiling from source): N/A
  • GCC/clang version (if compiling from source): N/A
  • Bazel version (if compiling from source): N/A
  • Versions of any other relevant libraries: ray: 1.10.0, gym: 0.20.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ChrisCumminscommented, Mar 3, 2022

Thanks for reporting the issue @vuoristo, it was a fun bug to hunt 🙂

Cheers, Chris

1reaction
ChrisCumminscommented, Mar 3, 2022

Do you also know why this seems to differ between the systems?

That’s a good question. To be honest, I don’t know. In the logs you posted, it looks like the shutdown routine is running on your system, which leads me to believe it’s likely a race condition. This would also explain the randomness.

Cheers, Chris

Read more comments on GitHub >

github_iconTop Results From Across the Web

compiler_gym — CompilerGym 0.2.5 documentation
Files in this directory are intended to be long lived (this is not a cache), but it is safe to delete this directory,...
Read more >
CompilerGym: Robust, Performant Compiler Optimization ...
CompilerGym enables anyone to experiment on production compiler optimiza- tion problems through an easy-to-use package, regardless of their experience with ...
Read more >
facebookresearch/CompilerGym: Reinforcement learning ...
CompilerGym is a library of easy to use and performant reinforcement learning environments for compiler tasks. It allows ML researchers to interact with ......
Read more >
(PDF) NeuroVectorizer: end-to-end vectorization with deep ...
This survey summarizes and classifies the recent advances in using machine learning for the compiler optimization field, particularly on the two major problems ......
Read more >
2021 October 03
Most GNU/Linux distributions put the /tmp folder (where all sorts of ... The memory caching software is a free, open-source project that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found