Use deque instead of vector for code readers so that the iterators and references will be stable (#1851)
* Use deque instead of vector for code readers so that the iterators and references will be stable * Fix compile error * Assign the iterator * Add multithreaded test * Make threads a multiple of hardware concurrency * Output on failure * Add setDevice to try and initialize the context on cuda * Create context for cuda * Set context on each thread * Reduce threads on cuda * Skip test on cuda * Try to initialize the primary context on cuda * Push ctx to the stack as current * Revert "Push ctx to the stack as current" This reverts commit0fb72d9e7f. * Revert "Try to initialize the primary context on cuda" This reverts commit44e3908680. * updated test for nvidia path * Add c++11 option for nvcc Co-authored-by: satyanveshd <53337087+satyanveshd@users.noreply.github.com> [ROCm/hip commit:e7120dd876]
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <stdexcept>
|
||||
@@ -202,7 +203,7 @@ public:
|
||||
std::function<void(hsa_code_object_reader_t*)>>;
|
||||
std::pair<
|
||||
std::mutex,
|
||||
std::vector<std::pair<std::string, RAII_code_reader>>> code_readers;
|
||||
std::deque<std::pair<std::string, RAII_code_reader>>> code_readers;
|
||||
|
||||
program_state_impl() {
|
||||
// Create placeholder for each agent for the per-agent members.
|
||||
@@ -419,8 +420,8 @@ public:
|
||||
decltype(code_readers.second)::iterator it;
|
||||
{
|
||||
std::lock_guard<std::mutex> lck{code_readers.first};
|
||||
it = code_readers.second.emplace(code_readers.second.end(),
|
||||
move(file), move(tmp));
|
||||
code_readers.second.emplace_back(move(file), move(tmp));
|
||||
it = std::prev(code_readers.second.end());
|
||||
}
|
||||
|
||||
auto check_hsa_error = [](hsa_status_t s) {
|
||||
|
||||
Reference in New Issue
Block a user