Skip to content

Conversation

@fantasyRqg
Copy link
Contributor

@fantasyRqg fantasyRqg commented Feb 2, 2021

  • In cpp_rpc getcwd not work on android platform , just get "\"

relate link: https://stackoverflow.com/questions/6276933/getfilesdir-from-ndk

  • replace exit() with _exit() on subprocess in cpp_rpc

difference between exit() and _exit()

@vinx13 @tqchen

@tqchen tqchen merged commit a877d53 into apache:main Mar 10, 2021
@tqchen
Copy link
Member

tqchen commented Mar 10, 2021

Thank you @fantasyRqg !

Comment on lines +89 to +95
#if defined(ANDROID) || defined(__ANDROID__)
char cwd[PATH_MAX];
auto cmdline = fopen("/proc/self/cmdline", "r");
fread(cwd, 1, sizeof(cwd), cmdline);
fclose(cmdline);
base_ = "/data/data/" + std::string(cwd) + "/cache/rpc";
#elif !defined(_WIN32)
Copy link
Contributor

@csullivan csullivan Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has the effect of now requiring a user to provide a target path to RPCSession.upload(..., target=path), when running from /data/local/tmp for example. Without providing the target path, the /data/data prefix is always prepended resulting in errors like:

   Check failed: !fs.fail() == false: Cannot open /data/data//data/local/tmp/tvm_rpc/cache/rpc/dev_lib_cl.so

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@csullivan great catch, can you send a new PR to fix this problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, please allow me some time.

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* fix:getcwd not work on android platform

* replace `exit()` with `_exit()` on subprocess in `cpp_rpc`

Co-authored-by: rqg <ranqingguo318@gmail.com>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
* fix:getcwd not work on android platform

* replace `exit()` with `_exit()` on subprocess in `cpp_rpc`

Co-authored-by: rqg <ranqingguo318@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants