Skip to content

[usm allocator] add linking with pthreads #628

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

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
build_type: Release
compiler: {c: clang, cxx: clang++}
libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'
- os: 'ubuntu-20.04'
build_type: Release
compiler: {c: gcc-7, cxx: g++-7}

runs-on: ${{matrix.os}}

Expand All @@ -35,6 +38,11 @@ jobs:
sudo apt-get update
sudo apt-get install -y doxygen ${{matrix.compiler.c}}

- name: Install g++-7
if: matrix.compiler.cxx == 'g++-7'
run: |
sudo apt-get install -y ${{matrix.compiler.cxx}}

- name: Install pip packages
run: pip install -r third_party/requirements.txt

Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,16 @@ if(UR_ENABLE_TRACING)
set(XPTI_SOURCE_DIR ${xpti_SOURCE_DIR})
set(XPTI_DIR ${xpti_SOURCE_DIR})
set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests")

FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "sycl-nightly/20230304" "xptifw")

FetchContent_MakeAvailable(xptifw)

check_cxx_compiler_flag("-Wno-error=maybe-uninitialized" HAS_MAYBE_UNINIT)
if (HAS_MAYBE_UNINIT)
target_compile_options(xptifw PRIVATE -Wno-error=maybe-uninitialized)
endif()

set_target_properties(xptifw PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
)
Expand Down
7 changes: 7 additions & 0 deletions source/common/uma_pools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,11 @@ target_link_libraries(disjoint_pool PRIVATE
unified_memory_allocation
${PROJECT_NAME}::headers)

if (UNIX)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries(disjoint_pool PRIVATE Threads::Threads)
endif()

target_include_directories(disjoint_pool PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
4 changes: 2 additions & 2 deletions test/unified_memory_allocation/memoryPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ TEST_P(umaMultiPoolTest, memoryTracking) {
ASSERT_EQ(pool, expectedPool);
}

for (auto [ptr, _1, _2] : ptrs) {
umaFree(ptr);
for (auto p : ptrs) {
umaFree(std::get<0>(p));
}
}

Expand Down