| 26 | namespace Express { |
| 27 | |
| 28 | void Executor::setGlobalExecutorConfig(MNNForwardType type, const BackendConfig& config, int numberThread) { |
| 29 | std::lock_guard<std::mutex> _l(mMutex); |
| 30 | |
| 31 | if(type == MNN_FORWARD_AUTO) { |
| 32 | ScheduleConfig sConfig; |
| 33 | sConfig.type = type; |
| 34 | type = Schedule::getAppropriateType(sConfig); |
| 35 | } |
| 36 | auto rt = _getOrCreateRuntime(type, &config, numberThread); |
| 37 | if (rt == nullptr) { |
| 38 | type = MNN_FORWARD_CPU; |
| 39 | numberThread = 1; |
| 40 | rt = _getOrCreateRuntime(type, &config, numberThread); |
| 41 | } |
| 42 | MNN_ASSERT(nullptr != rt); |
| 43 | mAttr->firstType = type; |
| 44 | // Cache threadnumber and config |
| 45 | mAttr->numThread = numberThread; |
| 46 | mAttr->config = config; |
| 47 | // Remove sharedContext because it's not used for create backend |
| 48 | mAttr->config.sharedContext = nullptr; |
| 49 | } |
| 50 | |
| 51 | int Executor::getCurrentRuntimeStatus(RuntimeStatus statusEnum) { |
| 52 | return mRuntimeInfo.first[mAttr->firstType]->onGetRuntimeStatus(statusEnum); |
no outgoing calls