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

connect to this proxy server via TVM RPC application failed #638

Closed
haolongzhangm opened this issue Nov 13, 2017 · 13 comments
Closed

connect to this proxy server via TVM RPC application failed #638

haolongzhangm opened this issue Nov 13, 2017 · 13 comments

Comments

@haolongzhangm
Copy link
Contributor

1: follow the android build and connect steps:
2: run:
zhl@pc:~/mycode/tvm/apps/android_rpc/tests$ python -m tvm.exec.rpc_proxy
INFO:root:RPCProxy: client port bind to 0.0.0.0:9090
INFO:root:RPCProxy: Websock port bind to 9190

3: input 0.0.0.0 to Adddress to APK :
9090 to Port,

then apk show err: connect failed:

adb log:
-13 06:14:37.924 488 3676 E FastThread: did not receive expected priority boost
03-13 06:14:37.972 711 711 I MSM-irqbalance: Decided to move IRQ321 from CPU3 to CPU2
03-13 06:14:38.009 1342 3816 W qti_sensors_hal: timestampCalc: Adjusting timestamp for rollover: 367028416431594, -1
03-13 06:14:38.159 1342 3816 W qti_sensors_hal: timestampCalc: Adjusting timestamp for rollover: 367028567341018, -1
03-13 06:14:38.310 1342 3816 W qti_sensors_hal: timestampCalc: Adjusting timestamp for rollover: 367028718372512, -1
03-13 06:14:38.325 10773 10773 W Atfwd_Sendcmd: AtCmdFwd service not published, waiting... retryCnt : 4
03-13 06:14:38.461 1342 3816 W qti_sensors_hal: timestampCalc: Adjusting timestamp for rollover: 367028869434524, -1
03-13 06:14:38.612 1342 3816 W qti_sensors_hal: timestampCalc: Adjusting timestamp for rollover: 367029020496536, -1
03-13 06:14:38.749 10786 10800 W System.err: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 9090) after 6000ms: isConnected failed: ECONNREFUSED (Connection refused)
03-13 06:14:38.749 10786 10800 W System.err: at libcore.io.IoBridge.isConnected(IoBridge.java:234)
03-13 06:14:38.749 10786 10800 W System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:171)
03-13 06:14:38.749 10786 10800 W System.err: at libcore.io.IoBridge.connect(IoBridge.java:122)
03-13 06:14:38.749 10786 10800 W System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
03-13 06:14:38.749 10786 10800 W System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:452)
03-13 06:14:38.749 10786 10800 W System.err: at java.net.Socket.connect(Socket.java:884)
03-13 06:14:38.750 10786 10800 W System.err: at ml.dmlc.tvm.rpc.ConnectProxyServerProcessor.run(ConnectProxyServerProcessor.java:62)
03-13 06:14:38.750 10786 10800 W System.err: at ml.dmlc.tvm.tvmrpc.RPCProcessor.run(RPCProcessor.java:67)
03-13 06:14:38.750 10786 10800 W System.err: Caused by: android.system.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
03-13 06:14:38.750 10786 10800 W System.err: at libcore.io.IoBridge.isConnected(IoBridge.java:223)
03-13 06:14:38.750 10786 10800 W System.err: ... 7 more
03-13 06:14:38.761 488 3678 D audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
03-13 06:14:38.761 488 3678 V msm8916_platform: platform_get_output_snd_device: enter: output devices(0x2)
03-13 06:14:38.762 488 3678 V msm8916_platform: platform_get_output_snd_device: exit: snd_device(speaker)
03-13 06:14:38.762 488 3678 D audio_hw_extn: audio_extn_set_anc_parameters: anc_enabled:0
03-13 06:14:38.763 10786 10786 W System.err: Disconnected.
03-13 06:14:38.765 1342 3816 W qti_sensors_hal: timestampCalc: Adjusting timestamp for rollover: 367029171558547, -1

@tqchen
Copy link
Member

tqchen commented Nov 14, 2017

Make sure you put right IP of your machine to the android app, instead of 0 0 0 0

@haolongzhangm
Copy link
Contributor Author

1: at host by command: ifconfig, get the host ip is 10.120.3.152

2: at fisrt terminal:
python -m tvm.exec.rpc_proxy --host 10.120.3.152
INFO:root:RPCProxy: client port bind to 10.120.3.152:9090
INFO:root:RPCProxy: Websock port bind to 9190

3: seconad terminal :
export TVM_ANDROID_RPC_PROXY_HOST=10.120.3.152
python android_rpc_test.py
[10:53:06] src/runtime/opencl/opencl_device_api.cc:195: Initialize OpenCL platform 'Intel(R) OpenCL'
[10:53:06] src/runtime/opencl/opencl_device_api.cc:215: opencl(0)='Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz' cl_device_id=0x14744f8

after run step 3 , first terminal will show message:
INFO:root:Handler ready TCPSocket: ('10.120.3.152', 49400):client:android

then I try to input 10.120.3.152 to app address, 49400 to APP Port , also can not connect failed by phone

@haolongzhangm
Copy link
Contributor Author

also try to input 10.120.3.152 to app address, 9090 to APP Port , android to the APP key ,also can not
connect failed by phone

ps : myphone ip do at the same LAN with PC ,

@tqchen
Copy link
Member

tqchen commented Nov 15, 2017

The port should be 9090(the port to your proxy)

@haolongzhangm
Copy link
Contributor Author

also try to input 10.120.3.152 to app address, 9090 to APP Port , android to the APP key ,also can not
connect failed by phone

ps : myphone ip do not at the same LAN with PC ,

@haolongzhangm
Copy link
Contributor Author

after put phone with PC in the same LAN, can connect success,
but failed to find opencl lib in phone : (already enable opencl build in jni and phone have the opencl lib)
12 # ./build.sh
13 #
14 #-------------------------------------------------------------------------------
15 APP_ABI = arm64-v8a
16
17 APP_PLATFORM = android-17
18
19 # whether enable OpenCL during compile
20 USE_OPENCL = 1
21
22 # the additional include headers you want to add, e.g., SDK_PATH/adrenosdk/Development/Inc
23 ADD_C_INCLUDES = /media/zhl/second/code/android-ndk-r14b/platforms/android-21/arch-arm64/usr/include
24
25 # the additional link libs you want to add, e.g., ANDROID_LIB_PATH/libOpenCL.so
26 ADD_LDLIBS = /home/zhl/mycode/tvm/apps/android_rpc/libOpenCL.so

logcat:
11-15 16:28:56.903 19402 19415 W System.err: [WARN] TVM native library not found in path. Copying native library from the archive. Consider installing the library somewhere in the path (for Windows: PATH, for Linux: LD_LIBRARY_PATH), or specifying by Java cmd option -Djava.library.path=[lib path].
11-15 16:28:56.906 19402 19415 W System.err: Attempting to load libtvm4j.so
11-15 16:28:56.917 19402 19415 W System.err: [WARN] Couldn't find native library tvm4j.
11-15 16:28:56.917 19402 19415 W System.err: java.lang.UnsatisfiedLinkError: Couldn't find the resource libtvm4j.so
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.NativeLibraryLoader.extractResourceFileToTempDir(NativeLibraryLoader.java:127)
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:87)
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.Base.(Base.java:73)
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.Function.register(Function.java:297)
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.rpc.NativeServerLoop.serverEnv(NativeServerLoop.java:73)
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.rpc.NativeServerLoop.run(NativeServerLoop.java:44)
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.rpc.ConnectProxyServerProcessor.run(ConnectProxyServerProcessor.java:81)
11-15 16:28:56.917 19402 19415 W System.err: at ml.dmlc.tvm.tvmrpc.RPCProcessor.run(RPCProcessor.java:67)
11-15 16:28:56.917 19402 19415 W System.err: Try to load tvm4j (runtime packed version) ...
11-15 16:28:56.944 19402 19415 W System.err: libtvm4j loads successfully.
11-15 16:28:56.972 19402 19415 W System.err: Load module from /data/user/0/ml.dmlc.tvm.tvmrpc/cache/tvm4j_rpc_1667301477/dev_lib.so
11-15 16:28:57.046 19402 19415 F art : art/runtime/thread.cc:1336] No pending exception expected: ml.dmlc.tvm.Base$TVMError: [16:28:57] /home/zhl/mycode/tvm/apps/android_rpc/app/src/main/jni/../../../../../../include/../src/runtime/opencl/opencl_module.cc:94: Check failed: workspace_->context != nullptr No OpenCL device
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at void ml.dmlc.tvm.Base.checkCall(int) (Base.java:179)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at ml.dmlc.tvm.TVMValue ml.dmlc.tvm.Function.invoke() (Function.java:131)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at ml.dmlc.tvm.Module ml.dmlc.tvm.Module.load(java.lang.String, java.lang.String) (Module.java:133)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at ml.dmlc.tvm.Module ml.dmlc.tvm.Module.load(java.lang.String) (Module.java:139)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at java.lang.Object ml.dmlc.tvm.rpc.NativeServerLoop$2.invoke(ml.dmlc.tvm.TVMValue[]) (NativeServerLoop.java:84)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at java.lang.Object ml.dmlc.tvm.Function.invokeRegisteredCbFunc(ml.dmlc.tvm.Function$Callback, ml.dmlc.tvm.TVMValue[]) (Function.java:327)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at int ml.dmlc.tvm.LibInfo.tvmFuncCall(long, ml.dmlc.tvm.Base$RefTVMValue) (LibInfo.java:-2)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at ml.dmlc.tvm.TVMValue ml.dmlc.tvm.Function.invoke() (Function.java:131)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at void ml.dmlc.tvm.rpc.NativeServerLoop.run() (NativeServerLoop.java:45)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at void ml.dmlc.tvm.rpc.ConnectProxyServerProcessor.run() (ConnectProxyServerProcessor.java:81)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336] at void ml.dmlc.tvm.tvmrpc.RPCProcessor.run() (RPCProcessor.java:67)
11-15 16:28:57.047 19402 19415 F art : art/runtime/thread.cc:1336]
11-15 16:28:57.484 19402 19415 F art : art/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
11-15 16:28:57.484 19402 19415 F art : art/runtime/runtime.cc:366] Runtime aborting --- recursively, so no thread-specific detail!
11-15 16:28:57.484 19402 19415 F art : art/runtime/runtime.cc:366]
11-15 16:28:57.485 19402 19415 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 19415 (Thread-1035)
11-15 16:28:57.540 594 594 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-15 16:28:57.540 594 594 F DEBUG : Build fingerprint: 'LYF/LS-5201/panda01a_msm8952_64:6.0.1/MMB29M/195:user/release-keys'
11-15 16:28:57.540 594 594 F DEBUG : Revision: '0'
11-15 16:28:57.540 594 594 F DEBUG : ABI: 'arm64'
11-15 16:28:57.540 594 594 F DEBUG : pid: 19402, tid: 19415, name: Thread-1035 >>> ml.dmlc.tvm.tvmrpc <<<
11-15 16:28:57.540 594 594 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
11-15 16:28:57.563 594 594 F DEBUG : Abort message: 'art/runtime/thread.cc:1336] No pending exception expected: ml.dmlc.tvm.Base$TVMError: [16:28:57] /home/zhl/mycode/tvm/apps/android_rpc/app/src/main/jni/../../../../../../include/../src/runtime/opencl/opencl_module.cc:94: Check failed: workspace_->context != nullptr No OpenCL device'
11-15 16:28:57.563 594 594 F DEBUG : x0 0000000000000000 x1 0000000000004bd7 x2 0000000000000006 x3 0000000000000000
11-15 16:28:57.563 594 594 F DEBUG : x4 0000000000000000 x5 0000000000000001 x6 0000000000000000 x7 0000000000000000
11-15 16:28:57.563 594 594 F DEBUG : x8 0000000000000083 x9 0000007fab4e2a70 x10 0000000000000003 x11 0000000000000000
11-15 16:28:57.563 594 594 F DEBUG : x12 0000007fab4e2a70 x13 0000005592857500 x14 00000055927b46b0 x15 0000000000000000
11-15 16:28:57.563 594 594 F DEBUG : x16 0000007fab4db6a8 x17 0000007fab49db9c x18 0000000000000001 x19 0000007fa6d0f510
11-15 16:28:57.563 594 594 F DEBUG : x20 0000007fa6d0f450 x21 0000000000000000 x22 0000000000000006 x23 0000007fa8158000
11-15 16:28:57.563 594 594 F DEBUG : x24 00000055927b4590 x25 00000055922fcb80 x26 0000005591fec930 x27 0000007fa807b000
11-15 16:28:57.563 594 594 F DEBUG : x28 00000055927babc0 x29 0000007fa6d0bb40 x30 0000007fab49b338
11-15 16:28:57.563 594 594 F DEBUG : sp 0000007fa6d0bb40 pc 0000007fab49dba4 pstate 0000000020000000
11-15 16:28:57.572 594 594 F DEBUG :
11-15 16:28:57.572 594 594 F DEBUG : backtrace:
11-15 16:28:57.572 594 594 F DEBUG : #00 pc 000000000006aba4 /system/lib64/libc.so (tgkill+8)
11-15 16:28:57.572 594 594 F DEBUG : #1 pc 0000000000068334 /system/lib64/libc.so (pthread_kill+68)
11-15 16:28:57.572 594 594 F DEBUG : #2 pc 00000000000212b8 /system/lib64/libc.so (raise+28)
11-15 16:28:57.572 594 594 F DEBUG : #3 pc 000000000001ba58 /system/lib64/libc.so (abort+60)
11-15 16:28:57.572 594 594 F DEBUG : #4 pc 0000000000438608 /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+324)
11-15 16:28:57.572 594 594 F DEBUG : #5 pc 0000000000139264 /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+3136)
11-15 16:28:57.572 594 594 F DEBUG : #6 pc 0000000000133d08 /system/lib64/libart.so (_ZN3art7BarrierD2Ev+296)
11-15 16:28:57.572 594 594 F DEBUG : #7 pc 000000000046d1f4 /system/lib64/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+212)
11-15 16:28:57.572 594 594 F DEBUG : #8 pc 00000000004386f0 /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+556)
11-15 16:28:57.573 594 594 F DEBUG : #9 pc 0000000000139264 /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+3136)
11-15 16:28:57.573 594 594 F DEBUG : #10 pc 000000000045ddc4 /system/lib64/libart.so (_ZNK3art6Thread24AssertNoPendingExceptionEv.part.181+504)
11-15 16:28:57.573 594 594 F DEBUG : #11 pc 0000000000193c78 /system/lib64/libart.so (_ZN3art11ClassLinker9FindClassEPNS_6ThreadEPKcNS_6HandleINS_6mirror11ClassLoaderEEE+48)
11-15 16:28:57.573 594 594 F DEBUG : #12 pc 0000000000197754 /system/lib64/libart.so (_ZN3art11ClassLinker11ResolveTypeERKNS_7DexFileEtNS_6HandleINS_6mirror8DexCacheEEENS4_INS5_11ClassLoaderEEE+232)
11-15 16:28:57.573 594 594 F DEBUG : #13 pc 0000000000536a78 /system/lib64/libart.so (_ZN3art11ClassLinker11ResolveTypeEtPNS_9ArtMethodE.part.67+168)
11-15 16:28:57.573 594 594 F DEBUG : #14 pc 0000000000536c2c /system/lib64/libart.so (artInitializeTypeFromCode+148)
11-15 16:28:57.573 594 594 F DEBUG : #15 pc 0000000000120c00 /system/lib64/libart.so (art_quick_initialize_type+64)
11-15 16:28:57.573 594 594 F DEBUG : #16 pc 000000000076b8e8 /data/app/ml.dmlc.tvm.tvmrpc-1/oat/arm64/base.odex (offset 0x434000)
11-15 16:28:57.812 18816 18816 I ServiceManager: Waiting for service AtCmdFwd...
11-15 16:28:57.880 1290 19522 W ActivityManager: Force finishing activity ml.dmlc.tvm.tvmrpc/.MainActivity
11-15 16:28:57.880 594 594 F DEBUG :
11-15 16:28:57.880 594 594 F DEBUG : Tombstone written to: /data/tombstones/tombstone_08
11-15 16:28:57.880 594 594 E DEBUG : AM write failed: Broken pipe
11-15 16:28:57.881 1290 1327 I BootReceiver: Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
11-15 16:28:57.944 1290 1317 V BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@f2e99ea
11-15 16:28:57.945 1290 1317 V BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@eb904db
11-15 16:28:57.978 1290 8054 I OpenGLRenderer: Initialized EGL, version 1.4
11-15 16:28:57.992 1290 4495 D GraphicsStats: Buffer count: 6
11-15 16:28:57.993 1290 4495 I WindowState: WIN DEATH: Window{8d84928 u0 ml.dmlc.tvm.tvmrpc/ml.dmlc.tvm.tvmrpc.MainActivity}
11-15 16:28:58.014 626 626 I Zygote : Process 19402 exited due to signal (6)
11-15 16:28:58.017 1290 4498 I ActivityManager: Process ml.dmlc.tvm.tvmrpc (pid 19402) has died
11-15 16:28:58.017 1290 4498 D ActivityManager: cleanUpApplicationRecord -- 19402
11-15 16:28:58.042 4532 4532 D Launcher: Broadcasting Home Idle Screen Intent ...
11-15 16:28:58.245 3953 3953 I HotspotService: handleMessage,isWifiApEnable = false
11-15 16:28:58.494 1290 1330 W WindowAnimator: Failed to dispatch window animation state change.
11-15 16:28:58.494 1290 1330 W WindowAnimator: android.os.DeadObjectException
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.os.BinderProxy.transactNative(Native Method)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.os.BinderProxy.transact(Binder.java:503)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at com.android.server.wm.WindowAnimator.access$000(WindowAnimator.java:53)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.view.Choreographer.doCallbacks(Choreographer.java:670)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.view.Choreographer.doFrame(Choreographer.java:603)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.os.Handler.handleCallback(Handler.java:739)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.os.Handler.dispatchMessage(Handler.java:95)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.os.Looper.loop(Looper.java:148)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at android.os.HandlerThread.run(HandlerThread.java:61)
11-15 16:28:58.494 1290 1330 W WindowAnimator: at com.android.server.ServiceThread.run(ServiceThread.java:46)
11-15 16:28:58.813 18816 18816 I ServiceManager: Waiting for service AtCmdFwd...
11-15 16:28:59.091 13588 13588 D wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
11-15 16:28:59.106 13588 13588 D wpa_supplicant: CTRL-DEBUG: global_ctrl_sock-sendto: sock=11 sndbuf=212992 outq=0 send_len=48
11-15 16:28:59.108 1290 3867 D ConnectivityService: updateNetworkScore for NetworkAgentInfo [WIFI () - 105] to 59
11-15 16:28:59.813 18816 18816 I ServiceManager: Waiting for service AtCmdFwd...
11-15 16:29:00.816 18816 18816 I ServiceManager: Waiting for service AtCmdFwd...
11-15 16:29:01.817 18816 18816 W Atfwd_Sendcmd: AtCmdFwd service not published, waiting... retryCnt : 4
11-15 16:29:02.115 13588 13588 D wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
11-15 16:29:02.131 13588 13588 D wpa_supplicant: CTRL-DEBUG: global_ctrl_sock-sendto: sock=11 sndbuf=212992 outq=0 send_len=48
11-15 16:29:02.132 1290 3867 D ConnectivityService: updateNetworkScore for NetworkAgentInfo [WIFI () - 105] to 55
11-15 16:29:02.731 1290 4377 E IzatSvc_PassiveLocListener: E/Exiting with error virtual void izat_manager::IzatPassiveLocationListener::onLocationChanged(const izat_manager::IzatLocation*, izat_manager::IzatLocationStatus) line 113 "1"
11-15 16:29:03.516 825 825 I MSM-irqbalance: Decided to move IRQ203 from CPU4 [P:0] to CPU1 [P:1] (banned)
11-15 16:29:05.141 13588 13588 D wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
11-15 16:29:05.157 13588 13588 D wpa_supplicant: CTRL-DEBUG: global_ctrl_sock-sendto: sock=11 sndbuf=212992 outq=0 send_len=48

