Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about example.cc #11

Closed
huanyingjun opened this issue Jun 29, 2018 · 21 comments
Closed

question about example.cc #11

huanyingjun opened this issue Jun 29, 2018 · 21 comments
Assignees
Labels
question Further information is requested

Comments

@huanyingjun
Copy link

huanyingjun commented Jun 29, 2018

python tools/converter.py build --config=docs/getting_started/models/demo_app_models.yaml
运行后生成如下文件:
├── include
│   └── mace
│   └── public
│   ├── mace_engine_factory.h
│   ├── mace.h
│   ├── mace_runtime.h
│   ├── mobilenet_v1.h
│   └── mobilenet_v2.h
├── lib
│   └── arm64-v8a
│   └── libmace_mobilenet.a
├── libmace_mobilenet.tar.gz
├── model
└── _tmp
├── arm64-v8a_e2a4c8972fefd2c3d18824a4b1c58ed9
│   ├── benchmark_model_static
│   └── mace_run_static
├── mobilenet_v1
│   └── f330dec17e45a8626cfb225ddce95051
│   ├── general
│   │   └── arm64-v8a
│   │   └── model_input_input
│   └── model.pb
└── mobilenet_v2
└── d4e627ce1b15ed6f96aefffe315a8dc8
├── general
│   └── arm64-v8a
│   └── model_input_input
└── model.pb

按照这个转换模型之后,example.cc 中有几个参数不知道怎么设置:
FLAGS_opencl_binary_file 这个是什么?
CreateMaceEngineFromProto 和 CreateMaceEngineFromCode 只需要调其中的一个就行了吧?
FLAGS_model_name 是 demo_app_models.yaml中的 mobilenet_v1 或者 mobilenet_v2?
调用 CreateMaceEngineFromCode 的时候,第二个参数 FLAGS_model_data_file 直接设NULL ?

我参考example.cc写了个test文件,用ndk独立编译(不放在mace用bazel编译)
除了要链接 libmace_mobilenet.a ,还需要链接什么别的库吗?

非常感谢

@liyinhgqw liyinhgqw added the question Further information is requested label Jun 29, 2018
@yejw5
Copy link
Contributor

yejw5 commented Jun 29, 2018

@huanyingjun

  • 例子可以参考mace/tools/validation/mace_run.ccexample.cc的流程和内容与mace_run.cc相似,后期将要去掉,只参考mace_run.cc就好。
  • FLAGS_opencl_binary_file是用于指定手机上保存opencl源码编译得到的binary的文件路径
  • CreateMaceEngineFromProtoCreateMaceEngineFromCode分别表示从模型的pb文件加载模型结构以及从源码(converter.py编译的时候将模型转成C++源码)加载,与yaml配置文件里的build_type项相关
  • FLAGS_model_name是demo_app_models.yaml中的 mobilenet_v1 或者 mobilenet_v2
  • 调用CreateMaceEngineFromCode时,FLAGS_model_data_file根据配置文件中的embed_model_data设置。

可以直接使用python tools/converter.py run ... ...命令运行,FLAGS_*相关的参数会根据配置文件自动设置的

@huanyingjun
Copy link
Author

@yejw5
调用CreateMaceEngineFromCode时,FLAGS_model_data_file根据配置文件中的embed_model_data设置。
====》
当 embed_model_data: 1 时, FLAGS_model_data_file 直接给NULL 对吗?

@yejw5
Copy link
Contributor

yejw5 commented Jun 29, 2018

  • 当 embed_model_data: 1 时, FLAGS_model_data_file 直接给NULL对吗?: 按照mace_run.cc里面传个空的string就好
  • 贴一下报错信息?

@huanyingjun
Copy link
Author

huanyingjun commented Jun 29, 2018

@yejw5

starqltecmcc:/data/local/tmp/mace_test $ ./test_mace
WARNING: linker: "/data/local/tmp/mace_test/test_mace" unused DT entry: type 0xf arg 0x6b7
Segmentation fault

logcat ...

--------- beginning of system
06-29 14:27:41.353  1483  4462 D SSRM:u  : SIOP:: AP = 260, PST = 260 (W:15), BAT = 266, USB = 263, CHG = 264, CP = 270, WF = 270, WFPst = 269 (W:15)
06-29 14:27:41.372  1483  4462 D ConnectivityService: filterNetworkStateForUid() uid: 1000 networkInfo: [type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false, metered: false]
--------- beginning of main
06-29 14:27:41.381   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;activeStream
06-29 14:27:41.381   912  7131 V APM_AudioPolicyManager: ### active stream : 0
06-29 14:27:41.382  1483  4462 D AudioService: active stream is 0x0
06-29 14:27:41.382   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
06-29 14:27:41.382   912  7131 V APM_AudioPolicyManager: getNewOutputDevice() selected device 0
06-29 14:27:41.383   912  7131 V APM_AudioPolicyManager: ### curdevice : 2
06-29 14:27:41.389  1483  4462 D SSRM:h  : ATC: power = AP_CP = -999, Display = 0(Panel:0, LDIs:0), WIFI = 0, SPK = 0, RCV = 0, Camera = 0, PAM = 0
06-29 14:27:41.389  1483  4462 D SSRM:h  : ATC: current = AP_CP = -999, Display = 0, WIFI = 0, SPK = 0,RCV = 0, Camera = 0, PAM = 0
06-29 14:27:41.394  1483  4462 D SSRM:h  : ATC: Ambient Temperature = 30.78, Skin temperature = F_AP[24.50], F_RF[25.20], B_AP[24.60], B_RF[25.20], B_WIFI[26.60], B_SPK[26.40]
06-29 14:27:42.648  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173713 5248188 d 19446 50714372 f 55874 60218 iot 286870 194277 th 307200 0 0 pt 0 inp 0 0 78734.525
06-29 14:27:46.370   555   555 E propClient: PropClient failed to load
06-29 14:27:50.611   559   559 W linker  : "/data/local/tmp/mace_test/test_mace" unused DT entry: type 0xf arg 0x6b7
06-29 14:27:50.839   559   559 E propClient: PropClient failed to load
06-29 14:27:50.840   559   559 W ADebug  : Failed to get property persist.sys.media.traces
--------- beginning of crash
06-29 14:27:50.842   559   559 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 559 (test_mace)
06-29 14:27:50.886   563   563 E propClient: PropClient failed to load
06-29 14:27:50.893   892   892 E audit   : type=1400 audit(1530253670.885:1607): avc:  denied  { search } for  pid=564 comm="crash_dump64" name="tmp" dev="dm-3" ino=1507330 scontext=u:r:crash_dump:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0 SEPF_SM-G9608_8.0.0_0002 unfiltered
06-29 14:27:50.894   892   892 E audit   : type=1300 audit(1530253670.885:1607): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=73df429dd0 a2=0 a3=0 items=0 ppid=1 pid=564 auid=4294967295 uid=2000 gid=2000 euid=2000 suid=2000 fsuid=2000 egid=2000 sgid=2000 fsgid=2000 tty=pts1 ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0 key=(null)
06-29 14:27:50.897   892   892 E audit   : type=1327 audit(1530253670.885:1607): proctitle=63726173685F64756D7036340035353900353632
06-29 14:27:50.897  1483  1553 D SecurityLogAgent:SEDenialService: Got Modify Event and sending Denial Intent for audit.log / crash_dump64 559 562
06-29 14:27:50.898  1483  1553 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:956 com.android.server.SEDenialService$AuditFileObserver.onEvent:84 android.os.FileObserver$ObserverThread.onEvent:123 android.os.FileObserver$ObserverThread.observe:-2 android.os.FileObserver$ObserverThread.run:86
06-29 14:27:50.900  1483  1553 D SecurityLogAgent:SEDenialService: audit.ondenial set to 0 after sending samsung.intent.action.knox.DENIAL_NOTIFICATION intent
06-29 14:27:50.904 32434 32434 D SecurityLogAgent:  SeDenialReceiver : Intent received : samsung.intent.action.knox.DENIAL_NOTIFICATION
06-29 14:27:50.906   564   564 I crash_dump64: obtaining output fd from tombstoned
06-29 14:27:50.906   892   892 E audit   : type=1400 audit(1530253670.895:1608): avc:  denied  { search } for  pid=564 comm="crash_dump64" name="mace_test" dev="dm-3" ino=1507406 scontext=u:r:crash_dump:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0 SEPF_SM-G9608_8.0.0_0002 unfiltered
06-29 14:27:50.906   892   892 E audit   : type=1300 audit(1530253670.895:1608): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=73df42d310 a2=0 a3=0 items=0 ppid=1 pid=564 auid=4294967295 uid=2000 gid=2000 euid=2000 suid=2000 fsuid=2000 egid=2000 sgid=2000 fsgid=2000 tty=pts1 ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0 key=(null)
06-29 14:27:50.906   945   945 I /system/bin/tombstoned: received crash request for pid 559
06-29 14:27:50.908   564   564 I crash_dump64: performing dump of process 559 (target tid = 559)
06-29 14:27:50.908   892   892 E audit   : type=1327 audit(1530253670.895:1608): proctitle=63726173685F64756D7036340035353900353632
06-29 14:27:50.909  1483  1553 D SecurityLogAgent:SEDenialService: Got Modify Event and sending Denial Intent for audit.log / crash_dump64 559 562
06-29 14:27:50.909   564   564 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-29 14:27:50.909   564   564 F DEBUG   : Build fingerprint: 'samsung/starqltezm/starqltecmcc:8.0.0/R16NW/G9608ZMU2ARC9:user/release-keys'
06-29 14:27:50.909   564   564 F DEBUG   : Revision: '14'
06-29 14:27:50.909   564   564 F DEBUG   : ABI: 'arm64'
06-29 14:27:50.909   564   564 F DEBUG   : pid: 559, tid: 559, name: test_mace  >>> ./test_mace <<<
06-29 14:27:50.909   564   564 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
06-29 14:27:50.909   564   564 F DEBUG   : Cause: null pointer dereference
06-29 14:27:50.909   564   564 F DEBUG   :     x0   0000000000000000  x1   0000000000000000  x2   0000000000000048  x3   0000000000000007
06-29 14:27:50.909   564   564 F DEBUG   :     x4   000000718343bb38  x5   0000007fd03cde38  x6   1f6e731f735e6479  x7   7f7f7f7f7f7f7f7f
06-29 14:27:50.909   564   564 F DEBUG   :     x8   73c84b5ed0663408  x9   73c84b5ed0663408  x10  000000718340d6b8  x11  0000000000000001
06-29 14:27:50.909   564   564 F DEBUG   :     x12  000000718340d6c8  x13  0000000000000070  x14  000000000000000d  x15  aaaaaaaaaaaaaaab
06-29 14:27:50.909   564   564 F DEBUG   :     x16  00000071851df348  x17  00000071850ad6f8  x18  000000718618251a  x19  0000000000000000
06-29 14:27:50.909   564   564 F DEBUG   :     x20  0000000000000000  x21  00000071851de368  x22  0000000000000001  x23  0000007187fde974
06-29 14:27:50.909   564   564 F DEBUG   :     x24  0000007187fe199c  x25  0000007188013000  x26  0000007188013428  x27  000000000000000f
06-29 14:27:50.909   564   564 F DEBUG   :     x28  00000071850aae34  x29  0000007fd03cdea0  x30  00000071850aca88
06-29 14:27:50.909   564   564 F DEBUG   :     sp   0000007fd03cde50  pc   00000071850ad714  pstate 0000000060000000
06-29 14:27:50.910  1483  8252 I ActivityManager: Killing 32567:com.sec.spp.push:RemoteNotiProcess/u0a54 (adj 906): empty for 2857s
06-29 14:27:50.915  1483  1553 D SecurityLogAgent:SEDenialService: audit.ondenial set to 0 after sending samsung.intent.action.knox.DENIAL_NOTIFICATION intent
06-29 14:27:50.915 32434 32434 D SecurityLogAgent:  SeDenialReceiver : Intent received : samsung.intent.action.knox.DENIAL_NOTIFICATION
06-29 14:27:50.918   892   892 E audit   : type=1400 audit(1530253670.905:1609): avc:  denied  { search } for  pid=564 comm="crash_dump64" name="tmp" dev="dm-3" ino=1507330 scontext=u:r:crash_dump:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0 SEPF_SM-G9608_8.0.0_0002 unfiltered
06-29 14:27:50.918   892   892 E audit   : type=1300 audit(1530253670.905:1609): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=73df429dd0 a2=0 a3=0 items=0 ppid=1 pid=564 auid=4294967295 uid=2000 gid=2000 euid=2000 suid=2000 fsuid=2000 egid=2000 sgid=2000 fsgid=2000 tty=pts1 ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0 key=(null)
06-29 14:27:50.920   564   564 F DEBUG   :
06-29 14:27:50.920   564   564 F DEBUG   : backtrace:
06-29 14:27:50.920   892   892 E audit   : type=1327 audit(1530253670.905:1609): proctitle=63726173685F64756D7036340035353900353632
06-29 14:27:50.920  1483  1553 D SecurityLogAgent:SEDenialService: Got Modify Event and sending Denial Intent for audit.log / crash_dump64 559 562
06-29 14:27:50.920   564   564 F DEBUG   :     #00 pc 00000000000a5714  /system/lib64/libprotobuf-cpp-full.so (_ZN6google8protobuf8internal5Mutex4LockEv+28)
06-29 14:27:50.920   564   564 F DEBUG   :     #01 pc 00000000000a4a84  /system/lib64/libprotobuf-cpp-full.so (_ZN6google8protobuf8internal10OnShutdownEPFvvE+112)
06-29 14:27:50.920   564   564 F DEBUG   :     #02 pc 0000000000171d44  /data/local/tmp/mace_test/test_mace
06-29 14:27:50.920   564   564 F DEBUG   :     #03 pc 00000000000a7b18  /system/lib64/libprotobuf-cpp-full.so (_ZN6google8protobuf18GoogleOnceInitImplEPlPNS0_7ClosureE+72)
06-29 14:27:50.920   564   564 F DEBUG   :     #04 pc 00000000000caec8  /system/lib64/libprotobuf-cpp-full.so (_ZN6google8protobuf14DescriptorPool24InternalAddGeneratedFileEPKvi+96)
06-29 14:27:50.920   564   564 F DEBUG   :     #05 pc 00000000000c2e7c  /system/lib64/libprotobuf-cpp-full.so (_ZN6google8protobuf48protobuf_AddDesc_google_2fprotobuf_2fany_2eprotoEv+88)
06-29 14:27:50.920   564   564 F DEBUG   :     #06 pc 000000000001f50c  /system/bin/linker64 (__dl__ZL10call_arrayIPFviPPcS1_EEvPKcPT_mbS5_+276)
06-29 14:27:50.920   564   564 F DEBUG   :     #07 pc 000000000001f73c  /system/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+396)
06-29 14:27:50.920   564   564 F DEBUG   :     #08 pc 000000000001f634  /system/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+132)
06-29 14:27:50.920   564   564 F DEBUG   :     #09 pc 000000000001f634  /system/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+132)
06-29 14:27:50.920   564   564 F DEBUG   :     #10 pc 000000000001f634  /system/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+132)
06-29 14:27:50.920   564   564 F DEBUG   :     #11 pc 000000000001f634  /system/bin/linker64 (__dl__ZN6soinfo17call_constructorsEv+132)
06-29 14:27:50.920   564   564 F DEBUG   :     #12 pc 000000000001b744  /system/bin/linker64 (__dl___linker_init+3072)
06-29 14:27:50.920   564   564 F DEBUG   :     #13 pc 0000000000021a80  /system/bin/linker64 (_start+4)
06-29 14:27:50.920  1483  1553 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:956 com.android.server.SEDenialService$AuditFileObserver.onEvent:84 android.os.FileObserver$ObserverThread.onEvent:123 android.os.FileObserver$ObserverThread.observe:-2 android.os.FileObserver$ObserverThread.run:86
06-29 14:27:50.923 32434 32434 D SecurityLogAgent:  SeDenialReceiver : Intent received : samsung.intent.action.knox.DENIAL_NOTIFICATION
06-29 14:27:50.924  1483  1553 D SecurityLogAgent:SEDenialService: audit.ondenial set to 0 after sending samsung.intent.action.knox.DENIAL_NOTIFICATION intent
06-29 14:27:50.924   892   892 E audit   : type=1400 audit(1530253670.915:1610): avc:  denied  { search } for  pid=564 comm="crash_dump64" name="mace_test" dev="dm-3" ino=1507406 scontext=u:r:crash_dump:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0 SEPF_SM-G9608_8.0.0_0002 unfiltered
06-29 14:27:50.924   892   892 E audit   : type=1300 audit(1530253670.915:1610): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=73df42d310 a2=0 a3=0 items=0 ppid=1 pid=564 auid=4294967295 uid=2000 gid=2000 euid=2000 suid=2000 fsuid=2000 egid=2000 sgid=2000 fsgid=2000 tty=pts1 ses=4294967295 comm="crash_dump64" exe="/system/bin/crash_dump64" subj=u:r:crash_dump:s0 key=(null)
06-29 14:27:50.927   892   892 E audit   : type=1327 audit(1530253670.915:1610): proctitle=63726173685F64756D7036340035353900353632
06-29 14:27:50.927  1483  1553 D SecurityLogAgent:SEDenialService: Got Modify Event and sending Denial Intent for audit.log / crash_dump64 559 562
06-29 14:27:50.927   892   892 E audit   : type=1327 audit(1530253670.915:1610): proctitle=63726173685F64756D7036340035353900353632
06-29 14:27:50.930 32434 32434 D SecurityLogAgent:  SeDenialReceiver : Intent received : samsung.intent.action.knox.DENIAL_NOTIFICATION
06-29 14:27:50.931  1483  1553 D SecurityLogAgent:SEDenialService: audit.ondenial set to 0 after sending samsung.intent.action.knox.DENIAL_NOTIFICATION intent
06-29 14:27:50.945  1483  1921 W NativeCrashListener: Couldn't find ProcessRecord for pid 559
06-29 14:27:50.947   892   892 E audit   : type=1701 audit(1530253670.935:1611): auid=4294967295 uid=2000 gid=2000 ses=4294967295 subj=u:r:shell:s0 pid=559 comm="test_mace" exe="/data/local/tmp/mace_test/test_mace" sig=11
06-29 14:27:50.948  1483  1553 I BootReceiver: Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)
06-29 14:27:50.948  2187  2206 D ForegroundUtils: could not check pending caller
06-29 14:27:50.951   945   945 W /system/bin/tombstoned: crash socket received short read of length 0 (expected 8)
06-29 14:27:51.219  1483  8252 D BatteryService: !@BatteryListener : batteryPropertiesChanged!
06-29 14:27:51.405  1483  4462 D SSRM:u  : SIOP:: AP = 260, PST = 260 (W:15), BAT = 266, USB = 264, CHG = 265, CP = 270, WF = 270, WFPst = 269 (W:15)
06-29 14:27:51.415  1483  4462 D ConnectivityService: filterNetworkStateForUid() uid: 1000 networkInfo: [type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false, metered: false]
06-29 14:27:51.419   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;activeStream
06-29 14:27:51.419   912  7131 V APM_AudioPolicyManager: ### active stream : 0
06-29 14:27:51.420  1483  4462 D AudioService: active stream is 0x0
06-29 14:27:51.420   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
06-29 14:27:51.420   912  7131 V APM_AudioPolicyManager: getNewOutputDevice() selected device 0
06-29 14:27:51.420   912  7131 V APM_AudioPolicyManager: ### curdevice : 2
06-29 14:27:51.427  1483  4462 D SSRM:h  : ATC: power = AP_CP = -999, Display = 0(Panel:0, LDIs:0), WIFI = 0, SPK = 0, RCV = 0, Camera = 0, PAM = 0
06-29 14:27:51.427  1483  4462 D SSRM:h  : ATC: current = AP_CP = -999, Display = 0, WIFI = 0, SPK = 0,RCV = 0, Camera = 0, PAM = 0
06-29 14:27:51.431  1483  4462 D SSRM:h  : ATC: Ambient Temperature = 30.88, Skin temperature = F_AP[24.60], F_RF[25.30], B_AP[24.70], B_RF[25.30], B_WIFI[26.70], B_SPK[26.50]
06-29 14:27:52.557  1483  2024 E Watchdog: !@Sync 2623 [2018-06-29 14:27:52.556]
06-29 14:27:52.668  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173722 5248412 d 19448 50714468 f 55877 60221 iot 286900 194293 th 307200 0 0 pt 0 inp 0 0 78744.545
06-29 14:27:57.680  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173738 5248644 d 19449 50714492 f 55878 60222 iot 286930 194303 th 307200 0 0 pt 0 inp 0 0 78749.557
06-29 14:28:00.335  3114  3239 D ContactsProvider_EventLog: contents_sample_state: [CONTACT contacts(0) data(0) accounts({}) accounts deleted({}) calls([]) countryIso(CN) userId(0)  ]
06-29 14:28:00.335  3114  3239 D ContactsProvider_EventLog: contents_sample_state: [ agr({})  ]
06-29 14:28:00.335  3114  3239 D ContactsProvider_EventLog: contents_sample_state: [ actCnt({android.process.acore(3114)=1})  ]
06-29 14:28:00.335  3114  3239 D ContactsProvider_EventLog: contents_sample_state: [PROFILE contacts(0) data(0) accounts({})  ]
06-29 14:28:00.335  3114  3239 D ContactsProvider_EventLog: contents_sample_state: [SAPROFILE contacts(1) data(1) accounts({vnd.sec.contact.phone (1)=1})  ]
06-29 14:28:00.340  3114  3239 E ContactsProvider_EventLog: Flush buffer to file cnt : 1 size : 0Kb duration : 3ms lastUpdatedAfter : 60120 ms mFlush_time_threasold : 2000 mCurrentSize : 437
06-29 14:28:01.480  1483  4462 D SSRM:u  : SIOP:: AP = 260, PST = 260 (W:15), BAT = 266, USB = 263, CHG = 265, CP = 271, WF = 270, WFPst = 269 (W:15)
06-29 14:28:01.497  1483  4462 D ConnectivityService: filterNetworkStateForUid() uid: 1000 networkInfo: [type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false, metered: false]
06-29 14:28:01.506   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;activeStream
06-29 14:28:01.507   912  7131 V APM_AudioPolicyManager: ### active stream : 0
06-29 14:28:01.507  1483  4462 D AudioService: active stream is 0x0
06-29 14:28:01.508   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
06-29 14:28:01.508   912  7131 V APM_AudioPolicyManager: getNewOutputDevice() selected device 0
06-29 14:28:01.508   912  7131 V APM_AudioPolicyManager: ### curdevice : 2
06-29 14:28:01.515  1483  4462 D SSRM:h  : ATC: power = AP_CP = -999, Display = 0(Panel:0, LDIs:0), WIFI = 0, SPK = 0, RCV = 0, Camera = 0, PAM = 0
06-29 14:28:01.515  1483  4462 D SSRM:h  : ATC: current = AP_CP = -999, Display = 0, WIFI = 0, SPK = 0,RCV = 0, Camera = 0, PAM = 0
06-29 14:28:01.520  1483  4462 D SSRM:h  : ATC: Ambient Temperature = 30.78, Skin temperature = F_AP[24.50], F_RF[25.20], B_AP[24.60], B_RF[25.20], B_WIFI[26.60], B_SPK[26.40]
06-29 14:28:02.693  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173756 5248760 d 19449 50714492 f 55879 60223 iot 286940 194308 th 307200 0 0 pt 0 inp 0 0 78754.568
06-29 14:28:07.700  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173758 5248812 d 19450 50714496 f 55880 60224 iot 286950 194311 th 307200 0 0 pt 0 inp 0 0 78759.577
06-29 14:28:11.554  1483  4462 D SSRM:u  : SIOP:: AP = 260, PST = 260 (W:15), BAT = 266, USB = 263, CHG = 264, CP = 271, WF = 270, WFPst = 269 (W:15)
06-29 14:28:11.568  1483  4462 D ConnectivityService: filterNetworkStateForUid() uid: 1000 networkInfo: [type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false, metered: false]
06-29 14:28:11.576   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;activeStream
06-29 14:28:11.577   912  7131 V APM_AudioPolicyManager: ### active stream : 0
06-29 14:28:11.577  1483  4462 D AudioService: active stream is 0x0
06-29 14:28:11.578   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
06-29 14:28:11.578   912  7131 V APM_AudioPolicyManager: getNewOutputDevice() selected device 0
06-29 14:28:11.578   912  7131 V APM_AudioPolicyManager: ### curdevice : 2
06-29 14:28:11.590  1483  4462 D SSRM:h  : ATC: power = AP_CP = -999, Display = 0(Panel:0, LDIs:0), WIFI = 0, SPK = 0, RCV = 0, Camera = 0, PAM = 0
06-29 14:28:11.590  1483  4462 D SSRM:h  : ATC: current = AP_CP = -999, Display = 0, WIFI = 0, SPK = 0,RCV = 0, Camera = 0, PAM = 0
06-29 14:28:11.595  1483  4462 D SSRM:h  : ATC: Ambient Temperature = 30.78, Skin temperature = F_AP[24.50], F_RF[25.20], B_AP[24.60], B_RF[25.20], B_WIFI[26.60], B_SPK[26.40]
06-29 14:28:12.713  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173767 5248856 d 19450 50714496 f 55880 60224 iot 286960 194312 th 307200 0 0 pt 0 inp 0 0 78764.589
06-29 14:28:20.324  1483  1558 W StorageManager: getStorageFullBytes DEFAULT_FULL_THRESHOLD_BYTES : 20971520, threadhold : 20971520
06-29 14:28:20.326  1483  1558 W StorageManager: getStorageLowBytes lowPercent : 5, lowBytes : 2826292019, maxLowBytes : 524288000
06-29 14:28:20.336  1483  1558 W DeviceStorageMonitorService: updateBroadcasts(/data) oldLevel:0, newLevel:0, seq:1
06-29 14:28:20.338  1483  1558 W DeviceStorageMonitorService: updateBroadcasts_filenode(/data) fn_oldLevel:0, fn_newLevel:0, seq:1
06-29 14:28:21.306  1483  8252 D BatteryService: !@BatteryListener : batteryPropertiesChanged!
06-29 14:28:21.307  1483  8252 D BatteryService: level:100, scale:100, status:5, health:2, present:true, voltage: 4315, temperature: 267, technology: Li-ion, AC powered:false, USB powered:true, POGO powered:false, Wireless powered:false, icon:17303838, invalid charger:0, maxChargingCurrent:0, maxChargingVoltage:0, chargeCounter:3154000
06-29 14:28:21.307  1483  8252 D BatteryService: online:4, current avg:0, charge type:0, power sharing:false, high voltage charger:false, capacity:280000, batterySWSelfDischarging:false, misc_event:0, current_event:0, current_now:-1
06-29 14:28:21.307  1483  8252 D BatteryService: stay LED for fully charged
06-29 14:28:21.307  1483  1483 D BatteryService: Sending ACTION_BATTERY_CHANGED.
06-29 14:28:21.312  1483  1483 I MotionRecognitionService: Plugged
06-29 14:28:21.312  1483  1483 D MotionRecognitionService:   mCableConnection= 1
06-29 14:28:21.312  1483  1483 D MotionRecognitionService: setPowerConnected : mGripEnabled = false
06-29 14:28:21.314  1483  1483 D SamsungPhoneWindowManager: ACTION_BATTERY_CHANGED - Level :: 100, battStatus :: 5
06-29 14:28:21.315  1483  1557 D UsbDeviceManager: handleMessage -> MSG_UPDATE_CHARGING_STATE = 1
06-29 14:28:21.315  1924  1924 D KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
06-29 14:28:21.318  1924  1924 D BatteryController: onReceive-ACTION_BATTERY_CHANGED : mLevel=100, mBatteryStatus=5
06-29 14:28:21.322  1924  1924 D PowerUI : priorPlugType = 2 mPlugType =  2
06-29 14:28:21.323  1483  3128 V LocSvc_HIDL_Subscription_jni: battery_level_update
06-29 14:28:21.323  1483  3128 V LocSvc_HIDL_Subscription_jni: [battery_level_update][886] [HC] =>> [HS]
06-29 14:28:21.324   935  2070 V LocSvc_HIDL_IzatSubscription: [batteryLevelUpdate][757] [HS] <<<<= [HC]
06-29 14:28:21.324  1483  3128 V LocSvc_HIDL_Subscription_jni: Exit Result 0
06-29 14:28:21.614  1483  4462 D SSRM:u  : SIOP:: AP = 260, PST = 260 (W:15), BAT = 267, USB = 263, CHG = 264, CP = 271, WF = 270, WFPst = 269 (W:15)
06-29 14:28:21.633  1483  4462 D ConnectivityService: filterNetworkStateForUid() uid: 1000 networkInfo: [type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false, metered: false]
06-29 14:28:21.640   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;activeStream
06-29 14:28:21.641   912  7131 V APM_AudioPolicyManager: ### active stream : 0
06-29 14:28:21.641  1483  4462 D AudioService: active stream is 0x0
06-29 14:28:21.641   912  7131 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
06-29 14:28:21.641   912  7131 V APM_AudioPolicyManager: getNewOutputDevice() selected device 0
06-29 14:28:21.641   912  7131 V APM_AudioPolicyManager: ### curdevice : 2
06-29 14:28:21.648  1483  4462 D SSRM:h  : ATC: power = AP_CP = -999, Display = 0(Panel:0, LDIs:0), WIFI = 0, SPK = 0, RCV = 0, Camera = 0, PAM = 0
06-29 14:28:21.649  1483  4462 D SSRM:h  : ATC: current = AP_CP = -999, Display = 0, WIFI = 0, SPK = 0,RCV = 0, Camera = 0, PAM = 0
06-29 14:28:21.655  1483  4462 D SSRM:h  : ATC: Ambient Temperature = 30.78, Skin temperature = F_AP[24.50], F_RF[25.20], B_AP[24.60], B_RF[25.20], B_WIFI[26.60], B_SPK[26.40]
06-29 14:28:22.574  1483  2024 E Watchdog: !@Sync 2624 [2018-06-29 14:28:22.574]
06-29 14:28:22.731  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173769 5248884 d 19451 50714500 f 55881 60226 iot 286970 194316 th 307200 0 0 pt 0 inp 0 0 78774.608
06-29 14:28:27.740  2540  2540 D io_stats: !@   8,0 r 165179 10226952 w 173771 5248900 d 19451 50714500 f 55881 60226 iot 286980 194316 th 307200 0 0 pt 0 inp 0 0 78779.617

