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

Expose Linux libc interop #7

Open
HadrienG2 opened this issue Feb 16, 2023 · 3 comments
Open

Expose Linux libc interop #7

HadrienG2 opened this issue Feb 16, 2023 · 3 comments
Labels
api coverage Feature-parity with the underlying hwloc API enhancement New feature or request help wanted Extra attention is needed

Comments

@HadrienG2
Copy link
Owner

HadrienG2 commented Feb 16, 2023

Expose libc::sched_(get|set)affinity interoperability behind suitable cfg flags with associated doc(cfg)/cfg(doc): https://hwloc.readthedocs.io/en/v2.9/group__hwlocality__glibc__sched.html

@HadrienG2 HadrienG2 added enhancement New feature or request api coverage Feature-parity with the underlying hwloc API labels Feb 16, 2023
@HadrienG2
Copy link
Owner Author

HadrienG2 commented Feb 22, 2023

That actually looks quite Linux specific. Also, at the time of writing, there is no safe way to create a libc::cpu_set_t, which means that interfacing hwloc_cpuset_to_glibc_sched_affinity() would require some use of MaybeUninit.

@HadrienG2 HadrienG2 changed the title Expose glibc interop Expose Linux libc interop Feb 22, 2023
@HadrienG2
Copy link
Owner Author

HadrienG2 commented Feb 22, 2023

Ah, well, I see, the issue is that the cpu_set_t of one libc may theoretically not match that of another libc. Then indeed, we need cfg(all(target_os = "linux", target_env = "gnu"))

@HadrienG2
Copy link
Owner Author

Unfortunately, with the libc crate in its current state, it is not possible to implement this, because the hwloc functions are static functions (so we need to rewrite them in the rust bindings), and the libc crate 1/does not seem to allow safely creating a cpu_set_t and 2/expects &mut cpu_set_t in all functions that manipulate cpusets.

@HadrienG2 HadrienG2 added the help wanted Extra attention is needed label Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api coverage Feature-parity with the underlying hwloc API enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant