From 989b64ecdddc27497c4e95426836fa0f22ab8f77 Mon Sep 17 00:00:00 2001 From: Dongju Chae Date: Fri, 15 Jan 2021 12:56:15 +0900 Subject: [PATCH] [Doc/Fix] Update some documents to apply changed testdata path This patch updates some documents to apply changed testdata path. Signed-off-by: Dongju Chae --- README.md | 22 ++++++++++-------- doc/how_to_test.md | 44 +++++++++++++---------------------- doc/usage_examples.md | 2 +- include/common/typedef.h | 2 +- tests/apptests/tvn_triv2_dmabuf.cc | 7 +++--- tests/apptests/tvn_triv2_xml.cc | 4 ++-- tests/unittests/ne_libnpuhost_test.cc | 12 +++++----- utils/coverage/gcovr_coverage.sh | 12 +++++----- 8 files changed, 47 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index f656b90..44c0c05 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## NPU SystemService (compatible with both TRIV1 and TRIV2) +## NPU SystemService (NPU Engine) [![Version](https://github.sec.samsung.net/nnsuite/n2s2/blob/master/AIP_NPU_SystemService/badges/version.svg)](/CHANGES) [![Code Coverage](https://github.sec.samsung.net/nnsuite/n2s2/blob/master/AIP_NPU_SystemService/badges/codecoverage.svg)](http://nnsuiteci.mooo.com/NPU_SystemService/ci/gcov_html/index.html) @@ -42,10 +42,10 @@ $ sudo apt install docker.io $ sudo docker pull art.sec.samsung.net/aip_docker/n2s2_docker/xenial $ sudo docker run -i -t art.sec.samsung.net/aip_docker/n2s2_docker/xenial /bin/bash -root# ls /opt/trinity/share/npu-engine/testdata/npubinfmt_v3/MOBILENET_V1 +root# ls /opt/trinity/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1 input_fmap_0.bin model.tvn output_fmap_0.bin -root# apptest_tvn_triv2 /opt/trinity/share/npu-engine/testdata/npubinfmt_v3/MOBILENET_V1 +root# apptest_tvn_triv2 /opt/trinity/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1 >>> Initializaing SPM with zero. It can be time-consuming... >>> Initializaing SPM with zero. It can be time-consuming... [Core Name: NPCore0], [File Name: /opt/trinity/share/mRPsim/decoder-triv2-emul.bin], [Ver: 1] @@ -64,15 +64,17 @@ root# exit - [AIP/meta-trinity](https://github.sec.samsung.net/AIP/meta-trinity): Bitbake recipes for an FPGA board (ZCU102-ZYNQMP) - [AIP/n2s2_docker](https://github.sec.samsung.net/AIP/n2s2_docker): Docker images for npu-engine users -## SPIN Repository (to download official packages) -- How to create your SPIN account: press [here](https://code.sec.samsung.net/confluence/display/NEWCOMM/SPIN+Request+Process) -- Tizen: http://10.113.136.32/download_trbs/snapshots/devel/tizen-6.0-ai/latest/repos/Tizen_Unified_standard -- Ubuntu (16.04): http://10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools/Ubuntu_16.04 +## Official Repository (to download npu-engine packages) +- SPIN OBS + - How to create your SPIN account: press [here](https://code.sec.samsung.net/confluence/display/NEWCOMM/SPIN+Request+Process) + - Tizen: http://10.113.136.32/download_trbs/snapshots/devel/tizen-6.0-ai/latest/repos/Tizen_Unified_standard + - Ubuntu (16.04/18.04): http://10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools +- Artifactory + - Ubuntu (16.04/18.04): https://art.sec.samsung.net/artifactory/list/aip_debian ## Additional Notes -- We don't officially support Ubuntu 18.04 as the FastModel Simulator does not fully support it. -- While TRIV1 is compatible with one of two binary formats (npubinfmt v1 and v2), TRIV2 requires npubinfmt v3 only. -- To use the NPU Engine library, it's mandatory to access the SPIN repository (`10.113.136.32`). Please read the related document carefully. +- The FastModel simulator requires Ubuntu 16.04 as it does not fully support Ubuntu 18.04. +- TRIV2 Models (.tvn) should be compatibile with npubinfmt v3. Please refer to [npubinfmt.h](/include/common/npubinfmt.h) ## Reference Links - Software Stack: http://suprem.sec.samsung.net/confluence/display/ODLC/NPU+OS+Stack diff --git a/doc/how_to_test.md b/doc/how_to_test.md index 3f106ee..a707105 100644 --- a/doc/how_to_test.md +++ b/doc/how_to_test.md @@ -84,10 +84,12 @@ libnpu-engine.so sh-3.2# ls /usr/lib64/npu-engine/bin apptests unittests -sh-3.2# ls /usr/share/npu-engine/testdata/npubinfmt_v3 -ADD_I8_000 CONVE_I8_006 CONV_I8_007 DCONV_I8_008 RELUN_I8_000 -ADD_I8_001 CONVE_I8_007 CONV_I8_008 DCONV_I8_009 RELUN_I8_001 -ADD_I8_002 CONVE_I8_008 CONV_I8_009 DCONV_I8_010 RELUN_I8_002 +sh-3.2# ls /usr/share/npu-engine/testdata/TRIV223_2TOPS +ADD_000 CONV_2D_300_D2 INCEPTION_V3 MOBILENET_V1 +ADD_001 CONV_2D_300_D3 MAX_POOL_2D_000 MOBILENET_V2 +ADD_600 CONV_2D_301 MAX_POOL_2D_001 NET_CONV_DCONV_600 +ADD_6WC CONV_2D_302 MAX_POOL_2D_002 NET_RESHAPE_000 +AVERAGE_POOL_2D_000 CONV_2D_600 MAX_POOL_2D_301 NET_RESHAPE_001 ... ``` @@ -114,30 +116,21 @@ sh-3.2# ./unittest_ne_core_npu [ OK ] ne_core_npu_test.get_num_devices (59 ms) [ RUN ] ne_core_npu_test.get_num_devices_n [ OK ] ne_core_npu_test.get_num_devices_n (0 ms) -[ RUN ] ne_core_npu_test.check_dev_status_triv [ OK ] ne_core_npu_test.check_dev_status_triv (36 ms) [ RUN ] ne_core_npu_test.check_dev_status_triv2 [ OK ] ne_core_npu_test.check_dev_status_triv2 (138 ms) -[ RUN ] ne_core_npu_test.check_dev_status_triv_n -[ OK ] ne_core_npu_test.check_dev_status_triv_n (22 ms) [ RUN ] ne_core_npu_test.check_dev_status_triv2_n [ OK ] ne_core_npu_test.check_dev_status_triv2_n (22 ms) [ RUN ] ne_core_npu_test.create_instance_uninitialized_n [ OK ] ne_core_npu_test.create_instance_uninitialized_n (14 ms) -[ RUN ] ne_core_npu_test.manage_mem_triv -[ OK ] ne_core_npu_test.manage_mem_triv (25 ms) [ RUN ] ne_core_npu_test.manage_mem_triv2 [ OK ] ne_core_npu_test.manage_mem_triv2 (24 ms) -[ RUN ] ne_core_npu_test.manage_mem_triv_n -[ OK ] ne_core_npu_test.manage_mem_triv_n (22 ms) [ RUN ] ne_core_npu_test.manage_mem_triv2_n [ OK ] ne_core_npu_test.manage_mem_triv2_n (22 ms) [ RUN ] ne_core_npu_test.set_model_data_n [ OK ] ne_core_npu_test.set_model_data_n (44 ms) [ RUN ] ne_core_npu_test.set_input_data_n [ OK ] ne_core_npu_test.set_input_data_n (44 ms) -[ RUN ] ne_core_npu_test.run_inference_triv -[ OK ] ne_core_npu_test.run_inference_triv (22 ms) [ RUN ] ne_core_npu_test.run_inference_triv2 [ OK ] ne_core_npu_test.run_inference_triv2 (23 ms) [ RUN ] ne_core_npu_test.run_inference_async0_triv2 @@ -160,23 +153,18 @@ sh-3.2# ./unittest_ne_core_buffer ``` sh-3.2# cd /usr/lib64/npu-engine/bin/apptests -sh-3.2# ./apptest_tvn_triv2 /usr/share/npu-engine/testdata/npubinfmt_v3/CONVE_I8_007 +sh-3.2# ./apptest_tvn_triv2 /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1 [APPTEST] ./apptest_tvn_triv2: PASSED -sh-3.2#$ ./apptest_tvn_triv2_bulk /usr/share/npu-engine/testdata/npubinfmt_v3 -[APPTEST] CONV_I8_002 Running... PASSED -[APPTEST] TCONV_I8_000 Running... PASSED -[APPTEST] DCONV_I8_002 Running... PASSED -[APPTEST] DCONV_I8_005 Running... PASSED -[APPTEST] RESCALE_I8_002 Running... PASSED +sh-3.2#$ ./apptest_tvn_triv2_bulk /usr/share/npu-engine/testdata/TRIV223_2TOPS +[APPTEST] ADD_000 Running... PASSED +[APPTEST] ADD_001 Running... PASSED ... -[APPTEST] CONV_I8_013 Running... PASSED -[APPTEST] MAX_POOL_I8_003 Running... PASSED -[APPTEST] RELUN_I8_000 Running... PASSED -[APPTEST] CONVE_I8_006 Running... PASSED -[APPTEST] ./apptest_tvn_triv2_bulk: PASSED (74/74) +[APPTEST] PRELU_000 Running... PASSED +[APPTEST] RESNET_V1_50 Running... PASSED +[APPTEST] ./apptest_tvn_triv2_bulk: PASSED (41/41) -sh-3.2# ./apptest_tvn_triv2_recurring -l 5 /usr/share/npu-engine/testdata/npubinfmt_v3/ADD_I8_000 /dev/triv2-0 +sh-3.2# ./apptest_tvn_triv2_recurring -l 5 /usr/share/npu-engine/testdata/TRIV223_2TOPS/ADD_000 /dev/triv2-0 [ 1/ 5].......done [ 2/ 5].......done [ 3/ 5].......done @@ -189,10 +177,10 @@ sh-3.2# ./apptest_tvn_triv2_recurring -l 5 /usr/share/npu-engine/testdata/npubin ``` sh-3.2# taos-mgr install npu-engine-testdata nnstreamer-srnpu gstreamer-utils -sh-3.2# ls /usr/share/npu-engine/testdata/npubinfmt_v3/MOBILENET_V1 +sh-3.2# ls /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1 input_fmap_0.bin model.tvn output_fmap_0.bin -sh-3.2# cd /usr/share/npu-engine/testdata/npubinfmt_v3/MOBILENET_V1 +sh-3.2# cd /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1 sh-3.2# gst-launch-1.0 filesrc location=input_fmap_0.bin blocksize=-1 \ ! application/octet-stream ! tensor_converter input-dim=1:224:224:3 input-type=uint8 \ diff --git a/doc/usage_examples.md b/doc/usage_examples.md index e7f22f8..79c0179 100644 --- a/doc/usage_examples.md +++ b/doc/usage_examples.md @@ -31,6 +31,6 @@ Let's assume you are testing the application in Ubuntu 16.04/18.04. ```bash $ sudo apt-get install npu-engine-example npu-engine-testdata $ cd /opt/trinity -$ ./bin/apptests/apptest_tvn_triv2_example share/npu-engine/testdata/npubinfmt_v3/MOBILENET_V1 +$ ./bin/apptests/apptest_tvn_triv2_example share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1 ... ``` diff --git a/include/common/typedef.h b/include/common/typedef.h index d72e1d3..81bc883 100644 --- a/include/common/typedef.h +++ b/include/common/typedef.h @@ -217,7 +217,7 @@ typedef struct { static const uint32_t default_timeout = 3000; static const npu_priority default_priority = NPU_PRIORITY_MID; static const npu_notimode default_notimode = NPU_INTERRUPT; -static const uint32_t default_tops = 8; /** TODO: change to 2-TOPS when testdata is ready */ +static const uint32_t default_tops = 2; /** * @brief Description of npu device status diff --git a/tests/apptests/tvn_triv2_dmabuf.cc b/tests/apptests/tvn_triv2_dmabuf.cc index 7f78da5..f9ce6ac 100644 --- a/tests/apptests/tvn_triv2_dmabuf.cc +++ b/tests/apptests/tvn_triv2_dmabuf.cc @@ -20,7 +20,6 @@ /** ./include/typedef.h */ #define TRIV2_TYPE NPUCOND_TRIV2_CONN_SOCIP -#define TRIV_TYPE NPUCOND_TRIV_CONN_SOCIP /* just for mem alloc */ #define NPU_MODEL_NAME "model.tvn" @@ -57,7 +56,7 @@ class TesterTRIV2 { /** @brief initilize the device handle */ int init (const std::string dir) { dir_ = dir; - return getNPUdeviceByTypeAny (&dev_, TRIV2_TYPE, default_tops); + return getNPUdeviceByTypeAny (&dev_, TRIV2_TYPE, 2); } /** @brief run the inference (with dummy data) */ @@ -117,8 +116,8 @@ class TesterTRIV2 { } int prepare_input () { - /** let's emulate external dmabuf using TRIV1 device */ - int status = getNPUdeviceByType (&dev_tmp_, TRIV_TYPE, 0); + /** let's emulate external dmabuf using 8TOPS TRIV2 device */ + int status = getNPUdeviceByTypeAny (&dev_tmp_, TRIV2_TYPE, 8); if (status != 0) return status; diff --git a/tests/apptests/tvn_triv2_xml.cc b/tests/apptests/tvn_triv2_xml.cc index 03a1754..704550d 100644 --- a/tests/apptests/tvn_triv2_xml.cc +++ b/tests/apptests/tvn_triv2_xml.cc @@ -17,10 +17,10 @@ * * * - * /usr/share/npu-engine/testdata/npubinfmt_v3/MOBILENET_V1 + * /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1 * * - * /usr/share/npu-engine/testdata/npubinfmt_v3/MOBILENET_V2 + * /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V2 * * ... * diff --git a/tests/unittests/ne_libnpuhost_test.cc b/tests/unittests/ne_libnpuhost_test.cc index 8d514a1..2d576e0 100644 --- a/tests/unittests/ne_libnpuhost_test.cc +++ b/tests/unittests/ne_libnpuhost_test.cc @@ -120,7 +120,7 @@ TEST (ne_libnpuhost_test, register_model) ASSERT_EQ (getNPUdeviceByType (&dev, NPUCOND_TRIV2_CONN_SOCIP, 0), 0); std::string model_path (NE_DATADIR); - model_path += "/testdata/npubinfmt_v3/CONV_I8_008/model.tvn"; + model_path += "/testdata/TRIV223_2TOPS/CONV_2D_000/model.tvn"; npubin_meta *meta = getNPUmodel_metadata (model_path.c_str(), false); if (meta == nullptr) { @@ -152,7 +152,7 @@ TEST (ne_libnpuhost_test, register_model_n) ASSERT_EQ (getNPUdeviceByType (&dev, NPUCOND_TRIV2_CONN_SOCIP, 0), 0); std::string model_path (NE_DATADIR); - model_path += "/testdata/npubinfmt_v3/CONV_I8_008/model.tvn"; + model_path += "/testdata/TRIV223_2TOPS/CONV_2D_000/model.tvn"; npubin_meta *meta = getNPUmodel_metadata (model_path.c_str(), false); if (meta == nullptr) { @@ -187,7 +187,7 @@ TEST (ne_libnpuhost_test, run_input_triv2_binfmt_v3) ASSERT_EQ (tester.init (), 0); std::string model_dir (NE_DATADIR); - model_dir += "/testdata/npubinfmt_v3/CONV_I8_008"; + model_dir += "/testdata/TRIV223_2TOPS/CONV_2D_000"; uint32_t model_id = 0; @@ -223,7 +223,7 @@ TEST (ne_libnpuhost_test, run_input_triv2_binfmt_v3_n) /* invalid model id */ std::string model_dir (NE_DATADIR); - model_dir += "/testdata/npubinfmt_v3/CONV_I8_008"; + model_dir += "/testdata/TRIV223_2TOPS/CONV_2D_000"; uint32_t model_id = 0; @@ -244,7 +244,7 @@ TEST (ne_libnpuhost_test, run_internal_triv2_binfmt_v3) ASSERT_EQ (tester.init (), 0); std::string model_dir (NE_DATADIR); - model_dir += "/testdata/npubinfmt_v3/CONV_I8_008"; + model_dir += "/testdata/TRIV223_2TOPS/CONV_2D_000"; uint32_t model_id = 0; @@ -276,7 +276,7 @@ TEST (ne_libnpuhost_test, run_internal_triv2_binfmt_v3_n) /* TODO: taskid of stop() is currently not checked */ #if 0 std::string model_dir (NE_DATADIR); - model_dir += "/testdata/npubinfmt_v3/CONV_I8_008"; + model_dir += "/testdata/TRIV223_2TOPS/CONV_2D_000"; uint32_t model_id = 0; diff --git a/utils/coverage/gcovr_coverage.sh b/utils/coverage/gcovr_coverage.sh index 8e28700..16bdb0c 100755 --- a/utils/coverage/gcovr_coverage.sh +++ b/utils/coverage/gcovr_coverage.sh @@ -39,15 +39,15 @@ find . -maxdepth 1 -type f -exec basename {} \; |\ popd # 2-2. With valid arguments for some apptests -mkdir -p sample_models_v3 +mkdir -p sample_models -cp -rf ${INSTALL_PREFIX}/share/npu-engine/testdata/npubinfmt_v3/CONV* sample_models_v3/ +cp -rf ${INSTALL_PREFIX}/share/npu-engine/testdata/TRIV223_2TOPS/CONV* sample_models/ -./tests/apptests/apptest_tvn_triv2_bulk sample_models_v3 > /dev/null -./tests/apptests/apptest_tvn_triv2_dmabuf sample_models_v3/CONV_2D_300 > /dev/null -./tests/apptests/apptest_tvn_triv2_profile sample_models_v3/CONV_2D_301 > /dev/null +./tests/apptests/apptest_tvn_triv2_bulk sample_models > /dev/null +./tests/apptests/apptest_tvn_triv2_dmabuf sample_models/CONV_2D_300 > /dev/null +./tests/apptests/apptest_tvn_triv2_profile sample_models/CONV_2D_301 > /dev/null -rm -rf sample_models_* +rm -rf sample_models # 3. run gcovr gcovr -r .. --html --html-details \ -- 2.7.4