diff --git a/python_module/megengine/_internal/persistent_cache.py b/python_module/megengine/_internal/persistent_cache.py index cbd0027f67874ceff417af25e28f4d231f082e24..47da6637d9b8ab0f6106006ba3e0ab53dad48935 100644 --- a/python_module/megengine/_internal/persistent_cache.py +++ b/python_module/megengine/_internal/persistent_cache.py @@ -60,14 +60,7 @@ class PersistentCacheOnServer(_PersistentCache): def _conn(self): """get redis connection""" if self._cached_conn is None: - try: - self._cached_conn = self.make_redis_conn() - except Exception as exc: - get_logger().error( - "failed to connect to cache server: {!r}; fallback to " - "in-memory cache".format(exc) - ) - self._cached_conn = _FakeRedisConn() + self._cached_conn = _FakeRedisConn() self._prefix = self.make_user_prefix() return self._cached_conn @@ -76,14 +69,6 @@ class PersistentCacheOnServer(_PersistentCache): def make_user_prefix(cls): return "mgbcache:{}".format(getpass.getuser()) - @classmethod - def make_redis_conn(cls): - import redis - - conn = redis.StrictRedis( - 'localhost', 6381, - socket_connect_timeout=2, socket_timeout=1) - return conn def _make_key(self, category, key): prefix_with_version = "{}:MGB{}".format(self._prefix, __version__) @@ -103,31 +88,3 @@ class PersistentCacheOnServer(_PersistentCache): return self._prev_get_refkeep -def _clean(): - match = PersistentCacheOnServer.make_user_prefix() + "*" - conn = PersistentCacheOnServer.make_redis_conn() - cursor = 0 - nr_del = 0 - while True: - cursor, values = conn.scan(cursor, match) - if values: - conn.delete(*values) - nr_del += len(values) - if not cursor: - break - - print("{} cache entries deleted".format(nr_del)) - - -def main(): - parser = argparse.ArgumentParser(description="manage persistent cache") - subp = parser.add_subparsers(description="action to be performed", dest="cmd") - subp.required = True - subp_clean = subp.add_parser("clean", help="clean all the cache of current user") - subp_clean.set_defaults(action=_clean) - args = parser.parse_args() - args.action() - - -if __name__ == "__main__": - main() diff --git a/python_module/test/integration/test_fastrun.py b/python_module/test/integration/test_fastrun.py new file mode 100644 index 0000000000000000000000000000000000000000..8cce8c5930100aa62df17cf78628ead5d2990871 --- /dev/null +++ b/python_module/test/integration/test_fastrun.py @@ -0,0 +1,12 @@ +import numpy as np + +import megengine as mge +from megengine.functional.debug_param import set_conv_execution_strategy +from megengine.module.conv import Conv2d + + +def test_fastrun(): + set_conv_execution_strategy("PROFILE") + x = Conv2d(1, 1, kernel_size=1, bias=True) + a = mge.tensor(np.random.randn(1, 1, 1, 1).astype(np.float32)) + a = x(a)