Skip to content

feat: python bindings for host and device memory resources#5492

Draft
paradajzblond wants to merge 5 commits into
acts-project:mainfrom
paradajzblond:memory_management
Draft

feat: python bindings for host and device memory resources#5492
paradajzblond wants to merge 5 commits into
acts-project:mainfrom
paradajzblond:memory_management

Conversation

@paradajzblond

@paradajzblond paradajzblond commented May 21, 2026

Copy link
Copy Markdown
Contributor

As discussed with krasznaa this builds on top of asalzburger #5449 and adds the resources needed in #5348

@andiwand

Copy link
Copy Markdown
Contributor

@paradajzblond the title prefix should not contain `

also using @ in the description will result in it being copied into the commit message and people will be notified by github every time the commit gets pushed somewhere

Comment thread Python/Plugins/src/TracccHost.cpp
Comment thread Python/Plugins/src/Vecmem.cpp Outdated
Comment thread Python/Plugins/CMakeLists.txt
Comment thread Python/Plugins/src/Traccc.cpp Outdated
void bind_traccc_host(py::module_& m) {
// ---- traccc types ----
py::class_<traccc::memory_resource, std::shared_ptr<traccc::memory_resource>>(
m, "TracccMemoryResource")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this the type name in Python would end up being acts.traccc.TracccMemoryResource? 🤔

It's not a black or white question, but as long as we keep the C++ type names with their current naming convention, I would prefer the Python name to be acts.traccc.memory_resource. 🤔

Comment thread Python/Plugins/src/Traccc.cpp Outdated

void bind_traccc_cuda(py::module_& m) {
py::class_<traccc::cuda::stream, std::shared_ptr<traccc::cuda::stream>>(
m, "CudaStream")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what's the conclusion here? Is it not possible to achieve a type name of acts.traccc.cuda.stream?

If not, then I would still prefer acts.traccc.cuda_stream.

But I'd really be interested in the opinion of people more experienced with pybind11 on whether we could add "additional namespaces" into these names. 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently you can do this with submodules, so will change this

@github-actions github-actions Bot added this to the next milestone May 21, 2026
@paradajzblond paradajzblond changed the title feat: python bindings for host and device memory resources feat: python bindings for host and device memory resources May 21, 2026
@sonarqubecloud

Copy link
Copy Markdown

@asalzburger

Copy link
Copy Markdown
Contributor

I have already created a
Python/Examples/src/Vecmem.cpp which does part of the job, right ?

  • should we not expand this one ?

@paradajzblond

Copy link
Copy Markdown
Contributor Author

I have already created a Python/Examples/src/Vecmem.cpp which does part of the job, right ?

  • should we not expand this one ?

We need a safe guard against building cuda components, originally I had everything in a single file because I wanted to construct composites ie you can retrieve the correct bundle of memory resources, stream and copy in a single call. However, Stefl suggested that we rather have separate files and the compilation is safeguarded by the stub mechanism, so this is where those changes come from.

@andiwand

andiwand commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

where do we stand here @paradajzblond @asalzburger ?

apart from the discussion there seem to be cmake configuration errors in the CI

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 this pull request may close these issues.

4 participants