-
-
Notifications
You must be signed in to change notification settings - Fork 445
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
Adding option for installing Hwloc using CMake FetchContent #6394
Conversation
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
…ows build Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
Can one of the admins verify this patch? |
Signed-off-by: Vedant <[email protected]>
@vrnimje the |
cmake/HPX_SetupHwloc.cmake
Outdated
include(FetchContent) | ||
fetchcontent_declare( | ||
HWLoc | ||
URL https://download.open-mpi.org/release/hwloc/v2.9/hwloc-2.9.3.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to keep a separate variable for HWLOC version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this?
+ set(HPX_WITH_HWLOC_VERSION "2.9")
+ set(HPX_WITH_HWLOC_RELEASE "2.9.3")
hpx_info(
- "HPX_WITH_FETCH_HWLOC=${HPX_WITH_FETCH_HWLOC}, Hwloc will be fetched using CMake's FetchContent"
+ "HPX_WITH_FETCH_HWLOC=${HPX_WITH_FETCH_HWLOC}, Hwloc v${HPX_WITH_HWLOC_RELEASE} will be fetched using CMake's FetchContent"
)
if(UNIX)
include(FetchContent)
fetchcontent_declare(
HWLoc
- URL https://download.open-mpi.org/release/hwloc/v2.9/hwloc-2.9.3.tar.gz
+ URL https://download.open-mpi.org/release/hwloc/v${HPX_WITH_HWLOC_VERSION}/hwloc-${HPX_WITH_HWLOC_RELEASE}.tar.gz
TLS_VERIFY true
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added them in e67885b
cmake/HPX_SetupHwloc.cmake
Outdated
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win64") | ||
fetchcontent_declare( | ||
HWLoc | ||
URL https://download.open-mpi.org/release/hwloc/v2.9/hwloc-win64-build-2.9.3.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, we may have to keep a separate variable for HWLOC version.
cmake/HPX_SetupHwloc.cmake
Outdated
else() | ||
fetchcontent_declare( | ||
HWLoc | ||
URL https://download.open-mpi.org/release/hwloc/v2.9/hwloc-win64-build-2.9.3.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It should be win32.
- Same as above, we may have to keep a separate variable for HWLOC version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this change and see if it doesn't fail? I am not sure how it's related to It's unrelated.free(): invalid pointer
, but it should be win32
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesYou may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation Footnotes
|
…g .dylib file Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
@hkaiser PTAL |
I have encountered an issue with the Windows build...
So I tried recreating the build on my local system (using VS 2022), and I was able to reproduce the error with the tests I am currently trying to find a solution, but any pointers are welcome.. |
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND CMAKE_SIZEOF_VOID_P | ||
EQUAL 8 | ||
) | ||
fetchcontent_declare( | ||
HWLoc | ||
URL https://download.open-mpi.org/release/hwloc/v${HPX_WITH_HWLOC_VERSION}/hwloc-win64-build-${HPX_WITH_HWLOC_RELEASE}.zip | ||
TLS_VERIFY true | ||
) | ||
if(NOT HWLoc_POPULATED) | ||
fetchcontent_populate(HWLoc) | ||
endif() | ||
set(HWLOC_ROOT | ||
"${CMAKE_BINARY_DIR}/_deps/hwloc-src" | ||
CACHE INTERNAL "" | ||
) | ||
include_directories(${HWLOC_ROOT}/include) | ||
link_directories(${HWLOC_ROOT}/lib) | ||
set(Hwloc_INCLUDE_DIR | ||
${HWLOC_ROOT}/include | ||
CACHE INTERNAL "" | ||
) | ||
set(Hwloc_LIBRARY | ||
${HWLOC_ROOT}/lib/libhwloc.dll.a | ||
CACHE INTERNAL "" | ||
) | ||
else() | ||
fetchcontent_declare( | ||
HWLoc | ||
URL https://download.open-mpi.org/release/hwloc/v${HPX_WITH_HWLOC_VERSION}/hwloc-win32-build-${HPX_WITH_HWLOC_RELEASE}.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vrnimje I am pretty sure you need
if(WIN32 OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win64" AND NOT WITH_CUSTOM_HPX)
add_custom_command(TARGET opt_bench POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${hpx_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin"
$<TARGET_FILE_DIR:opt_bench>
)
add_custom_command(TARGET opt_bench POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${HWLOC_ROOT}/bin/libhwloc-15.dll"
$<TARGET_FILE_DIR:opt_bench>
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this command in 7ac5b33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about 32Bit Windows? Do we support that here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, 32-bit Windows is also supported here:
hpx/cmake/HPX_SetupHwloc.cmake
Lines 86 to 108 in badead1
else() | |
fetchcontent_declare( | |
HWLoc | |
URL https://download.open-mpi.org/release/hwloc/v${HPX_WITH_HWLOC_VERSION}/hwloc-win32-build-${HPX_WITH_HWLOC_RELEASE}.zip | |
TLS_VERIFY true | |
) | |
if(NOT HWLoc_POPULATED) | |
fetchcontent_populate(HWLoc) | |
endif() | |
set(HWLOC_ROOT | |
"${CMAKE_BINARY_DIR}/_deps/hwloc-src" | |
CACHE INTERNAL "" | |
) | |
include_directories(${HWLOC_ROOT}/include) | |
link_directories(${HWLOC_ROOT}/lib) | |
set(Hwloc_INCLUDE_DIR | |
${HWLOC_ROOT}/include | |
CACHE INTERNAL "" | |
) | |
set(Hwloc_LIBRARY | |
${HWLOC_ROOT}/lib/libhwloc.dll.a | |
CACHE INTERNAL "" | |
) |
I have also tested it locally using
cmake -A Win32 ....
|
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
Signed-off-by: Vedant <[email protected]>
@hkaiser please approve the remaining workflows |
@hkaiser PTAL |
Signed-off-by: Vedant <[email protected]>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesYou may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@hkaiser can we please merge this? |
if(HPX_WITH_EXAMPLES) | ||
add_hpx_pseudo_target(examples) | ||
if(HPX_WITH_FETCH_HWLOC AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") | ||
add_custom_target( | ||
HwlocDLL ALL | ||
COMMAND ${CMAKE_COMMAND} -E make_directory | ||
"${CMAKE_BINARY_DIR}/$<CONFIG>/bin/" | ||
COMMAND | ||
${CMAKE_COMMAND} -E copy_if_different | ||
"${HWLOC_ROOT}/bin/libhwloc-15.dll" | ||
"${CMAKE_BINARY_DIR}/$<CONFIG>/bin/" | ||
) | ||
add_hpx_pseudo_dependencies(examples HwlocDLL) | ||
endif() | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vrnimje what happens when HPX_WITH_EXAMPLES
is not set? Please make a new PR if this is incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was only able to find examples
as a psuedo-target, to which I could add the dependency I have defined (HwlocDLL
)
Since the libhwloc-15.dll needs to be copied exactly to "${CMAKE_BINARY_DIR}/$<CONFIG>/bin/"
, and the Configuration type $<CONFIG>
is defined during the build stage, I used the above method. As far as I understand, $<CONFIG>
can only be obtained using add_custom_command
or add_custom_target
.
Is there any other mechanism to achieve this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now realise that I could directly add HwlocDLL
as a pseudo target using add_hpx_pseudo_target
. I will test it out. It works, will open another PR to correct it
Thanks for pointing this out
References #6392
Proposed Changes
HPX_WITH_FETCH_HWLOC
option for fetching Hwloc using CMake FetchContentAny background context you want to provide?
Checklist
Not all points below apply to all pull requests.