简体   繁体   中英

Efficient Kullback–Leibler calculation

I am looking to implement KL Divergence in C++ efficiently. (CPU Only for now).

Much like AES or FTT (Fast Fourier transform) whereby use of a common function has lead to hardware level optimizations ( Intel AES and Intel FTT ). Is there anything similar for natural log, or slightly higher level efficiencies (ASM/C) that prevent bottlenecks of executing many Natural log functions in success (If they exist)?

Same use case examples:

.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) .

I have found a possible candiate, but I'm unsure: ALTFP_LOG

You can use SSE instructions to calculate the logarithm of many values in parallel. But whether you can actually make use of those instructions depends heavily on how the rest of the calculations you are going to do depend on the logarithms you calculate, so it is not possible to give a more specific answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM