block_size = (int(options.block_size), int(options.block_size)) # codegen arguments processing # XXX hack try: codegen_args = eval(options.codegen_args) if not isinstance(codegen_args, dict): raise TypeError() except: print 'error: unable to parse the codegen argument' print ' please enclose the dict in double quotes' print ' raw args: >>>%s<<<'%options.codegen_args exit(1) # load codegen from blip.code.codegen import load_codegen, get_codegen_parameters # wrap_codegen commented, not in that file! from blip.code.codegen import InvalidCodegenArgumentsException module_name, _, codegen_name = options.codegen_impl.rpartition('.') codegen_impl = load_codegen(module_name, codegen_name) if not codegen_impl: print 'error: could not load codegen %s'%codegen_impl exit(1) # finally execute function main(block_size, codegen_impl, codegen_args, options.src_image, options.output) print 'interpreter finished'
help='override the codegen implementation') (options, args) = parser.parse_args() result_file = options.output block_size = (int(options.block_size), int(options.block_size)) # load codegen from blip.code.codegen import load_codegen, get_codegen_parameters from blip.code.codegen import InvalidCodegenArgumentsException # support for alternative codegen implementations codegen_implementation = options.codegen_impl if options.codegen_impl: try: module_name, _, impl_name = options.codegen_impl.rpartition('.') codegen_implementation = load_codegen(module_name, impl_name) print 'using implementation %s'%impl_name except Exception, e: print 'could not load custom implementation %s'%impl_name print 'error', str(e) exit(1) '''results = {} args = {} for mask_size in xrange(1,5,1): results2 = {} args['mask_size'] = mask_size print 'scale =', mask_size, 'mask_size =', args['mask_size'] block_size = (64, 64) analysers = run_codegen(args, block_size, codegen_implementation) analysers_dict = {}