Skip to content

Avoid building a static library for CPU target code #23

Description

@ggeorgakoudis

Offloading with target on the CPU requires creating a self-contained shared library for the CPU code. Numba lowering inserts calls to NRT or helperlib functions, which are not exported through Numba-compiled shared libraries. Additionally, we need to init the NRT memory system (NRT_MemSys_Init) to make it usable from the standalone CPU target code.

Currently, we build a static library by pulling sources from the Numba installation, insert a constructor for initialization (the memory system), and link that static library with the shared library CPU target code. Packaging a wheel pulls those sources from the specific Numba version installed at build time. This works across Numba versions because those APIs and their implementations are fairly stable, but it's not ideal.

I can think of the following alternatives:

  1. PyOMP builds the static library at JIT time instead of packaging it, pulling sources from the Numba installation. PyOMP can cache that library to avoid rebuilding for another CPU target region
  2. Numba provides a static library (or LLVM bitcode library)1 that PyOMP links at JIT time

Footnotes

  1. bitcode library will require the user to have python development headers which is not ideal

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions