MCPcopy Create free account
hub / github.com/alibaba/MNN / _run

Method _run

test/expr/ModuleTest.cpp:881–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

879class MultiThreadOneSessionTest : public MNNTestCase {
880public:
881 bool _run(int precision, bool lazy) {
882 flatbuffers::FlatBufferBuilder builderOutput(1024);
883 {
884 auto y = _mobileNetV1Expr();
885 std::unique_ptr<MNN::NetT> net(new NetT);
886 Variable::save({y}, net.get());
887 y = nullptr;
888 auto len = MNN::Net::Pack(builderOutput, net.get());
889 builderOutput.Finish(len);
890 }
891 int sizeOutput = builderOutput.GetSize();
892 auto bufferOutput = builderOutput.GetBufferPointer();
893 std::shared_ptr<Interpreter> net(Interpreter::createFromBuffer((void*)bufferOutput, sizeOutput), Interpreter::destroy);
894 ScheduleConfig config;
895 config.numThread = 4;
896 auto s1 = net->createSession(config);
897 std::vector<std::thread> allThreads;
898 for (int i = 0; i < 4; ++i) {
899 allThreads.emplace_back(std::thread([net, s1] {
900 net->runSession(s1);
901 }));
902 }
903 for (auto& t : allThreads) {
904 t.join();
905 }
906 return true;
907 }
908 virtual bool run(int precision) {
909 auto res = _run(precision, true);
910 return res;

Callers

nothing calls this directly

Calls 8

runSessionMethod · 0.80
joinMethod · 0.80
_mobileNetV1ExprFunction · 0.70
saveFunction · 0.50
getMethod · 0.45
FinishMethod · 0.45
GetSizeMethod · 0.45
createSessionMethod · 0.45

Tested by

no test coverage detected