Skip to content

Improve TBB integration: auto-detection, runtime check, and graceful fallback #14

@dcasbioinfo

Description

@dcasbioinfo

Hi qs2 team,
First of all, thank you for your excellent work! This package has become a core part of my daily workflow. I'd like to suggest a usability enhancement related to TBB support that could improve the installation experience and runtime transparency - especially for users working in automated environments (like myself).

Current situation
To enable TBB-based multithreading, users currently need to:

  • Ensure the TBB library is installed on their system (Linux/macOS),

  • Remember to manually pass --with-TBB at install time, and avoid using install.packages() or similar functions or automation layers, as they don’t provide a reliable way to pass custom configure flags such as --with-TBB.

  • And after installation, there's no built-in way to confirm whether TBB support was actually enabled.

In other words, these manual steps interrupt an otherwise seamless workflow.

*** Suggested improvements ***

  • Automatic detection during install
    It would be helpful if the configure script could check for TBB using pkg-config (on Linux) or brew (on macOS), and enable support by default when available. If TBB is not present, it could gracefully fall back to single-threaded mode without errors.

  • Silent runtime check
    Upon package load, it could expose an internal flag accessible for example via qs2::qopt("tbb_enabled"). This would let scripts or pipelines verify multithreading support without triggering warnings or requiring indirect checks.

  • Runtime fallback
    Additionally, if a user explicitly requests multiple threads in an environment where TBB support is disabled, the package could silently fall back to single-threaded execution. In this case, rather than throwing an error, it could issue a clear warning informing the user that multithreading is not available and execution will proceed using a single core. This avoids unnecessary runtime failures while still making the limitation visible.

Thanks again for all your work on qs2!

P.S. Automatic detection during installation could also be useful for AVX2 support!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions