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

Autoconf builds fails if -pthread not supported #5

Open
marshallward opened this issue Feb 16, 2024 · 1 comment
Open

Autoconf builds fails if -pthread not supported #5

marshallward opened this issue Feb 16, 2024 · 1 comment

Comments

@marshallward
Copy link
Owner

marshallward commented Feb 16, 2024

The autoconf build assumes that -pthread is always available. If for some reason it is not, then the build fails due to an unrecognized flag. This is happening on the Nvidia compiler.

It is also possible that the flag is simply named differently, perhaps just a library access, -lpthread. Need more info here.

There is also the broader issue that pthreads are not part of all stdc libraries. For example, I don't think a pedantic C99 build will work with pthreads. There is a generic POSIX threading API, which could be a fallback someday.


To clarify a bit here:

  • C99 had no threading model. Pthreads works but its presence cannot be assumed. From the name, I assume it's part of POSIX, but not every compiler is POSIX-compilant.

  • C11 introduced <threads.h> support. This is meant to be a generic threading wrapper. It does mean your code must be C11-compliant. AFAIK this almost always just maps to Pthreads.

@marshallward
Copy link
Owner Author

marshallward commented Feb 16, 2024

I looked at this a little more closely in Nvidia.

Nvidia seems to have perfectly adequate support for Pthreads. It just does not require the -pthread flag that GCC and (possibly) Intel need.

So there is no need (yet) for a dramatic generalization of the threading API. Only a test for the inclusion of the -pthread flag.

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

No branches or pull requests

1 participant