@yzhliu
Copy link
Member

yzhliu commented Nov 15, 2017

in app/src/main/jni/config.mk, set USE_OPENCL = 1 and set ADD_LDLIBS to libOpenCL.so pulled from your phone.

@haolongzhangm
Copy link
Contributor Author

@Javelinjs
already config the app/src/main/jni/config.mk
zhl@pc:~/mycode/tvm/apps/android_rpc$ cat app/src/main/jni/config.mk
#-------------------------------------------------------------------------------

Template configuration for compiling

If you want to change the configuration, please use the following

steps. Assume you are on the root directory. First copy the this

file so that any local changes will be ignored by git

cp make/config.mk .

Next modify the according entries, and then compile by

./build.sh

#-------------------------------------------------------------------------------
APP_ABI = arm64-v8a

APP_PLATFORM = android-17

whether enable OpenCL during compile

USE_OPENCL = 1

the additional include headers you want to add, e.g., SDK_PATH/adrenosdk/Development/Inc

ADD_C_INCLUDES = /media/zhl/second/code/android-ndk-r14b/platforms/android-21/arch-arm64/usr/include

the additional link libs you want to add, e.g., ANDROID_LIB_PATH/libOpenCL.so

ADD_LDLIBS = /media/zhl/second/code/android-ndk-r14b/platforms/android-21/arch-arm64/usr/lib/libOpenCL.so

