| 32 | DeviceCodePool* DeviceCodePool::pool = nullptr; |
| 33 | |
| 34 | void DeviceCodePool::Set(std::unique_ptr<DeviceCode>&& code) { |
| 35 | Place place = code->GetPlace(); |
| 36 | std::string name = code->GetName(); |
| 37 | |
| 38 | auto iter = device_codes_.find(place); |
| 39 | if (iter == device_codes_.end()) { |
| 40 | PADDLE_THROW(common::errors::NotFound( |
| 41 | "Place %s is not supported for runtime compiling.", place)); |
| 42 | } |
| 43 | |
| 44 | auto& codes_map = iter->second; |
| 45 | codes_map.emplace(name, std::move(code)); |
| 46 | } |
| 47 | |
| 48 | DeviceCode* DeviceCodePool::Get(const Place& place, const std::string& name) { |
| 49 | auto iter = device_codes_.find(place); |