[Solved] Problem in connecting arm target via rpc

Hi, I am trying to tune the tflite model for arm target on android device. I have installed the app for rpc connection on the device. Thing is, the device is isolated, it can’t be on any network, it is connected to the host via a USB cable. I can use adb on host to access the device. Will that app work for the scenario? What other options do I have? Thanks!

@FrozenGene, @eqy any leads on this would be fine, please help!

1 Like

In one terminal window this rpctracker is bound

python -m tvm.exec.rpc_tracker --host=0.0.0.0 --port=5353
INFO:root:If you are running ROCM/Metal, fork will cause compiler internal error. Try to launch with arg --no-fork
INFO:RPCTracker:bind to 0.0.0.0:5354

after entering the same ip: host: 0.0.0.0, port: 5354, in the android rpc app, it shows a button to stop rpc

. Coming back to the host and executing

python -m tvm.exec.query_rpc_tracker --host=0.0.0.0 --port=5354

gives

Tracker address 0.0.0.0:5354

Server List
----------------------------
server-address  key
----------------------------
----------------------------

Queue Status
---------------------------
key   total  free  pending
---------------------------
---------------------------

Why one is 5353, another is 5354?

sorry is 5354 only, 5353 was not free at the time so it automatically gave 5354. I tried to invoke it at the 5353 port but 5354 was alloted by the tracker. @FrozenGene I have updated the problem please have a look.

The current RPC app is built to use the network. Have you tried a workaround that shares a network connection with a PC, such as https://android.stackexchange.com/questions/73168/how-to-use-windows-internet-on-android-phone-through-usb-cable?

I have not tried that workaround, and I am using Linux so I should try this out right?

ans the procedure I followed for rpc was correct, right?

Yes, you should try the solution appropriate for your OS. However, make sure you enter the IP address of the machine that is running the tracker into the app—0.0.0.0 is roughly equivalent to localhost and will not work as the phone will try to connect to itself.

thanks for the reply, I will try that, but on other hand is there any other way of tuning, like without rpc, offline, or using adb protocol?

I have not tried any other method of tuning on Android phones. I suspect it may be possible to create your own “RPC server” on a PC connected to a phone, where the PC can accept a config, compile to the phone, and run the necessary commands over adb to profile the execution. However, we have not implemented this.

Another approach might be to try to run AutoTVM and measurement on the phone, but I have no idea if the required dependencies are there on Android and this will likely be extremely slow.

As of now I am not able to use internet on the android phone, but my understanding is we should be able to get both, the device and the host on the same network. For that, won’t usb tethering be enough? Even though in that case no internet access will be there on the host as well as on the device, but they will be on the same network. In this case I should be able to use 0.0.0.0 in the rpc app. But seems like I have a wrong assumption. Please comment if you have any information on this.

I do not know the details of USB tethering, but in general being on the same network is sufficient. However, ‘0.0.0.0’ typically has a special meaning, and it seems strange for two network devices to share an address.

thanks it is working now!

1 Like