@haolongzhangm
Copy link
Contributor Author

more info:
zhl@pc:~/mycode/tvm/apps/android_rpc$ readelf -d ./app/src/main/libs/arm64-v8a/libtvm4j_runtime_packed.so

Dynamic section at offset 0x13a8c0 contains 30 entries:
标记 类型 名称/值
0x0000000000000001 (NEEDED) 共享库:[liblog.so]
0x0000000000000001 (NEEDED) 共享库:[libOpenCL.so]
0x0000000000000001 (NEEDED) 共享库:[libc.so]
0x0000000000000001 (NEEDED) 共享库:[libm.so]
0x0000000000000001 (NEEDED) 共享库:[libstdc++.so]
0x0000000000000001 (NEEDED) 共享库:[libdl.so]
0x000000000000000e (SONAME) Library soname: [libtvm4j_runtime_packed.so]
0x0000000000000019 (INIT_ARRAY) 0x1442e8
0x000000000000001b (INIT_ARRAYSZ) 56 (bytes)
0x000000000000001a (FINI_ARRAY) 0x144320
0x000000000000001c (FINI_ARRAYSZ) 16 (bytes)
0x0000000000000004 (HASH) 0x1f0
0x0000000000000005 (STRTAB) 0x10420
0x0000000000000006 (SYMTAB) 0x4258
0x000000000000000a (STRSZ) 143703 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0x14aae0
0x0000000000000002 (PLTRELSZ) 33624 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x44768
0x0000000000000007 (RELA) 0x345e0
0x0000000000000008 (RELASZ) 65928 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x0000000000000018 (BIND_NOW)

