Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
7761416f
Commit
7761416f
authored
Nov 19, 2018
by
eqy
Committed by
Tianqi Chen
Nov 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] [RPC] clean up uploaded modules (#2121)
[RPC] clean up uploaded modules
parent
83b24b5b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
0 deletions
+36
-0
python/tvm/autotvm/measure/measure_methods.py
+6
-0
python/tvm/rpc/client.py
+13
-0
src/runtime/file_util.cc
+4
-0
src/runtime/file_util.h
+6
-0
src/runtime/rpc/rpc_server_env.cc
+7
-0
No files found.
python/tvm/autotvm/measure/measure_methods.py
View file @
7761416f
...
...
@@ -467,6 +467,12 @@ def run_through_rpc(measure_input, build_result,
ctx
.
sync
()
costs
=
time_f
(
*
args
)
.
results
# clean up remote files
remote
.
remove
(
build_result
.
filename
)
remote
.
remove
(
os
.
path
.
splitext
(
build_result
.
filename
)[
0
]
+
'.so'
)
remote
.
remove
(
''
)
if
len
(
costs
)
>
2
:
# remove largest and smallest value to reduce variance
costs
=
list
(
costs
)
costs
.
sort
()
...
...
python/tvm/rpc/client.py
View file @
7761416f
...
...
@@ -103,6 +103,19 @@ class RPCSession(object):
"tvm.rpc.server.download"
)
return
self
.
_remote_funcs
[
"download"
](
path
)
def
remove
(
self
,
path
):
"""Remove file from remote temp folder.
Parameters
----------
path: str
The relative location to remote temp folder.
"""
if
"remove"
not
in
self
.
_remote_funcs
:
self
.
_remote_funcs
[
"remove"
]
=
self
.
get_function
(
"tvm.rpc.server.remove"
)
self
.
_remote_funcs
[
"remove"
](
path
)
def
load_module
(
self
,
path
):
"""Load a remote module, the file need to be uploaded first.
...
...
src/runtime/file_util.cc
View file @
7761416f
...
...
@@ -142,5 +142,9 @@ void LoadMetaDataFromFile(
fs
.
close
();
}
void
RemoveFile
(
const
std
::
string
&
file_name
)
{
std
::
remove
(
file_name
.
c_str
());
}
}
// namespace runtime
}
// namespace tvm
src/runtime/file_util.h
View file @
7761416f
...
...
@@ -71,6 +71,12 @@ void SaveMetaDataToFile(
void
LoadMetaDataFromFile
(
const
std
::
string
&
file_name
,
std
::
unordered_map
<
std
::
string
,
FunctionInfo
>*
fmap
);
/*!
* \brief Remove (unlink) a file.
* \param file_name The file name.
*/
void
RemoveFile
(
const
std
::
string
&
file_name
);
}
// namespace runtime
}
// namespace tvm
#endif // TVM_RUNTIME_FILE_UTIL_H_
src/runtime/rpc/rpc_server_env.cc
View file @
7761416f
...
...
@@ -35,5 +35,12 @@ TVM_REGISTER_GLOBAL("tvm.rpc.server.download")
*
rv
=
arr
;
});
TVM_REGISTER_GLOBAL
(
"tvm.rpc.server.remove"
)
.
set_body
([](
TVMArgs
args
,
TVMRetValue
*
rv
)
{
std
::
string
file_name
=
RPCGetPath
(
args
[
0
]);
LOG
(
INFO
)
<<
"Remove "
<<
file_name
;
RemoveFile
(
file_name
);
});
}
// namespace runtime
}
// namespace tvm
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment