def run_pass(self, state): """ Convert data-parallel computations into Parfor nodes """ # Ensure we have an IR and type information. assert state.func_ir parfor_pass = _parfor_ParforPass( state.func_ir, state.type_annotation.typemap, state.type_annotation.calltypes, state.return_type, state.typingctx, state.targetctx, state.flags.auto_parallel, state.flags, state.metadata, state.parfor_diagnostics, ) parfor_pass.run() if config.DEBUG or config.DUMP_IR: name = state.func_ir.func_id.func_qualname print(("IR DUMP: %s" % name).center(80, "-")) state.func_ir.dump() return True
def run_pass(self, state): """ Convert data-parallel computations into Parfor nodes """ # Ensure we have an IR and type information. assert state.func_ir parfor_pass = _parfor_ParforPass( state.func_ir, state.type_annotation.typemap, state.type_annotation.calltypes, state.return_type, state.typingctx, state.flags.auto_parallel, state.flags, state.parfor_diagnostics, ) parfor_pass.run() remove_dels(state.func_ir.blocks) # check the parfor pass worked and warn if it didn't has_parfor = False for blk in state.func_ir.blocks.values(): for stmnt in blk.body: if isinstance(stmnt, Parfor): has_parfor = True break else: continue break if not has_parfor: # parfor calls the compiler chain again with a string if not ( config.DISABLE_PERFORMANCE_WARNINGS or state.func_ir.loc.filename == "<string>" ): url = ( "http://numba.pydata.org/numba-doc/latest/user/" "parallel.html#diagnostics" ) msg = ( "\nThe keyword argument 'parallel=True' was specified " "but no transformation for parallel execution was " "possible.\n\nTo find out why, try turning on parallel " "diagnostics, see %s for help." % url ) warnings.warn(errors.NumbaPerformanceWarning(msg, state.func_ir.loc)) # Add reload function to initialize the parallel backend. state.reload_init.append(_reload_parfors) return True