diff --git a/mindspore/lite/src/sub_graph_split.cc b/mindspore/lite/src/sub_graph_split.cc index 5c3a2067ad..96c6acab10 100644 --- a/mindspore/lite/src/sub_graph_split.cc +++ b/mindspore/lite/src/sub_graph_split.cc @@ -229,24 +229,22 @@ void SearchSubGraph::ConvertSubGraphToModel(std::vector *sub_graphs) { MS_LOG(ERROR) << "New sub graph failed!"; return; } - new_sub_graph->name_ = "subgraph-split-" + std::to_string(new_sub_index); + new_sub_graph->name_ = "SubSplit" + std::to_string(new_sub_index); Model::Node *new_partial_node = new (std::nothrow) Model::Node(); if (new_partial_node == nullptr) { MS_LOG(ERROR) << "New partial node failed!"; delete new_sub_graph; return; } - new_partial_node->name_ = "Partial-subgraph-split-" + std::to_string(new_sub_index); + new_partial_node->name_ = "SubSplitPartial" + std::to_string(new_sub_index); if (device_type == DT_CPU) { - new_partial_node->name_ = "cpu_" + new_partial_node->name_; + new_partial_node->name_ = "Cpu" + new_partial_node->name_; } else if (device_type == DT_GPU) { - new_partial_node->name_ = "gpu_" + new_partial_node->name_; - + new_partial_node->name_ = "Gpu" + new_partial_node->name_; } else if (device_type == DT_NPU) { - new_partial_node->name_ = "npu_" + new_partial_node->name_; - } else { - new_partial_node->name_ = "unknow_" + new_partial_node->name_; + new_partial_node->name_ = "Npu" + new_partial_node->name_; } + new_partial_node->node_type_ = mindspore::lite::NodeType_ValueNode; new_partial_node->primitive_ = CreatePartialPrimitive(new_sub_index); diff --git a/mindspore/lite/test/runtest.sh b/mindspore/lite/test/runtest.sh index c4b5cdf303..b501e71f1f 100755 --- a/mindspore/lite/test/runtest.sh +++ b/mindspore/lite/test/runtest.sh @@ -68,3 +68,6 @@ echo 'run train ut tests' ## ./lite-test --gtest_filter="NetworkTest.lenetnet" echo 'run inference ut tests' ./lite-test --gtest_filter="ControlFlowTest.TestMergeWhileModel" + +echo 'run mindrt parallel ut test' +./lite-test --gtest_filter="MindrtParallelTest.offline1" diff --git a/mindspore/lite/test/st/mindrt_parallel_test.cc b/mindspore/lite/test/st/mindrt_parallel_test.cc new file mode 100644 index 0000000000..2bba7bc99c --- /dev/null +++ b/mindspore/lite/test/st/mindrt_parallel_test.cc @@ -0,0 +1,168 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" +#include "common/common_test.h" +#include "include/errorcode.h" +#include "tools/converter/converter.h" +#include "tools/benchmark/benchmark.h" +#include "src/mindrt_executor.h" +#include "src/lite_session.h" +#include "src/lite_kernel.h" + +namespace mindspore { +class MindrtParallelTest : public mindspore::CommonTest { + public: + MindrtParallelTest() {} +}; + +int CheckOffline1(session::LiteSession *session) { + /* ----------- start check -------------- */ + lite::LiteSession *lite_session = reinterpret_cast(session); + auto kernels = lite_session->get_kernels(); + if (kernels.size() != 4) { + return -1; + } + + /* sub-graph-0 */ + kernel::SubGraphKernel *subgraph0 = reinterpret_cast(kernels[0]); + std::vector nodes0 = subgraph0->nodes(); + if (nodes0.size() != 1) { + return -2; + } + if (nodes0[0]->type() != schema::PrimitiveType_SplitWithOverlap) { + return -3; + } + + /* sub-graph-1 */ + kernel::SubGraphKernel *subgraph1 = reinterpret_cast(kernels[1]); + std::vector nodes1 = subgraph1->nodes(); + if (nodes1.size() != 3) { + return -4; + } + if (nodes1[0]->type() != schema::PrimitiveType_Conv2DFusion || + nodes1[1]->type() != schema::PrimitiveType_Conv2DFusion || + nodes1[2]->type() != schema::PrimitiveType_Conv2DFusion) { + return -5; + } + + /* sub-graph-2 */ + kernel::SubGraphKernel *subgraph2 = reinterpret_cast(kernels[2]); + std::vector nodes2 = subgraph2->nodes(); + if (nodes2.size() != 3) { + return -6; + } + if (nodes2[0]->type() != schema::PrimitiveType_Conv2DFusion || + nodes2[1]->type() != schema::PrimitiveType_Conv2DFusion || + nodes2[2]->type() != schema::PrimitiveType_Conv2DFusion) { + return -7; + } + + /* sub-graph-3 */ + kernel::SubGraphKernel *subgraph3 = reinterpret_cast(kernels[3]); + std::vector nodes3 = subgraph3->nodes(); + if (nodes3.size() != 8) { + return -8; + } + if (nodes3[0]->type() != schema::PrimitiveType_Concat) { + return -9; + } + + return lite::RET_OK; +} + +int CheckRuntime1(session::LiteSession *session) { + lite::LiteSession *lite_session = reinterpret_cast(session); + auto kernels = lite_session->get_kernels(); + if (kernels.size() != 6) { + return -1; + } + return lite::RET_OK; +} + +TEST_F(MindrtParallelTest, offline1) { + const char *converter_argv[] = {"./converter", "--fmk=TFLITE", + "--modelFile=./mindrtParallel/mindrt_parallel_model.tflite", + "--outputFile=./mindrtParallel/mindrt_parallel_model_split", + "--configFile=./mindrtParallel/mindrt_parallel_model.config"}; + int converter_ret = mindspore::lite::RunConverter(5, converter_argv); + ASSERT_EQ(converter_ret, lite::RET_OK); + + size_t size = 0; + char *graph_buf = lite::ReadFile("./mindrtParallel/mindrt_parallel_model_split.ms", &size); + ASSERT_NE(graph_buf, nullptr); + + auto model = std::shared_ptr(lite::Model::Import(graph_buf, size)); + delete[](graph_buf); + ASSERT_NE(model, nullptr); + + auto context = std::make_shared(); + ASSERT_NE(context, nullptr); + context->enable_parallel_ = true; + + session::LiteSession *session = session::LiteSession::CreateSession(context.get()); + ASSERT_NE(session, nullptr); + + int benchmark_ret = session->CompileGraph(model.get()); + ASSERT_EQ(benchmark_ret, lite::RET_OK); + + ASSERT_EQ(CheckOffline1(session), lite::RET_OK); + + auto inputs = session->GetInputs(); + for (auto in : inputs) { + in->MutableData(); + } + + benchmark_ret = session->RunGraph(nullptr, nullptr); + ASSERT_EQ(benchmark_ret, lite::RET_OK); +} + +TEST_F(MindrtParallelTest, runtime1) { + const char *converter_argv[] = {"./converter", "--fmk=TFLITE", + "--modelFile=./mindrtParallel/mindrt_parallel_model.tflite", + "--outputFile=./mindrtParallel/mindrt_parallel_model"}; + int converter_ret = mindspore::lite::RunConverter(4, converter_argv); + ASSERT_EQ(converter_ret, lite::RET_OK); + + size_t size = 0; + char *graph_buf = lite::ReadFile("./mindrtParallel/mindrt_parallel_model.ms", &size); + ASSERT_NE(graph_buf, nullptr); + + auto model = std::shared_ptr(lite::Model::Import(graph_buf, size)); + delete[](graph_buf); + ASSERT_NE(model, nullptr); + + auto context = std::make_shared(); + ASSERT_NE(context, nullptr); + context->enable_parallel_ = true; + + session::LiteSession *session = session::LiteSession::CreateSession(context.get()); + ASSERT_NE(session, nullptr); + + int benchmark_ret = session->CompileGraph(model.get()); + ASSERT_EQ(benchmark_ret, lite::RET_OK); + + ASSERT_EQ(CheckRuntime1(session), lite::RET_OK); + + auto inputs = session->GetInputs(); + for (auto in : inputs) { + in->MutableData(); + } + + benchmark_ret = session->RunGraph(nullptr, nullptr); + ASSERT_EQ(benchmark_ret, lite::RET_OK); +} +} // namespace mindspore diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.bin b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.bin new file mode 100644 index 0000000000..d539371e6f Binary files /dev/null and b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.bin differ diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.config b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.config new file mode 100644 index 0000000000..01ae5f606b --- /dev/null +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.config @@ -0,0 +1,3 @@ +device0=cpu +device1=cpu +computeRate=device0:1;device1:2; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.out b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.out new file mode 100644 index 0000000000..d6456a7ce2 --- /dev/null +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.out @@ -0,0 +1,6 @@ +Conv2D-7 4 1 64 4 2 +-0.015068125 0.007832255 -0.0044039674 0.0003823028 0.0012824135 0.010056816 0.0012911124 0.00081463554 -0.007271615 0.0038320206 -0.0064265197 0.010918597 0.000293314 0.003944434 -0.00094223197 0.005866048 -0.004631366 0.0007362594 -0.007968349 0.010382725 0.0013590851 0.010480153 0.003529531 0.00274462 -0.015345382 0.0083772 -0.0007408278 -0.0046276967 -0.0061783358 0.013887234 -0.0005216745 0.001568289 -0.009330675 0.0029689898 -0.006685828 0.010102106 -0.0011913023 -0.00091386505 0.0038847013 0.004200619 -0.008918023 -0.0038889144 -0.005798164 0.001315085 -0.00020753138 0.012104742 0.0026786025 0.0047974885 -0.017258931 0.013266194 0.0004558792 0.004831996 0.0030212407 0.0061235586 -0.0020769287 0.00455775 -0.008191255 0.0009847211 -0.0036726156 0.0074095326 -0.0021016106 0.0065243766 -0.0018674788 0.0035339305 -0.0136992615 0.010360273 0.00211124 -0.0020931384 -0.0060381265 0.012534783 0.0017875304 -0.0009836992 -0.0037165568 0.0034431117 -0.0074306917 0.01160016 -0.004255348 0.0040398138 0.0043917107 0.004684182 -0.016746959 0.007029797 -0.002373303 -0.0026899346 -0.006406405 0.016729895 0.005059337 -0.00036892365 -0.0078113177 0.0051236413 -0.009176777 0.0150229065 0.0028885854 -0.0001451872 0.002974325 0.01036231 -0.0091411965 -0.004508543 -0.006507757 0.008138876 0.00047107518 0.01557478 0.0012477164 0.0028035836 -0.015422041 0.018453712 -0.002363746 -0.0028960337 0.0010835063 0.002930591 -0.0045151026 0.005754575 -0.008583922 -0.004619874 -0.0016344233 0.007993748 -0.0036298856 0.010311482 0.001277315 -0.00044146663 -0.0072341026 0.010722168 -0.00055781915 -0.0025623483 -0.007121382 0.0075030215 0.0041670497 0.0010934842 -0.012515113 0.0019483576 -0.0043771686 0.003053952 -0.004983742 0.00914954 0.005122368 0.0025027567 -0.008606274 0.004509875 -0.0045603975 0.009781525 0.0004540165 0.0050543137 0.0037033088 0.0055116937 -0.0011782676 0.0015584031 -0.009833343 0.013095103 0.006065308 0.005499998 -0.0006659338 0.0086715575 -0.018497147 0.0083532045 -0.00048590824 -0.0050365347 -0.003413952 0.0128969215 -0.004016283 -0.0025090184 -0.0032868981 0.0015650839 -0.0065453122 0.005056202 -0.0020153848 -0.0053678825 0.0013272834 0.0046031484 -0.0036744496 -0.005867627 -0.002459542 0.003551015 -0.0009493923 0.016047105 0.0064504333 0.00043944758 -0.008971724 0.017849144 0.0016529111 0.0028103213 -0.0021453407 0.0057269237 -0.0012495687 0.004304362 -0.01383033 0.0015183211 -0.006585938 0.0019699435 -0.003978272 0.0038243588 0.0012100661 0.0005861336 -0.007851342 -0.009082061 -0.009763712 0.00045533892 -0.002723752 0.001712341 0.003824643 0.0029301185 -0.012204118 0.008754537 -4.6645e-05 -0.0012742307 0.0012433765 0.010318929 0.0017476009 0.0034534656 -0.008967221 0.010002065 -0.0053191828 0.016646625 0.0033417728 0.0056955554 0.00082124746 0.00594737 -0.015396395 0.0005065901 -0.005896485 0.0031465827 -0.0017664693 0.013897901 0.0014615289 0.0030683842 -0.0105462205 0.008304069 0.002605807 0.007434778 0.000106542255 0.010097236 -0.0011437668 0.0065325256 -0.0063393754 -0.0022933013 -0.005638883 0.010694133 -0.005774853 0.003916679 0.0007912726 0.00010735565 -0.009668366 0.007402513 -0.008897133 -0.006797704 -0.0007346852 0.0014133408 -0.0007217643 0.0048685605 -0.0028623072 -0.0014660163 -0.008827067 0.02121846 0.009951162 0.0052249995 0.001416554 0.0053444416 -0.017000852 0.0025791572 -0.006459741 -0.005211496 -0.0026175072 0.011648356 -0.0007678347 0.0002546499 -0.012101684 0.0072603193 0.0022841091 0.00047457224 -0.0008569909 0.008217542 -0.00031553966 0.005875734 -0.0018809121 0.0035829237 0.0027913793 0.014983199 -0.005418508 0.012069962 0.0042391852 -0.00049310713 -0.009769431 0.010541144 -0.009085814 -0.007354986 -0.010943301 0.0038220831 0.0020077694 0.0015451944 -0.01610779 0.0045316885 -0.0076035336 0.0022819245 0.0032099439 0.0055541983 0.0045299884 0.0046310364 -0.010119354 -0.0052339057 -0.0031767595 0.010977891 0.00039158232 0.011175897 0.003723564 0.0038844845 -0.010482446 0.013508101 0.002659162 -0.0017018993 -0.0068114707 0.012509545 -0.0003009159 0.0033451754 -0.010678422 0.012304497 -0.0057101264 0.011214931 -0.0010196608 0.0044628736 0.0022298382 0.004387824 -0.010697326 -0.0020204638 -0.00546944 0.004652912 -0.0031480729 0.012648155 0.002357548 0.0027047687 -0.014943821 0.005523731 -0.004231037 0.00066836167 -0.005265082 0.005535424 0.0019164768 0.0018733247 -0.007126338 0.0014750442 -0.0094035305 0.0060916473 0.00067023176 0.0031641629 0.002733579 0.006404542 -0.01719607 0.0042729424 -0.0059299404 0.005451073 0.0031017659 0.012248866 0.0018445764 0.0032748785 -0.0059750965 0.0027748044 -0.0072420905 0.013648558 0.0024218303 0.0054284763 -0.0012167883 0.008011141 -0.01141705 0.005528132 -0.006611216 0.004073711 -0.000850213 0.013006246 0.00045918487 0.0017200108 -0.01100101 0.005603291 -0.0048519787 0.0025271727 -0.0038887006 0.007626486 0.0003589627 0.003344603 -0.003867632 0.005198769 -0.0039457316 0.010114929 -0.0014824258 0.009614944 0.0043361126 0.003522349 -0.020700982 0.0057503404 -0.0062781656 -0.0031129546 -0.003827538 0.010551881 0.0034121403 0.0021903615 -0.011937838 -0.0030773082 -0.0015705591 0.005473437 -0.00065776595 0.005104518 0.0009554932 0.0067274636 -0.005098556 0.01069372 0.00018586009 0.008881171 0.0023036262 0.008027783 4.070194e-05 0.004390548 -0.014102112 0.011405502 -0.00020507234 -0.0010410647 -0.0067647668 0.011241681 -0.0024621102 -0.0005745734 -0.006266595 0.0046308376 -0.007486457 0.008765815 -0.001543208 0.000209813 0.0038457438 0.0039606416 -0.014918628 -0.0066094357 -0.004214015 -0.0014586966 -0.005387822 0.016196618 0.0056441296 0.00025958545 -0.014225502 0.013745101 2.4951296e-05 0.004201424 -2.4204608e-05 0.002756384 0.0006770375 0.007287246 -0.012077684 -0.001547371 -0.0068076225 0.012162683 0.0027109876 0.007529771 0.0010090615 0.0050316476 -0.008143408 0.00704553 -0.0023287944 0.006682483 0.0021697287 0.008984829 -0.00304386 0.005557541 -0.008512946 0.008923578 -0.0020390463 0.008746638 -0.0011177729 0.008394628 -0.0019554314 0.0015858901 -0.010150731 0.0028737953 -0.00714901 0.0025695658 -0.0035074549 0.0061448477 0.0015030114 0.002124727 -0.0108911935 -0.008205041 -0.006599545 0.0036034961 -0.0040435046 0.0071595907 0.0039800024 0.0017620777 -0.007811901 0.006132809 -0.0056736753 0.005506072 0.0042672325 0.0025939047 0.0017699683 0.0075122803 -0.0070696073 0.009102039 0.00058380055 0.014246927 0.006616423 0.014475218 -0.002421705 0.0056232326 -0.00084767095 0.005835561 -0.0018438995 0.01565115 0.00029574498 0.004767145 -0.0030958229 0.0031065012 -0.0022865334 -0.0037875024 -0.0055066072 -0.0032384207 -0.0052571017 0.005218492 -0.0012278517 0.00037682382 +Conv2D-8 4 1 64 4 1 +0.019412944 -0.016437719 0.0019049789 -0.004867401 0.009935631 -0.0056365575 -0.013489464 -0.0017471233 0.00802851 0.0077461796 -0.014565032 -0.002390655 0.010325557 -0.012731308 -0.0012571034 -0.007898856 0.0012251174 0.014139143 -0.01908357 -0.0012256552 -0.00030721514 -0.0019508025 -0.0073084524 -0.0004981335 0.017905887 -0.013980569 0.00073213084 -0.006662671 0.0015410446 -0.0054359557 -0.008987144 -0.003426209 0.0075298455 -0.005584044 -0.0062330673 -0.0047040726 -0.003152371 0.009477629 -0.01904438 -0.0007456152 0.012000332 -0.00539872 -0.004146827 -0.0063206484 0.0048299646 0.008286899 -0.021919388 0.00016943226 0.0050707986 -0.0026540686 -0.0018814541 -0.006439096 0.024981327 -0.021119405 -0.0030755633 -0.0070833242 -0.0040722676 0.0040868134 -0.007394298 -0.003164592 0.0007903314 0.008020492 -0.0146045 -0.0028915773 0.00025771046 0.0009848067 -0.008873124 -0.0023093296 0.0055908132 0.006061331 -0.01212631 -0.0022616296 0.010244786 -0.0042860336 -0.009664979 -0.0018108953 0.022067871 -0.022187943 0.010448337 -0.012459419 -0.0011793375 0.011450325 -0.022541257 0.001867278 -0.0060879486 0.01002696 -0.0069730314 0.0007437244 0.013832715 -0.01015512 -0.00092169223 -0.0073031792 0.0061976844 -0.00058220606 -0.009138012 -0.0039410694 -0.007955902 0.009697261 -0.011874017 -0.0004336486 0.013189281 -0.011725903 0.00020493474 -0.0026823655 0.016637402 -0.0019979628 -0.013326619 -0.0029683593 0.010488455 -0.004015971 -0.011960531 -0.004563789 -0.0005220884 -0.0012604767 -0.009400398 -0.0026900866 -0.004947488 0.008048583 -0.00872665 -0.0070302286 0.018025685 -0.019305643 -0.0072935293 -0.000153094 0.014469281 0.0014547657 -0.007772816 0.00066848344 0.018394236 -0.009431636 -0.0045716017 -0.009058546 -0.00018823775 -0.0042402423 -0.010418873 -0.0002692386 -0.010163259 0.01866854 -0.0107424855 -0.004988021 0.009856975 -0.009495074 -0.009581678 -0.0063355584 0.01656799 -0.0066262353 -0.007484378 0.0008719787 -0.0049882103 0.013193106 -0.009623289 -0.0044174045 0.0038436481 -0.008734637 -0.0048067397 -0.0071580065 0.013364324 -0.0029622025 -0.014068977 -0.0023847085 0.002614004 -0.00034564122 -0.009566505 -0.00375755 0.002985172 0.0017906075 -0.007929616 -0.006580088 0.0062552225 0.000387321 -0.014718143 0.00037375046 0.018871892 -0.008039001 -0.004130213 -0.0049021267 0.0078740325 -0.0003893883 -0.014890278 -0.00342024 0.015150085 -0.00621155 -0.0071325446 -0.0066026356 0.009552327 -0.0054523586 -0.00992001 -0.0051858593 0.0032945331 0.009908751 -0.015846275 -0.0012579886 0.011509379 -0.0023977705 -0.008895831 -0.006052141 -0.0072169513 0.002142014 -0.008593356 -0.0019040712 0.006910823 -0.0022975516 -0.0049618944 -0.0037096841 0.01644169 -0.020641075 0.0016778503 -0.008575162 0.0039063776 0.010595446 -0.022388529 0.0014192534 -0.0053348467 0.0044758506 -0.006233004 -0.003271209 0.007983174 -0.0037866747 -0.009007247 -0.0034569176 0.006642482 -0.0027432204 -0.009782381 -0.002151566 0.012775569 -0.013326181 -0.004190986 -0.004538411 0.01391219 -0.008717202 -0.0061109895 -0.005407307 0.0058204103 0.0017436056 -0.015629916 -0.0017429119 -0.0071062464 0.0075458284 -0.009777642 -0.0022898857 0.011539577 -0.0047712666 -0.010217565 -0.00048740808 0.019536251 -0.015681535 -0.00012991531 -0.003441517 0.009363062 0.003156518 -0.012629008 -0.0061042635 -0.0042508785 -0.001731548 -0.006608584 -0.0022966368 +Conv2D-9 4 1 64 4 2 +-0.012825339 -0.012769699 -0.0042850287 0.00028570974 -0.0023836717 -0.005860286 -0.0053601894 0.002491715 0.003013958 0.0026885127 -0.016204292 -0.0014833778 -0.0017166552 -0.00046548247 0.0010739004 0.0034305053 -0.0014406433 0.0011276158 -0.0059323353 -0.006750199 -0.014625479 0.0012849662 0.0016628611 1.7696293e-05 -0.0057808915 -0.0033720855 0.0029978405 0.011154872 -0.005453406 -0.0040233918 0.0009016322 0.0042832503 0.0041197357 0.0037873415 -0.007451896 -0.011577757 -0.008281661 0.0064569786 0.0020929968 0.00051881047 -0.009849758 -0.00093095517 0.003932803 -0.0002249321 -0.0085918065 0.003050296 -0.0036017362 -0.00567853 -0.008451756 -0.011988793 -0.008426271 0.0033779622 -0.0027437112 -0.0030657444 -0.0069737746 0.004176016 -0.0016112437 0.0032516946 -0.0039739814 0.0003181172 -0.0047746524 -0.00048788742 0.0017137696 0.004270296 -0.012481075 -0.0052879765 -0.0009914944 -0.0021062146 -0.010480927 -0.0027535176 0.0033715118 0.004489973 -0.00309343 0.0068780854 -0.009145061 -0.013038824 -0.0076919934 0.006130405 0.0030355277 -0.00048103044 -0.011560702 -0.0059704618 -0.0013950302 0.0015212721 -0.011501706 -0.0027760267 -0.00031304127 0.00076521595 0.0024856261 0.0033951278 -0.013201371 -0.009092575 -0.0051557464 0.009205614 -0.0023979482 -0.0030591374 -0.005775686 4.6538888e-05 0.0013351634 0.001790422 -0.010337617 -0.0014522661 -0.0050424016 -0.00075107935 -0.004532007 -0.012616672 -0.007195835 0.011976582 0.0036342968 -0.0007896095 -0.0022443025 0.006761955 0.0038785604 0.007163447 -0.0011127582 -0.0027651393 -0.012507638 -0.006815403 0.004761834 0.0045423266 -0.011675779 -0.0019574543 0.0016232026 -0.0084315585 -0.011892753 0.005825613 0.005132526 0.001035969 -0.006203169 0.001460461 -0.0023963575 -0.004908446 -0.006467471 0.0016157507 -0.00053429 -0.0020797113 -0.0050568995 -0.00088197447 -0.011095805 -0.009079225 -0.007167647 0.0049834154 -0.003801092 -0.0021062847 -0.001957132 -0.0004874398 -0.008993557 -0.00016626855 -0.0019058844 0.0049641402 -0.0058429916 -0.0028365322 -0.00079556624 -0.008994296 0.0005340534 0.017544504 -0.0011904794 -0.011978419 -0.0010198033 0.010826351 0.008422695 0.0066664354 -0.00758624 -0.008559101 -0.0040201177 0.006079636 0.0075988392 0.0024878064 -0.011020105 0.0015536379 0.0041849264 -0.009086931 -0.018221144 -0.0010294534 -0.00029402925 -0.0059582293 -0.008999791 -0.007868823 -0.0070116473 0.0042879097 -0.0012632979 0.0005463029 -0.0036799207 0.0037511874 0.0067832805 0.0022145472 0.0012652895 0.0030284463 -0.0030764774 0.00096663996 0.0030840281 0.0031240596 -0.0016330844 0.0031037843 0.005649108 -0.008932965 -0.0051699597 0.005692064 5.190214e-05 -0.0026364378 -0.018446654 -0.01392375 -0.008472087 -0.0041622003 -0.005200765 -0.0041843667 -0.006450693 -0.0004712847 -0.00077383185 -0.0023565902 -0.021788197 -0.0065274406 -0.007467209 -0.00107462 -0.0018747775 0.003072669 -0.0005562221 0.00093490956 4.8548332e-05 0.0065436373 -0.012018664 0.00015633414 0.002076238 0.0013704998 -0.0065398887 0.0010959636 -0.0011136709 -0.00024068449 -0.009568152 0.001754475 -0.0016189711 7.78212e-05 -0.0021112622 0.0073014647 -0.00092463533 -0.009766007 -0.0033664438 0.0069509684 0.00021334155 0.003813249 -0.009327748 -0.009191334 -0.008518627 0.0034313472 0.010057392 0.004968988 -0.0021675115 -0.00088594144 0.005715076 -0.0018215555 -0.022566218 -0.008557084 -0.008311998 -0.006716859 -0.005396132 -0.00047409348 0.00031891325 -0.00612601 0.004670333 0.012659264 -0.008837514 -0.0032527088 0.002301664 0.0065944544 -0.0054341494 -0.00076234806 -0.00018510735 0.000895686 -0.009133194 -0.0024430444 0.0020391785 0.001116746 -0.00852461 0.0072269537 -0.0034608785 -0.017222295 -0.019006466 0.0017335084 0.0024941387 0.0020640409 -0.009055205 -0.0022138972 0.0014624 0.0034313807 0.005168006 0.009184675 0.0029499084 0.0021359643 0.0007454725 -0.007978898 -0.01031692 0.00097498484 -0.00545422 -0.0048279725 -0.0030491136 -0.0026202872 -0.0014479317 0.0034272256 0.00042371638 -0.006999977 -0.019368205 -0.001745126 -0.001867088 -4.3880544e-05 -0.01916001 -0.004845215 0.0014822562 0.00044128532 -0.0069295 0.002221872 -0.0007355872 0.0032388938 -0.002386044 -0.0011473442 -0.015085562 -0.0050636753 -0.004232438 0.0027869106 0.000413188 0.0019107922 -0.00043307582 0.0032004067 0.002242201 0.0030581718 -0.010331621 0.00021291513 0.0011206418 -0.00019222387 -0.005217578 -0.0018424029 0.0020635687 -0.004364012 -0.005042134 0.0028634907 -0.00027729874 0.0031690414 -0.0051383222 -0.0017966654 -0.009905927 -0.008455626 -0.0023404467 0.0055457707 -0.0021874048 -0.0028194077 -0.005627408 -0.008764183 -0.010349795 -0.000435343 -0.0083040735 -0.0047854814 -0.005172601 0.0011454555 0.0005526745 0.0022251108 -0.0129605485 -0.0036218637 -0.00560483 0.0025878074 -0.0015571658 0.002229435 -0.0049156435 -0.0036854001 -0.004374209 0.0015094681 -0.0089315185 -0.002147027 0.00036781165 0.003999963 -0.00037162434 0.00035144086 -0.0069316598 0.0025181703 -0.0049495324 -0.0016508219 0.002708021 0.004745453 -0.0032578774 0.0021110994 -0.0068354663 -0.008707454 -0.01499724 0.0014122108 0.0025471998 -0.0006699043 -0.0019103986 -0.0038611295 0.0054952055 0.0061259386 -0.00894717 0.0023462072 0.00029116054 0.0003165966 -0.0038705792 0.0025685076 0.0014434932 -0.0031093047 -0.0060281726 0.0027384963 -0.0035820624 -0.0018464143 -0.0154139595 -0.006560616 -0.008231699 -0.008674523 -0.0076892762 0.0018182843 -0.004721409 0.00069110503 -0.005600906 -0.004256473 -0.006935999 0.010900192 0.000229405 -0.0062856334 0.0015350145 0.0084211975 0.00500701 0.003987804 -0.0082597695 -0.00883909 -0.00904399 0.0052871592 0.0058501316 0.0005515551 -0.007935515 0.0016159303 0.011690573 -0.0013800787 -0.015070453 -0.00032053824 -9.672996e-05 -0.003360331 -0.012097736 -0.008037621 -0.007961806 -0.0056473687 -0.0026239466 0.005332038 -0.0055568907 -8.413894e-05 -0.0032921291 0.00040472765 -0.009564053 -0.005089677 -0.005070148 0.0021496518 -0.004270303 -0.00090868375 -0.008741738 -0.004685606 -0.010277107 0.0026290417 -0.0024532974 -0.0007809935 -0.0039088875 0.002788179 -0.0015202742 -0.001190465 -0.011487308 0.0017429029 -0.005063771 -0.0036873803 0.0014227635 0.006606068 0.0028502778 0.0033142653 -0.00131359 0.00034019724 -0.0071798726 0.0035311235 0.0051737125 0.0016937612 -0.0033385847 0.004362992 0.0041278596 -0.007644494 -0.007904844 0.0033367819 -0.00060787797 -0.00166816 -0.012953386 -0.008113662 -0.013147835 -0.009076089 -0.0008948217 0.005563195 -0.006463663 -0.0027873344 -0.005857269 -0.004421112 -0.021715421 0.00416883 -0.0066340873 -0.008601362 -0.005957719 0.0019495133 0.009146253 0.008106139 -0.01062642 0.0033631902 -0.007166342 0.0028359403 0.003957462 0.0068646315 0.003693489 0.009252236 0.011546454 0.008368683 2.8598122e-05 0.0050467695 0.0053042234 0.00055743183 diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.tflite b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.tflite new file mode 100644 index 0000000000..5be1009962 Binary files /dev/null and b/mindspore/lite/test/ut/src/runtime/kernel/arm/test_data/mindrtParallel/mindrt_parallel_model.tflite differ diff --git a/mindspore/lite/tools/converter/converter_flags.cc b/mindspore/lite/tools/converter/converter_flags.cc index 076af53124..fce0584d8c 100644 --- a/mindspore/lite/tools/converter/converter_flags.cc +++ b/mindspore/lite/tools/converter/converter_flags.cc @@ -219,11 +219,8 @@ int Flags::InitConfigFile() { return RET_INPUT_PARAM_INVALID; } } - if (parallel_split_config_.parallel_split_type_ != SplitNo && - !CheckOfflineParallelConfig(this->configFile, ¶llel_split_config_)) { - std::cerr << "offline kernel parallel split config set error." << std::endl; - return RET_INPUT_PARAM_INVALID; - } + + (void)CheckOfflineParallelConfig(this->configFile, ¶llel_split_config_); return RET_OK; } @@ -319,17 +316,14 @@ bool CheckOfflineParallelConfig(const std::string &file, ParallelSplitConfig *pa std::vector config_devices = {"cpu", "gpu", "npu"}; auto compute_rate_result = GetStrFromConfigFile(file, kComputeRate); if (compute_rate_result.empty()) { - std::cerr << "config setting error: compute rate should be set." << std::endl; return false; } std::string device0_result = GetStrFromConfigFile(file, kSplitDevice0); if (device0_result.empty()) { - std::cerr << "config setting error: device0 should be set." << std::endl; return false; } std::string device1_result = GetStrFromConfigFile(file, kSplitDevice1); if (device1_result.empty()) { - std::cerr << "config setting error: device1 should be set." << std::endl; return false; } bool device0_flag = false;