| 165 | Spinlock AtlasCompNodeImpl::sd_mtx; |
| 166 | |
| 167 | void AtlasCompNodeImpl::init(const Locator& locator, const Locator& locator_logical) { |
| 168 | m_locator = locator; |
| 169 | m_locator_logical = locator_logical; |
| 170 | m_initialized = true; |
| 171 | |
| 172 | CompNodeEnv::AtlasEnv atlas_env; |
| 173 | atlas_env.device = locator.device; |
| 174 | m_env.init_atlas(make_comp_node_from_impl(this), atlas_env); |
| 175 | |
| 176 | DeviceInfo* dev_info = nullptr; |
| 177 | for (int i = 0; i < sd->nr_dev_used; ++i) { |
| 178 | if (sd->dev_info[i].dev_num == locator.device) { |
| 179 | dev_info = &sd->dev_info[i]; |
| 180 | break; |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | if (!dev_info) { |
| 185 | dev_info = &sd->dev_info[sd->nr_dev_used]; |
| 186 | dev_info->init(m_env); |
| 187 | // note: add nr_dev_used only after init succeeds |
| 188 | ++sd->nr_dev_used; |
| 189 | } |
| 190 | m_device_info = dev_info; |
| 191 | } |
| 192 | |
| 193 | void AtlasCompNodeImpl::fini() { |
| 194 | if (!m_initialized) |