我有一个五个嵌套的 for 循环函数(通过 3d 过滤器对图像进行卷积),我迫切需要加速并非常高兴地使用了 numba 的 @autojit 装饰器。我唯一的抱怨是,当第一次调用该函数时,numba 会执行它的 autojit,但会将我认为是 jitted 函数的内部表示打印到标准输出,这可能需要几秒钟才能滚动,即像这样的东西:
empty1: ; preds = %empty
%16 = call i32 inttoptr (i64 139980888423164 to i32 ({ i64, i8* }*)*)({ i64, i8* }* %10)
br label %empty3
empty2: ; preds = %empty
br label %error_label
empty3: ; preds = %empty1
%17 = call i8* @PyErr_Occurred()
%18 = ptrtoint i8* %17 to i64
%19 = icmp ne i64 %18, 0
br i1 %19, label %empty5, label %empty4
empty4: ; preds = %empty3
%20 = call { i64, i8* }* @__numba_specialized_2___main___2E_max_pool({ i64, i8*, i8*, i32, i64*, i64*, i8*, i8*, i32, i8* }* %11, i32 %12, i32 %16)
store { i64, i8* }* %20, { i64, i8* }** %objtemp, !tbaa !6
%21 = ptrtoint { i64, i8* }* %20 to i64
%22 = icmp eq i64 %21, 0
br i1 %22, label %error_label, label %no_error
empty5: ; preds = %empty3
br label %error_label
no_error: ; preds = %empty4
%23 = load { i64, i8* }** %objtemp, !tbaa !6
store { i64, i8* }* %23, { i64, i8* }** %return_value
%24 = load { i64, i8* }** %return_value, !tbaa !6
call void @Py_XINCREF({ i64, i8* }* %24)
br label %cleanup_label
}
!tbaa = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !0, !1, !6, !0, !1, !2, !3, !4, !5, !6, !24, !12, !7, !13, !14, !15, !16, !17, !25, !0, !1, !6}
有谁知道如何禁用它?它工作正常,速度很快,并且不会抛出错误,但有点烦人。