You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "wrongtest-intellif (via GitHub)" <gi...@apache.org> on 2023/08/16 10:55:37 UTC
[GitHub] [tvm] wrongtest-intellif commented on a diff in pull request #15537: [CPP_RPC] export listdir for RPC
wrongtest-intellif commented on code in PR #15537:
URL: https://github.com/apache/tvm/pull/15537#discussion_r1295723229
##########
python/tvm/rpc/client.py:
##########
@@ -145,6 +145,18 @@ def remove(self, path):
self._remote_funcs["remove"] = self.get_function("tvm.rpc.server.remove")
self._remote_funcs["remove"](path)
+ def listdir(self, path):
+ """ls files from remote temp folder.
+
+ Parameters
+ ----------
+ path: str
+ The relative location to remote temp folder.
Review Comment:
It would be great to describe the return type and split token.
##########
apps/cpp_rpc/rpc_env.cc:
##########
@@ -72,6 +72,13 @@ namespace runtime {
*/
void CleanDir(const std::string& dirname);
+/*!
+ * \brief ListDir get the list of files in a directory
+ * \param dirname The root directory name
+ * \return vector Files in directory.
+ */
+std::vector<std::string> ListDir(const std::string& dirname);
Review Comment:
Is the implementation missing?
##########
apps/cpp_rpc/rpc_env.cc:
##########
@@ -123,6 +130,15 @@ RPCEnv::RPCEnv(const std::string& wd) {
*rv = this->GetPath(args[0]);
});
+ TVM_REGISTER_GLOBAL("tvm.rpc.server.listdir").set_body([this](TVMArgs args, TVMRetValue* rv) {
+ std::string dir = this->GetPath(args[0]);
+ std::string ret;
+ for (auto d : ListDir(dir)) {
+ ret.append(d.append(","));
Review Comment:
Could we use ostringstream here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org