使用工具进行算子调测时,支持printf/PRINTF功能,可以打印Scalar数据。
PRINTF("1 fmt string d %d\n", 6666); PRINTF("1 fmt string lf %lf\n", float(61.556));
compile_npu_options = ascendebug.CompileNpuOptions(dump_mode='normal') name, kernel_file, extern = op_executor.compile_custom_npu(customize_path, tiling_info.tiling_key, compile_npu_options) npu_compile_info = ascendebug.NpuCompileInfo(syncall=extern['cross_core_sync'], task_ration=extern['task_ration'], dump_mode='normal') run_npu_options = ascendebug.RunNpuOptions() op_executor.run_npu(kernel_file, run_npu_options, npu_compile_info=npu_compile_info, tiling_info=tiling_info)
函数原型 |
|
|
函数功能 |
打印Scalar数据。 |
|
参数(IN) |
fmt |
格式控制字符串,包含两种类型的对象:普通字符和转换说明。
|
args |
附加参数,个数和类型可变的输出列表:根据不同的fmt字符串,函数可能需要一系列的附加参数,每个参数包含了一个要被插入的值,替换了fmt参数中指定的每个%标签。参数的个数应与%标签的个数相同。 |
|
参数(OUT) |
NA |
- |
返回值 |
NA |
- |
使用约束 |
|
|
调用示例 |
// 整型打印: printf("fmt string %d", 0x123); PRINTF("fmt string %d", 0x123); // 指针打印: int *a; printf("TEST %p", a); PRINTF("TEST %p", a); |