【发布时间】:2020-10-10 21:19:28
【问题描述】:
我希望在 C++ 中有效地实现 KL Divergence。 (目前仅限 CPU)。
与 AES 或 FTT(快速傅立叶变换)非常相似,使用通用函数可以实现硬件级别的优化(Intel AES 和 Intel FTT)。 自然对数是否有类似的东西,或者稍微更高级别的效率 (ASM/C) 可以防止成功执行许多自然对数功能的瓶颈(如果存在)?
相同的用例示例:
.Many parallel and independent node executions; each one performing 20~ KL calculations from localized (not shared or pointer reffed) memory.
.Scheduled KL: executing in stepped-parallel where the hardware is setup expecting uses of for example tables (assuming tables are used at this lower level - AES implement ions indicated this is a high probability) .
我找到了一个可能的候选人,但我不确定:ALTFP_LOG
【问题讨论】:
-
您希望日志的准确度如何?存在准确性/速度权衡,特别是如果您使用 SSE/AVX 内部函数手动实现日志
-
我只需要大约 6dp。根本不需要双精度。 KL 将用于估计信号之间差异的稳定性。这个想法是,如果该值达到最小值/最大值,则可能需要调整所需的分辨率(U 形曲线与使用频率)。
标签: c++ performance math