uber-research / ape-x

This repo replicates the results Horgan et al obtained in "Distributed Prioritized Experience Replay"
Apache License 2.0
190 stars 22 forks source link

Crash in TIA::computePlayerPositionResetWhenTable(): #2

Closed laket closed 5 years ago

laket commented 5 years ago

When I run tf_env.py, I got the following error.

/ape-x/gym_tensorflow/atari-py/atari_py/ale_interface/src/emucore/TIA.cxx:1147: void TIA::computePlayerPositionResetWhenTable(): Assertion `(s1 % 4 == 0) && (s2 % 8 == 0)' failed.

This is the same problem which was discussed in https://github.com/mgbellemare/Arcade-Learning-Environment/issues/86.

So I made tf_atari.cpp not load_rom concurrently by the following code, then I resolved the above issue.

const int num_threads = std::min(thread_pool->num_threads, batch_size);

std::mutex atari_mutex;

auto f = [&](int thread_id) {
    for(int b =thread_id; b < batch_size;b+=num_threads)
    {
        atari_mutex.lock();
        env->load_rom(m_game, b);
        atari_mutex.unlock();
    }
};

Is this problem a common problem? Othewise is there any problem in my environment?

tf_atari.zip

fps7806 commented 5 years ago

That error occurs if you use OpenAI's version of atari-py. It has a problem on the constructor that makes it non thread-safe. We fixed that issue in this branch.. The readme includes instructions on how to compile it.

laket commented 5 years ago

Thank you! My problem has been fixed!