Repository: facebookresearch/CompilerGym

Issue:
Manual env fails without helpful error when no benchmarks are loaded.
## 🐛 Bug

compiler_gym.bin.manual_env fails with stacktrace if no benchmarks are loaded.

## To Reproduce
```
> python -m compiler_gym.bin.manual_env --env=llvm-autophase-ic-v0 --benchmark=npb-v0/50
Initialized environment in 264.7ms
Benchmark: [0] random >>> random
> 0
Traceback (most recent call last):
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.1.1-py3.8.egg/compiler_gym/bin/manual_env.py", line 179, in <module>
    main(sys.argv)
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.1.1-py3.8.egg/compiler_gym/bin/manual_env.py", line 175, in main
    run_manual_env(env)
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.1.1-py3.8.egg/compiler_gym/bin/manual_env.py", line 60, in run_manual_env
    eager_observation = env.reset(benchmark=benchmark)
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.1.1-py3.8.egg/compiler_gym/envs/llvm/llvm_env.py", line 162, in reset
    return super().reset(*args, **kwargs)
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.1.1-py3.8.egg/compiler_gym/envs/compiler_env.py", line 466, in reset
    reply = self.service(
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.1.1-py3.8.egg/compiler_gym/service/connection.py", line 547, in __call__
    return self.connection(
  File "/Users/hleather/opt/miniconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.1.1-py3.8.egg/compiler_gym/service/connection.py", line 143, in __call__
    raise ValueError(e.details()) from None
ValueError: Unknown benchmark "npb-v0/50"
```
## Expected behavior
Something like:
```
> python -m compiler_gym.bin.manual_env --env=llvm-autophase-ic-v0 --benchmark=npb-v0/50
Initialized environment in 264.7ms
No benchmarks available see https://facebookresearch.github.io/CompilerGym/getting_started.html#installing-benchmarks
Exiting...
```

## Environment

Please fill in this checklist:

- CompilerGym:
- How you installed CompilerGym (conda, pip, source): source
- OS: MacOs 10.15.7
- Python version: 3.8.4
- Build command you used (if compiling from source): make install
- GCC/clang version (if compiling from source): Apple clang version 12.0.0 (clang-1200.0.31.1)
- Bazel version (if compiling from source): 3.1.0- (@non-git)
- Versions of any other relevant libraries:

You may use the PyTorch
N/A



Discussion:

Resolving patch:
diff --git a/compiler_gym/bin/manual_env.py b/compiler_gym/bin/manual_env.py
--- a/compiler_gym/bin/manual_env.py
+++ b/compiler_gym/bin/manual_env.py
@@ -43,10 +43,16 @@ def run_manual_env(env: CompilerEnv):
         # Allow the user to choose a benchmark, with the first choice being
         # to select randomly.
         benchmarks = sorted(env.benchmarks)
+        if not benchmarks:
+            print("No benchmarks available see https://facebookresearch.github.io/CompilerGym/getting_started.html#installing-benchmarks")
+            print("Exiting...")
+            env.close()
+            return
+
         # Strip default benchmark:// protocol.
         for i, benchmark in enumerate(benchmarks):
             if benchmark.startswith("benchmark://"):
-                benchmarks[i] = benchmark[len("benchmark://") :]
+                benchmarks[i] = benchmark[len("benchmark://"):]
 
         benchmark_index = user_input.read_list_index(
             "Benchmark", ["random"] + benchmarks


Test patch: