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

Precompiled Header Support #858

Open
SimeonEhrig opened this issue Oct 14, 2019 · 8 comments
Open

Precompiled Header Support #858

SimeonEhrig opened this issue Oct 14, 2019 · 8 comments
Labels
Type:Enhancement Type:Install installation & packaging

Comments

@SimeonEhrig
Copy link
Member

Precompiled headers can reduce compilation time. It works like object files for cpp files. In special cases, templates should be accelerated because a compiled version of the generic template is stored in the precompiled header. Theoretically, it should reduce compilation time. Practically, I'm not sure, so someone has to test it.

CMake 3.16 supports PCH, so testing and integration should not be too difficult.

Implementation details:
https://clang.llvm.org/docs/PCHInternals.html
https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
https://docs.microsoft.com/en-us/cpp/build/creating-precompiled-header-files?view=vs-2019
https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-pch

@sbastrakov
Copy link
Member

An earlier investigation of precompiled headers for alpaka: #383

@ax3l
Copy link
Member

ax3l commented Oct 15, 2019

Yes, but CMake's 3.16 support for PCH is very different from cotire, according to one CMake maintainers. Definitely worth trying again, especially since we already do unity builds anyway.

@ax3l ax3l added Type:Enhancement Type:Install installation & packaging labels Oct 15, 2019
@SimeonEhrig
Copy link
Member Author

Sounds good to me. Unfortunately, I'm not really familiar with CMake. I presented the idea of PCH in a meeting a few weeks earlier and checked if an implementation with CMake 3.16 could be useful. But if you say it could work, it's fine with me :-)

@ax3l
Copy link
Member

ax3l commented Oct 16, 2019

I think we just need to add selected headers to our CMake target(s), as described here:
https://cmake.org/cmake/help/v3.16/command/target_precompile_headers.html#command:target_precompile_headers

@j-stephan
Copy link
Member

j-stephan commented Feb 25, 2020

Since this will likely be the next step of the efforts in #919: Which headers would we want to precompile? All of them? A subset? User's choice (= precompile individual concepts)?

Since Alpaka is installable: Should there also be an option to install PCHs? As far as I understand they would be limited to a specific compiler. It might be more sensible to generate PCHs on the fly for the user's target.

@BenjaminW3
Copy link
Member

I do not think that installing precompiled headers is useful.
We are not even sure that PCH will be useful for alpaka at all but we can only find out once we added support for it. I think we should be able to have all headers (so alpaka.hpp) as PCH.

@bernhardmgruber
Copy link
Member

I think precompiled headers will become obsolete in C++20, because we can just import <alpaka>.

@SimeonEhrig
Copy link
Member Author

I think precompiled headers will become obsolete in C++20, because we can just import <alpaka>.

That's correct, but I think it will take some time, until we can move to c++ modules. Therefore, I think it is still useful to test PCH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type:Enhancement Type:Install installation & packaging
Projects
None yet
Development

No branches or pull requests

6 participants