Add hybrid compilation mode to exclude <hwloc.h> from global includes#210
Open
solbjorn wants to merge 1 commit intotzcnt:mainfrom
Open
Add hybrid compilation mode to exclude <hwloc.h> from global includes#210solbjorn wants to merge 1 commit intotzcnt:mainfrom
<hwloc.h> from global includes#210solbjorn wants to merge 1 commit intotzcnt:mainfrom
Conversation
When TMC is used project-wide and header-only, and TMC_USE_HWLOC is defined, <hwloc.h> gets included to every file due to inclusion of .ipp files. This might be unwanted for several reasons: a) the entire project and its subprojects need to have the hwloc include folder in their include paths; b) on Windows, <hwloc.h> unconditionally includes <windows.h>, and including this file globally is a bad practice (it's overbloated, can provoke different symbol conflicts etc.). Add a hybrid compilation mode, TMC_STANDALONE_COMPILATION_HWLOC. In this mode, one still needs to create an implementation file and define TMC_IMPL there, but only the .ipp files which include <hwloc.h> will be included and compiled there. The rest of TMC will still be header-only, so that most of potential performance gains remains. This mode only introduce changes when TMC_USE_HWLOC is defined and TMC_WINDOWS_DLL is not. The latter requires a full standalone implementation, while without the former no files include <hwloc.h>, so that it's pointless to make anything non-header-only. The default behaviour remains the same as before the change. This mode might be improved furtherly in future by isolating the functions which use/need <hwloc.h> to separate .ipp files. Big implementation files like ex_cpu.ipp could be then inlined more aggressively. Signed-off-by: Alexander Lobakin <alobakin@mailbox.org>
<hwloc.h> from global includes
Owner
|
Sorry for the late reply. I'm still thinking about how to handle the build system overall, given the variety of different requests lately |
Contributor
Author
Adding TMC to awesome-cpp and awesome-hpp brought its fruits ;) Great to see increasing interest in your library, well deserved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When TMC is used project-wide and header-only, and
TMC_USE_HWLOCis defined,<hwloc.h>gets included to every file due to inclusion of.ippfiles.This might be unwanted for several reasons:
<hwloc.h>unconditionally includes<windows.h>, and including this file globally is a bad practice (it's overbloated, can provoke different symbol conflicts etc.).Add a hybrid compilation mode,
TMC_STANDALONE_COMPILATION_HWLOC. In this mode, one still needs to create an implementation file and defineTMC_IMPLthere, but only the .ipp files which include<hwloc.h>will be included and compiled there. The rest of TMC will still be header-only, so that most of potential performance gains remains.This mode only introduce changes when
TMC_USE_HWLOCis defined andTMC_WINDOWS_DLLis not. The latter requires a full standalone implementation, while without the former no files include<hwloc.h>, so that it's pointless to make anything non header-only. The default behaviour remains the same as before the change.This mode might be improved furtherly in future by isolating the functions which use/need
<hwloc.h>to separate .ipp files. Big implementation files likeex_cpu.ippcould be then inlined more aggressively.