facebookresearch / CompilerGym

Reinforcement learning environments for compiler and program optimization tasks
https://compilergym.ai/
MIT License
885 stars 123 forks source link

RL examples test is broken on CI #750

Closed ChrisCummins closed 1 year ago

ChrisCummins commented 1 year ago

🐛 Bug

Looks like a breaking change in a dependency. CI logs:

make: Entering directory '/home/runner/work/CompilerGym/CompilerGym/examples'
python3 -c 'import dgl; print(dgl.__version__)' &>/dev/null || true
pytest --no-success-flaky-report --benchmark-disable -n auto --durations=5 . --cov=compiler_gym --cov-report=xml:/home/runner/work/CompilerGym/CompilerGym/coverage.xml --ignore example_unrolling_service --ignore loop_optimizations_service
DGL backend not selected or invalid.  Assuming PyTorch for now.
Setting the default backend to "pytorch". You can change it in the ~/.dgl/config.json file or export the DGLBACKEND environment variable.  Valid options are: pytorch, mxnet, tensorflow (all lowercase)
Using backend: pytorch
0.6.1
============================= test session starts ==============================
platform linux -- Python 3.7.13, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/runner/work/CompilerGym/CompilerGym, configfile: tox.ini
plugins: hydra-core-1.1.0, xdist-2.4.0, timeout-1.4.2, sugar-0.9.4, stress-1.0.1, shard-0.1.2, mock-3.6.1, cov-2.12.1, benchmark-3.4.1, flaky-3.7.0, forked-1.4.0
timeout: 300.0s
timeout method: signal
timeout func_only: False
gw0 I / gw1 I
gw0 [56] / gw1 [56]

.............................ss.s.........F.............                 [100%]
=================================== FAILURES ===================================
_______________________________ test_local_train _______________________________
[gw0] linux -- Python 3.7.13 /opt/hostedtoolcache/Python/3.7.13/x64/bin/python3

Coverage.py warning: Data file '/home/runner/work/CompilerGym/CompilerGym/examples/.coverage.fv-az36-101.10042.492597' doesn't seem to be a coverage data file: Couldn't use data file '/home/runner/work/CompilerGym/CompilerGym/examples/.coverage.fv-az36-101.10042.492597': no such table: coverage_schema
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/popen-gw0/test_local_train0')

    def test_local_train(tmp_path: Path):
Coverage.py warning: Data file '/home/runner/work/CompilerGym/CompilerGym/examples/.coverage.fv-az36-101.10043.[8](https://github.com/facebookresearch/CompilerGym/runs/7752537858?check_suite_focus=true#step:8:9)77212' doesn't seem to be a coverage data file: cannot unpack non-iterable NoneType object
        model = Model(
            **OmegaConf.create(
                f"""\
    experiment: tiger
    working_directory: {tmp_path}/outputs
    executor:
        type: local
        cpus: 2
    environment:
        id: llvm-autophase-ic-v0
        max_episode_steps: 3
    agent:
        type: PPOTrainer
        args:
            lr: 1.e-3
    evaluation_metrics = self.evaluate()
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/agents/trainer.py", line 1004, in evaluate
    self._sync_weights_to_workers(worker_set=self.evaluation_workers)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/agents/trainer.py", line 1756, in _sync_weights_to_workers
    worker_set.foreach_worker(lambda w: w.restore(ray.get(weights)))
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/evaluation/worker_set.py", line 200, in foreach_worker
    local_result = [func(self.local_worker())]
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/agents/trainer.py", line 1756, in <lambda>
    worker_set.foreach_worker(lambda w: w.restore(ray.get(weights)))
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/evaluation/rollout_worker.py", line 1342, in restore
    self.policy_map[pid].set_state(state)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/policy/torch_policy.py", line 716, in set_state
    s, device=self.device)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/utils/torch_utils.py", line 157, in convert_to_torch_tensor
    return tree.map_structure(mapping, x)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/tree/__init__.py", line 430, in map_structure
    [func(*args) for args in zip(*map(flatten, structures))])
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/tree/__init__.py", line 430, in <listcomp>
    [func(*args) for args in zip(*map(flatten, structures))])
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/ray/rllib/utils/torch_utils.py", line 151, in mapping
    tensor = torch.from_numpy(np.asarray(item))
TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

---------- coverage: platform linux, python 3.7.13-final-0 -----------
Coverage XML written to file /home/runner/work/CompilerGym/CompilerGym/coverage.xml

============================= slowest 5 durations ==============================
5[9](https://github.com/facebookresearch/CompilerGym/runs/7752537858?check_suite_focus=true#step:8:10).98s call     examples/brute_force_test.py::test_run_brute_force_smoke_test
59.54s call     examples/actor_critic_test.py::test_run_actor_critic_smoke_test
46.17s call     examples/gcc_autotuning/tune_test.py::test_tune_smoke_test[docker:gcc:[11](https://github.com/facebookresearch/CompilerGym/runs/7752537858?check_suite_focus=true#step:8:12).2.0-random]
26.68s call     examples/gcc_autotuning/tune_test.py::test_tune_smoke_test[docker:gcc:11.2.0-hillclimb]
[21](https://github.com/facebookresearch/CompilerGym/runs/7752537858?check_suite_focus=true#step:8:22).78s call     examples/llvm_rl/tests/training_integration_test.py::test_local_train
=========================== short test summary info ============================
FAILED llvm_rl/tests/training_integration_test.py::test_local_train - multipr...