Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue in use of boost::math::digamma on aarch64 Linux #966

Open
dslarm opened this issue Oct 16, 2024 · 2 comments · May be fixed by #968
Open

Performance issue in use of boost::math::digamma on aarch64 Linux #966

dslarm opened this issue Oct 16, 2024 · 2 comments · May be fixed by #968

Comments

@dslarm
Copy link

dslarm commented Oct 16, 2024

Due to a current default in the boost library (boostorg/math#1211) in boost::math::digamma, there is a performance hit on aarch64.

This happens on v1.10.3 of Salmon, with GNU compiler 13 on Linux aarch64.

A 4-thread quantization of one of the Salmon tutorials DRR0* series files spends ~15% of time in this routine (called within CollapsedEMOptimizer). On a larger example, we see 7% performance hit over a run that takes 1300 seconds on 4 cores. On x86 this time is small enough to be lost in the noise.

salmon quant -i athal_index -l A -1 DRR016125/DRR016125_1.fastq.gz -2 DRR016125/DRR016125_2.fastq.gz -p $threads --validateMappings -o quants/DRR016125_quant

There is a simple fix which is to ensure the CMake/Makefiles ensure salmon compiles with:
-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
or to add that to any file that brings in boost::math via adding #define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS at the start.

With that change, a 1300 second runtime drops to 1212 for the larger test case, and for the tutorial case is 48 seconds down to 40 on a 4-core r8g.xlarge (Graviton4).

Whilst Boost may fix the issue soon - it's likely that older versions of the library will be found installed for some time. It would be helpful to add this define to cmake settings, or the sources.

@rdoeffinger
Copy link

Note that I think -DBOOST_MATH_PROMOTE_DOUBLE_POLICY=false is a better option than disabling long double functions in general

@dslarm
Copy link
Author

dslarm commented Oct 16, 2024 via email

dslarm added a commit to dslarm/salmon that referenced this issue Oct 23, 2024
    Set boost options in CMakeLists.txt to not promote doubles to long doubles. Promotion
    incurs performance penalty on all platforms, and particularly aarch64.
dslarm added a commit to dslarm/salmon that referenced this issue Oct 23, 2024
    Set boost options in CMakeLists.txt to not promote doubles to long doubles. Promotion
    incurs performance penalty on all platforms, and particularly aarch64.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants