---
title: 可替换性
description: "由于KML_FFT与MKL接口并不一致，需要根据代码逻辑替换代码，具体使用方法请参见《鲲鹏数学库 开发指南(https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2200/accel/kunpengaccel_kml_16_0001.html)》。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2200/accel/kunpengaccel_12_0017.html
sourcePath: /source/zh/kunpengboostkithistory/2200/accel/kunpengaccel_12_0017.html
indexId: 89d93f65cf1c0ef37e659a999c21798d4029bcdea7ccface14d8b9118a5c699c70
---
# 可替换性

由于KML_FFT与MKL接口并不一致，需要根据代码逻辑替换代码，具体使用方法请参见《鲲鹏数学库 开发指南(https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2200/accel/kunpengaccel_kml_16_0001.html)》。

表1为可替换的接口与MKL接口的映射关系。


**表1 FFT的替换映射关系**

| MKL接口 | KML对应接口 | 描述 |
| --- | --- | --- |
| DftiCreateDescriptor DftiSetValue DftiCommitDescriptor | kml\_fft\_plan\_dft kml\_fft\_plan\_dft\_1d kml\_fft\_plan\_dft\_2d kml\_fft\_plan\_dft\_3d kml\_fft\_plan\_dft\_c2r kml\_fft\_plan\_dft\_c2r\_1d kml\_fft\_plan\_dft\_c2r\_2d kml\_fft\_plan\_dft\_c2r\_3d kml\_fft\_plan\_dft\_r2c kml\_fft\_plan\_dft\_r2c\_1d kml\_fft\_plan\_dft\_r2c\_2d kml\_fft\_plan\_dft\_r2c\_3d kml\_fft\_plan\_guru64\_dft kml\_fft\_plan\_guru64\_dft\_c2r kml\_fft\_plan\_guru64\_dft\_r2c kml\_fft\_plan\_guru64\_r2r kml\_fft\_plan\_guru64\_split\_dft kml\_fft\_plan\_guru64\_split\_dft\_c2r kml\_fft\_plan\_guru64\_split\_dft\_r2c kml\_fft\_plan\_guru\_dft kml\_fft\_plan\_guru\_dft\_c2r kml\_fft\_plan\_guru\_dft\_r2c kml\_fft\_plan\_guru\_r2r kml\_fft\_plan\_guru\_split\_dft kml\_fft\_plan\_guru\_split\_dft\_c2r kml\_fft\_plan\_guru\_split\_dft\_r2c kml\_fft\_plan\_many\_dft kml\_fft\_plan\_many\_dft\_c2r kml\_fft\_plan\_many\_dft\_r2c kml\_fft\_plan\_many\_r2r kml\_fft\_plan\_r2r kml\_fft\_plan\_r2r\_1d kml\_fft\_plan\_r2r\_2d kml\_fft\_plan\_r2r\_3d kml\_fft\_plan\_with\_nthreads kml\_fft\_init\_threads kml\_fft\_cleanup\_threads | MKL构建FFT模型有三个步骤： DftiCreateDescriptor接口创建一个问题描述。 通过DftiSetValue接口设置对应的问题参数。 最后通过DftiCommitDescriptor完成问题创建。 KML构建问题时根据问题类型选用不同的plan接口，不同的plan接口需要不同的问题参数配置，通过参数传递给plan接口，完成问题创建。在具体迁移过程中需要单独替换。 具体可参照迁移步骤中给出的三个代码示例。 |
| DftiFreeDescriptor | kml\_fft\_destroy\_plan kml\_fft\_free | 此处为释放模型关联资源的对应接口。 |
| DftiCopyDescriptor | 无对应 | \- |
| DftiComputeForward | kml\_fft\_execute kml\_fft\_execute\_dft kml\_fft\_execute\_split\_dft kml\_fft\_execute\_dft\_r2c kml\_fft\_execute\_split\_dft\_r2c | MKL里面的C2C类问题、R2C类问题用DftiComputeForward，对应KML里面的c2c、r2c相关的执行函数。 |
| DftiComputeBackward | kml\_fft\_execute kml\_fft\_execute\_dft kml\_fft\_execute\_split\_dft kml\_fft\_execute\_dft\_c2r kml\_fft\_execute\_split\_dft\_c2 | MKL里面的C2C类问题、C2R类问题用DftiComputeBackward，对应KML里面的c2c、c2r相关的执行函数。 |
| DftiGetValue | 无对应 | \- |
| DftiErrorClass | 无对应 | \- |
| DftiErrorMessage | 无对应 | \- |
