File tree Expand file tree Collapse file tree 5 files changed +61
-6
lines changed Expand file tree Collapse file tree 5 files changed +61
-6
lines changed Original file line number Diff line number Diff line change @@ -251,11 +251,12 @@ if(LINUX)
251251
252252 set_tests_properties (${EXAMPLE_NAME} PROPERTIES
253253 SKIP_RETURN_CODE ${UMF_TEST_SKIP_RETURN_CODE} )
254- set (EXAMPLE_NAME umf_example_file_provider)
254+
255+ set (EXAMPLE_NAME umf_example_custom_file_provider)
255256
256257 add_umf_executable(
257258 NAME ${EXAMPLE_NAME}
258- SRCS custom_provider/file_provider .c
259+ SRCS custom_file_provider/custom_file_provider .c
259260 LIBS umf ${LIBHWLOC_LIBRARIES} )
260261
261262 target_include_directories (
Original file line number Diff line number Diff line change 1+ # Copyright (C) 2024 Intel Corporation
2+ # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+ cmake_minimum_required (VERSION 3.14.0 FATAL_ERROR)
6+ project (umf_example_custom_file_provider LANGUAGES C)
7+ enable_testing ()
8+
9+ set (UMF_EXAMPLE_DIR "${CMAKE_SOURCE_DIR} /.." )
10+ list (APPEND CMAKE_MODULE_PATH "${UMF_EXAMPLE_DIR} /cmake" )
11+ message (STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} " )
12+
13+ find_package (PkgConfig)
14+ pkg_check_modules(LIBUMF libumf)
15+ if (NOT LIBUMF_FOUND)
16+ find_package (LIBUMF REQUIRED libumf)
17+ endif ()
18+
19+ pkg_check_modules(LIBHWLOC hwloc>=2.3.0)
20+ if (NOT LIBHWLOC_FOUND)
21+ find_package (LIBHWLOC 2.3.0 REQUIRED hwloc)
22+ endif ()
23+
24+ pkg_check_modules(TBB tbb)
25+ if (NOT TBB_FOUND)
26+ find_package (TBB REQUIRED tbb)
27+ endif ()
28+
29+ # build the example
30+ set (EXAMPLE_NAME umf_example_custom_file_provider)
31+ add_executable (${EXAMPLE_NAME} custom_file_provider.c)
32+ target_include_directories (${EXAMPLE_NAME} PRIVATE ${LIBUMF_INCLUDE_DIRS} )
33+ target_link_directories (${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS} )
34+ target_link_libraries (${EXAMPLE_NAME} PRIVATE ${LIBUMF_LIBRARIES}
35+ ${LIBHWLOC_LIBRARIES} )
36+
37+ add_test (
38+ NAME ${EXAMPLE_NAME}
39+ COMMAND ${EXAMPLE_NAME}
40+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
41+
42+ set_tests_properties (${EXAMPLE_NAME} PROPERTIES LABELS "example-standalone" )
43+
44+ if (LINUX)
45+ # set LD_LIBRARY_PATH
46+ set_property (
47+ TEST ${EXAMPLE_NAME}
48+ PROPERTY
49+ ENVIRONMENT_MODIFICATION
50+ "LD_LIBRARY_PATH=path_list_append:${LIBUMF_LIBRARY_DIRS} ;LD_LIBRARY_PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} "
51+ )
52+ endif ()
File renamed without changes.
Original file line number Diff line number Diff line change 127127Custom memory provider
128128==============================================================================
129129
130- You can find the full examples code in the `examples/custom_provider/file_provider .c `_ file
130+ You can find the full examples code in the `examples/custom_file_provider/custom_file_provider .c `_ file
131131in the UMF repository.
132132
133133TODO
@@ -212,7 +212,7 @@ the :any:`umfCloseIPCHandle` function is called.
212212.. _examples/level_zero_shared_memory/level_zero_shared_memory.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/level_zero_shared_memory/level_zero_shared_memory.c
213213.. _examples/cuda_shared_memory/cuda_shared_memory.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/cuda_shared_memory/cuda_shared_memory.c
214214.. _examples/ipc_level_zero/ipc_level_zero.c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/ipc_level_zero/ipc_level_zero.c
215- .. _examples/custom_provider/file_provider .c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/custom_provider/file_provider .c
215+ .. _examples/custom_file_provider/custom_file_provider .c : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/custom_file_provider/custom_file_provider .c
216216.. _examples/memspace : https://github.com/oneapi-src/unified-memory-framework/blob/main/examples/memspace/
217217.. _README : https://github.com/oneapi-src/unified-memory-framework/blob/main/README.md#memory-pool-managers
218218.. _umf/ipc.h : https://github.com/oneapi-src/unified-memory-framework/blob/main/include/umf/ipc.h
Original file line number Diff line number Diff line change @@ -494,13 +494,15 @@ if(LINUX
494494 OR UMF_USE_UBSAN
495495 OR UMF_USE_TSAN
496496 OR UMF_USE_MSAN))
497+
497498 set (EXAMPLES "" )
499+
498500 if (UMF_POOL_SCALABLE_ENABLED)
499- set (EXAMPLES ${EXAMPLES} basic)
501+ set (EXAMPLES ${EXAMPLES} basic custom_file_provider )
500502 else ()
501503 message (
502504 STATUS
503- "The basic example requires TBB to be installed and added to the default library search path - skipping"
505+ "The basic and custom_file_provider examples require TBB to be installed and added to the default library search path - skipping"
504506 )
505507 endif ()
506508
You can’t perform that action at this time.
0 commit comments