@yejw5
Copy link
Contributor

yejw5 commented Jun 29, 2018

代码里面有一行printf("++++ %s %d\n", FUNCTION, LINE);,但是在报错日志里面并没有搜索到++++的字符串,似乎不能确定是执行CreateMaceEngineFromCode时的问题吧?

@huanyingjun
Copy link
Author

@yejw5

我也很奇怪这个日志打印,当把 CreateMaceEngineFromCode 注释掉,就OK,printf也有。
当CreateMaceEngineFromCode 不注释,哪怕在main 函数第一行加printf 都打印不出来,直接Segmentation fault

@yejw5
Copy link
Contributor

yejw5 commented Jun 29, 2018

把手动编译的命令给一下

@huanyingjun
Copy link
Author

@yejw5
how about the status ?

@llhe
Copy link
Member

llhe commented Jul 2, 2018

demo_app_models.yaml 能发一下吗?你用的哪一个?

@llhe
Copy link
Member

llhe commented Jul 2, 2018

CreateMaceEngineFromCode 和 CreateMaceEngineFromProto只能用一个,用哪个取决于你使用的哪种build方式。

@huanyingjun
Copy link
Author

huanyingjun commented Jul 2, 2018

@llhe
demo_app_models.yaml 就是用的默认的,什么都没改
只用了 CreateMaceEngineFromCode
同样的文件,我放在mace工程里面的用bazel编译可以,放到外面用android.mk 和 application.mk ndk-build编译就会Segmentation fault
只需要链接 libmace_mobilenet.a 对吗?

@llhe
Copy link
Member

llhe commented Jul 2, 2018

你能把你的代码用markdown的代码块引用一下吗,前面你贴的格式/内容都错了?或者直接把源文件贴上来。

@llhe
Copy link
Member

llhe commented Jul 2, 2018

@huanyingjun
日志格式也有问题,可以参考:https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

@llhe
Copy link
Member

llhe commented Jul 2, 2018

帮你调整了一下。

@llhe
Copy link
Member

llhe commented Jul 2, 2018

@huanyingjun
你前面的出错日志,跟你的代码和build脚本是对应的吗?你上传一下你编译好的test_mace文件,感觉依赖不太正常。

或者你把整个项目打包上传一下。

@llhe
Copy link
Member

llhe commented Jul 2, 2018

@huanyingjun
我看这个错误是从/system/lib64/libprotobuf-cpp-full.so 报出来的,但是MACE并不依赖这个库。所以看着很奇怪。你能确认一下这个库是怎么依赖进来的吗?

@huanyingjun
Copy link
Author

@llhe
我也很奇怪,我的工程如上,里面很简单,里没有依赖这个so库,不知道为什么会报这种错

@llhe
Copy link
Member

llhe commented Jul 2, 2018

@huanyingjun 还是等你网络好了上传了这个文件我们再看下吧,这个依赖MACE本身也不依赖(最多是依赖lite而不是full,且不是动态库)