which means already link opencl lib

@haolongzhangm
Copy link
Contributor Author

get the reason:
because my host opencl is work with cpu mode:
so I modify the code :
diff --git a/src/runtime/opencl/opencl_device_api.cc b/src/runtime/opencl/opencl_device_api.cc
index f1ddb76..e95fdda 100644
--- a/src/runtime/opencl/opencl_device_api.cc
+++ b/src/runtime/opencl/opencl_device_api.cc
@@ -195,7 +195,7 @@ void OpenCLWorkspace::Init() {
LOG(INFO) << "Initialize OpenCL platform '"
<< cl::GetPlatformInfo(this->platform_id, CL_PLATFORM_NAME) << ''';
std::vector<cl_device_id> devices_matched =

  •  cl::GetDeviceIDs(this->platform_id, "gpu");
    
  •  cl::GetDeviceIDs(this->platform_id, "cpu");
    

but my phone opencl is gpu mode, so
tvm/src/runtime/opencl/opencl_device_api.cc code will retrun null on phone env,

so how to compat this case, PC env opencl with cpu mode, and phone opencl is GPU mode

@haolongzhangm
Copy link
Contributor Author

diff --git a/src/runtime/opencl/opencl_device_api.cc b/src/runtime/opencl/opencl_device_api.cc
index e95fdda..7f34938 100644
--- a/src/runtime/opencl/opencl_device_api.cc
+++ b/src/runtime/opencl/opencl_device_api.cc
@@ -197,8 +197,13 @@ void OpenCLWorkspace::Init() {
std::vector<cl_device_id> devices_matched =
cl::GetDeviceIDs(this->platform_id, "gpu");
if (devices_matched.size() == 0) {

  • LOG(WARNING) << "No OpenCL device any device matched given the options";
  • return;
  • LOG(WARNING) << "No OpenCL device any device matched given the options: gpu mode";
  • LOG(WARNING) << "Now try OpenCL cpu mode";
  •           devices_matched = cl::GetDeviceIDs(this->platform_id, "cpu");
    
  •           if (devices_matched.size() == 0) {
    
  •                   LOG(WARNING) << "No OpenCL device any device matched given the options: cpu mode";
    
  •                   return;
    
  •           }
    
    }
    this->devices = devices_matched;
    cl_int err_code;

compat host cpu-mode opencl with device gpu-mode opencl

@haolongzhangm
Copy link
Contributor Author

#655

@yzhliu
Copy link
Member

yzhliu commented Nov 16, 2017

Also pls enable opencl when install tvm on your PC

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

No branches or pull requests

3 participants