def main(): if len(sys.argv) == 1: print(config.compiledir) elif len(sys.argv) == 2: if sys.argv[1] == 'help': print_help(exit_status=0) if sys.argv[1] == 'clear': # We skip the refresh on module cache creation because the refresh will # be done when calling clear afterwards. cache = get_module_cache(init_args=dict(do_refresh=False)) cache.clear(unversioned_min_age=-1, clear_base_files=True, delete_if_problem=True) # Print a warning if some cached modules were not removed, so that the # user knows he should manually delete them, or call # theano-cache purge, # to properly clear the cache. items = [ item for item in sorted(os.listdir(cache.dirname)) if item.startswith('tmp') ] if items: _logger.warning( 'There remain elements in the cache dir that you may ' 'need to erase manually. The cache dir is:\n %s\n' 'You can also call "theano-cache purge" to ' 'remove everything from that directory.' % config.compiledir) _logger.debug('Remaining elements (%s): %s' % (len(items), ', '.join(items))) elif sys.argv[1] == 'list': theano.gof.compiledir.print_compiledir_content() elif sys.argv[1] == 'cleanup': theano.gof.compiledir.cleanup() cache = get_module_cache(init_args=dict(do_refresh=False)) cache.clear_old() elif sys.argv[1] == 'unlock': theano.gof.compilelock.force_unlock() print('Lock successfully removed!') elif sys.argv[1] == 'purge': theano.gof.compiledir.compiledir_purge() elif sys.argv[1] == 'basecompiledir': # Simply print the base_compiledir print(theano.config.base_compiledir) else: print_help(exit_status=1) elif len(sys.argv) == 3 and sys.argv[1] == 'basecompiledir': if sys.argv[2] == 'list': theano.gof.compiledir.basecompiledir_ls() elif sys.argv[2] == 'purge': theano.gof.compiledir.basecompiledir_purge() else: print_help(exit_status=1) else: print_help(exit_status=1)
def main(): if len(sys.argv) == 1: print(config.compiledir) elif len(sys.argv) == 2: if sys.argv[1] == 'help': print_help(exit_status=0) if sys.argv[1] == 'clear': # We skip the refresh on module cache creation because the refresh will # be done when calling clear afterwards. cache = get_module_cache(init_args=dict(do_refresh=False)) cache.clear(unversioned_min_age=-1, clear_base_files=True, delete_if_problem=True) # Print a warning if some cached modules were not removed, so that the # user knows he should manually delete them, or call # theano-cache purge, # to properly clear the cache. items = [item for item in sorted(os.listdir(cache.dirname)) if item.startswith('tmp')] if items: _logger.warning( 'There remain elements in the cache dir that you may ' 'need to erase manually. The cache dir is:\n %s\n' 'You can also call "theano-cache purge" to ' 'remove everything from that directory.' % config.compiledir) _logger.debug('Remaining elements (%s): %s' % (len(items), ', '.join(items))) elif sys.argv[1] == 'list': theano.gof.compiledir.print_compiledir_content() elif sys.argv[1] == 'cleanup': theano.gof.compiledir.cleanup() cache = get_module_cache(init_args=dict(do_refresh=False)) cache.clear_old() elif sys.argv[1] == 'unlock': theano.gof.compilelock.force_unlock() print('Lock successfully removed!') elif sys.argv[1] == 'purge': theano.gof.compiledir.compiledir_purge() elif sys.argv[1] == 'basecompiledir': # Simply print the base_compiledir print(theano.config.base_compiledir) else: print_help(exit_status=1) elif len(sys.argv) == 3 and sys.argv[1] == 'basecompiledir': if sys.argv[2] == 'list': theano.gof.compiledir.basecompiledir_ls() elif sys.argv[2] == 'purge': theano.gof.compiledir.basecompiledir_purge() else: print_help(exit_status=1) else: print_help(exit_status=1)
OpRemove, OpSub, PatternSub, SeqOptimizer, TopoOptimizer, inplace_optimizer, local_optimizer, optimizer, ) from theano.gof.optdb import DB, EquilibriumDB, LocalGroupDB, ProxyDB, Query, SequenceDB from theano.gof.params_type import Params, ParamsType from theano.gof.toolbox import ( Bookkeeper, Feature, History, NodeFinder, NoOutputFromInplace, PrintListener, ReplacementDidNotRemoveError, ReplaceValidate, Validator, ) from theano.gof.type import CEnumType, EnumList, EnumType, Generic, Type, generic from theano.gof.utils import MethodNotDefined, hashtype, object2 if theano.config.cmodule__preload_cache: from theano.gof.cc import get_module_cache get_module_cache()