@yejw5
Copy link
Contributor

yejw5 commented Jul 4, 2018

@huanyingjun 抱歉,我在本地测试了你的代码,报了一样的错误。猜想是静态库里面带的protobuf符号,与系统的protobuf冲突导致的,但是ndk-build我这边之前没使用过,没找到strip的命令,如果你那边了解这一块,可以试着将所有的符号strip掉,猜测应该能够避免这个报错

@yejw5 yejw5 reopened this Jul 4, 2018
@yejw5
Copy link
Contributor

yejw5 commented Jul 4, 2018

@huanyingjun 这边确认把mace相关的符号strip掉之后,运行成功了。在使用静态库的情况下,tools/bazel.rcoptimization选项下加一行build:optimization --copt=-fvisibility=hidden,编译得到的libmace_mobilenet.a应该可以暂时解决当前的问题。以下是我测试的输出结果:

$ adb shell /data/local/tmp/test_mace                                                                                 
WARNING: linker: "/data/local/tmp/test_mace" unused DT entry: type 0xf arg 0x6f6
++++++++ main 32
W opencl_runtime.cc:312 There is no precompiled OpenCL binary file in [/data/local/tmp/mace_run/]
++++++++ main 51
++++++++ main 74
I mace.cc:127 Creating MaceEngine, MACE version: v0.8.1-47-g4496036-20180704
I mace.cc:135 Initializing MaceEngine
I tuner.h:129 There is no tuned parameters.
I file_storage.cc:66 File /data/local/tmp/mace_cl_compiled_program.bin does not exist
W opencl_runtime.cc:428 There is no precompiled OpenCL binary in all OpenCL binary paths
++++++++ main 84
I mace.cc:194 Destroying MaceEngine

@yejw5 yejw5 closed this as completed Jul 4, 2018
@llhe
Copy link
Member

llhe commented Jul 5, 2018

附root cause分析:

test_mace => libandroid.so => libandroid_runtime.so => ibhwui.so => libprotobuf-cpp-full.so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants