@@ -48,6 +48,10 @@ option(UMF_BUILD_EXAMPLES "Build UMF examples" ON)
48
48
option (UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF )
49
49
option (UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF )
50
50
option (UMF_DEVELOPER_MODE "Enable additional developer checks" OFF )
51
+ option (
52
+ UMF_DISABLE_HWLOC
53
+ "Disable hwloc and UMF features requiring it (OS provider, memtargets, topology discovery)"
54
+ OFF )
51
55
option (
52
56
UMF_LINK_HWLOC_STATICALLY
53
57
"Link UMF with HWLOC library statically (supported for Linux, MacOS and Release build on Windows)"
@@ -63,10 +67,6 @@ option(UMF_USE_TSAN "Enable ThreadSanitizer checks" OFF)
63
67
option (UMF_USE_MSAN "Enable MemorySanitizer checks" OFF )
64
68
option (UMF_USE_VALGRIND "Enable Valgrind instrumentation" OFF )
65
69
option (UMF_USE_GCOV "Enable gcov support" OFF )
66
- option (
67
- UMF_DISABLE_HWLOC
68
- "Disable features that requires hwloc (OS provider, memory targets, topology discovery)"
69
- OFF )
70
70
71
71
# set UMF_PROXY_LIB_BASED_ON_POOL to one of: SCALABLE or JEMALLOC
72
72
set (KNOWN_PROXY_LIB_POOLS SCALABLE JEMALLOC )
@@ -100,16 +100,19 @@ else()
100
100
message (FATAL_ERROR "Unknown OS type" )
101
101
endif ()
102
102
103
- if (NOT DEFINED UMF_HWLOC_REPO )
104
- set (UMF_HWLOC_REPO "https://github.com/open-mpi/hwloc.git" )
105
- endif ()
103
+ if (UMF_DISABLE_HWLOC )
104
+ message (STATUS "hwloc is disabled, hence OS provider, memtargets, "
105
+ "topology discovery, examples won't be available!" )
106
+ else ()
107
+ if (NOT DEFINED UMF_HWLOC_REPO )
108
+ set (UMF_HWLOC_REPO "https://github.com/open-mpi/hwloc.git" )
109
+ endif ()
106
110
107
- if (NOT DEFINED UMF_HWLOC_TAG )
108
- set (UMF_HWLOC_TAG hwloc-2.10.0 )
109
- endif ()
111
+ if (NOT DEFINED UMF_HWLOC_TAG )
112
+ set (UMF_HWLOC_TAG hwloc-2.10.0 )
113
+ endif ()
110
114
111
- if (NOT UMF_LINK_HWLOC_STATICALLY )
112
- if (NOT UMF_DISABLE_HWLOC )
115
+ if (NOT UMF_LINK_HWLOC_STATICALLY )
113
116
pkg_check_modules (LIBHWLOC hwloc>=2.3.0 )
114
117
if (NOT LIBHWLOC_FOUND )
115
118
find_package (LIBHWLOC 2.3.0 REQUIRED hwloc )
@@ -119,86 +122,83 @@ if(NOT UMF_LINK_HWLOC_STATICALLY)
119
122
set (DLL_PATH_LIST
120
123
"${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin"
121
124
)
122
- endif ()
123
- # add PATH to DLL on Windows
124
- set (DLL_PATH_LIST
125
- "${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin"
126
- )
127
- elseif (WINDOWS AND NOT UMF_DISABLE_HWLOC )
128
- include (FetchContent )
129
- set (HWLOC_ENABLE_TESTING OFF )
130
- set (HWLOC_SKIP_LSTOPO ON )
131
- set (HWLOC_SKIP_TOOLS ON )
132
-
133
- message (STATUS "Will fetch hwloc from ${UMF_HWLOC_REPO} " )
134
-
135
- FetchContent_Declare (
136
- hwloc_targ
137
- GIT_REPOSITORY ${UMF_HWLOC_REPO}
138
- GIT_TAG ${UMF_HWLOC_TAG}
139
- SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS )
140
-
141
- FetchContent_GetProperties (hwloc_targ )
142
- if (NOT hwloc_targ_POPULATED )
143
- FetchContent_MakeAvailable (hwloc_targ )
144
- endif ()
125
+ elseif (WINDOWS )
126
+ include (FetchContent )
127
+ set (HWLOC_ENABLE_TESTING OFF )
128
+ set (HWLOC_SKIP_LSTOPO ON )
129
+ set (HWLOC_SKIP_TOOLS ON )
130
+
131
+ message (
132
+ STATUS
133
+ "Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG} )"
134
+ )
145
135
146
- set (LIBHWLOC_INCLUDE_DIRS
147
- ${hwloc_targ_SOURCE_DIR} /include;${hwloc_targ_BINARY_DIR}/include )
148
- set (LIBHWLOC_LIBRARY_DIRS
149
- ${hwloc_targ_BINARY_DIR} /Release;${hwloc_targ_BINARY_DIR}/Debug )
136
+ FetchContent_Declare (
137
+ hwloc_targ
138
+ GIT_REPOSITORY ${UMF_HWLOC_REPO}
139
+ GIT_TAG ${UMF_HWLOC_TAG}
140
+ SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS )
150
141
151
- message (STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES} " )
152
- message (STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS} " )
153
- message (STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS} " )
154
- elseif (NOT UMF_DISABLE_HWLOC )
155
- include (FetchContent )
156
- message (STATUS "Will fetch hwloc from ${UMF_HWLOC_REPO} " )
157
-
158
- FetchContent_Declare (
159
- hwloc_targ
160
- GIT_REPOSITORY ${UMF_HWLOC_REPO}
161
- GIT_TAG ${UMF_HWLOC_TAG} )
162
-
163
- FetchContent_GetProperties (hwloc_targ )
164
- if (NOT hwloc_targ_POPULATED )
165
- FetchContent_MakeAvailable (hwloc_targ )
166
- endif ()
142
+ FetchContent_GetProperties (hwloc_targ )
143
+ if (NOT hwloc_targ_POPULATED )
144
+ FetchContent_MakeAvailable (hwloc_targ )
145
+ endif ()
167
146
168
- add_custom_command (
169
- COMMAND ./autogen.sh
170
- WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
171
- OUTPUT ${hwloc_targ_SOURCE_DIR} /configure )
172
- add_custom_command (
173
- COMMAND
174
- ./configure --prefix=${hwloc_targ_BINARY_DIR} --enable-static=yes
175
- --enable-shared=no --disable-libxml2 --disable-levelzero
176
- --disable-opencl --disable-cuda --disable-nvml CFLAGS=-fPIC
177
- CXXFLAGS=-fPIC
178
- WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
179
- OUTPUT ${hwloc_targ_SOURCE_DIR} /Makefile
180
- DEPENDS ${hwloc_targ_SOURCE_DIR} /configure )
181
- add_custom_command (
182
- COMMAND make
183
- WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
184
- OUTPUT ${hwloc_targ_SOURCE_DIR} /lib/libhwloc.la
185
- DEPENDS ${hwloc_targ_SOURCE_DIR} /Makefile )
186
- add_custom_command (
187
- COMMAND make install
188
- WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
189
- OUTPUT ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a
190
- DEPENDS ${hwloc_targ_SOURCE_DIR} /lib/libhwloc.la )
191
-
192
- add_custom_target (hwloc_prod
193
- DEPENDS ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
194
- add_library (hwloc INTERFACE )
195
- target_link_libraries (hwloc
196
- INTERFACE ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
197
- add_dependencies (hwloc hwloc_prod )
198
-
199
- set (LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR} /lib )
200
- set (LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR} /include )
201
- set (LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
147
+ set (LIBHWLOC_INCLUDE_DIRS
148
+ ${hwloc_targ_SOURCE_DIR} /include;${hwloc_targ_BINARY_DIR}/include )
149
+ set (LIBHWLOC_LIBRARY_DIRS
150
+ ${hwloc_targ_BINARY_DIR} /Release;${hwloc_targ_BINARY_DIR}/Debug )
151
+ else ()
152
+ include (FetchContent )
153
+ message (
154
+ STATUS
155
+ "Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG} )"
156
+ )
157
+
158
+ FetchContent_Declare (
159
+ hwloc_targ
160
+ GIT_REPOSITORY ${UMF_HWLOC_REPO}
161
+ GIT_TAG ${UMF_HWLOC_TAG} )
162
+
163
+ FetchContent_GetProperties (hwloc_targ )
164
+ if (NOT hwloc_targ_POPULATED )
165
+ FetchContent_MakeAvailable (hwloc_targ )
166
+ endif ()
167
+
168
+ add_custom_command (
169
+ COMMAND ./autogen.sh
170
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
171
+ OUTPUT ${hwloc_targ_SOURCE_DIR} /configure )
172
+ add_custom_command (
173
+ COMMAND
174
+ ./configure --prefix=${hwloc_targ_BINARY_DIR}
175
+ --enable-static=yes --enable-shared=no --disable-libxml2
176
+ --disable-levelzero CFLAGS=-fPIC CXXFLAGS=-fPIC
177
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
178
+ OUTPUT ${hwloc_targ_SOURCE_DIR} /Makefile
179
+ DEPENDS ${hwloc_targ_SOURCE_DIR} /configure )
180
+ add_custom_command (
181
+ COMMAND make
182
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
183
+ OUTPUT ${hwloc_targ_SOURCE_DIR} /lib/libhwloc.la
184
+ DEPENDS ${hwloc_targ_SOURCE_DIR} /Makefile )
185
+ add_custom_command (
186
+ COMMAND make install
187
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
188
+ OUTPUT ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a
189
+ DEPENDS ${hwloc_targ_SOURCE_DIR} /lib/libhwloc.la )
190
+
191
+ add_custom_target (hwloc_prod
192
+ DEPENDS ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
193
+ add_library (hwloc INTERFACE )
194
+ target_link_libraries (hwloc
195
+ INTERFACE ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
196
+ add_dependencies (hwloc hwloc_prod )
197
+
198
+ set (LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR} /lib )
199
+ set (LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR} /include )
200
+ set (LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
201
+ endif ()
202
202
203
203
message (STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES} " )
204
204
message (STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS} " )
@@ -289,8 +289,7 @@ if(UMF_BUILD_FUZZTESTS
289
289
add_link_options ("-fsanitize=fuzzer-no-link" )
290
290
endif ()
291
291
292
- # A header only library to specify include directories in transitive
293
- # dependencies.
292
+ # A header-only lib to specify include directories in transitive dependencies
294
293
add_library (umf_headers INTERFACE )
295
294
296
295
# Alias target to support FetchContent.
@@ -343,7 +342,6 @@ if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
343
342
)
344
343
endif ()
345
344
346
- # set UMF_PROXY_LIB_ENABLED
347
345
if (WINDOWS )
348
346
# TODO: enable the proxy library in the Debug build on Windows
349
347
#
@@ -362,6 +360,7 @@ if(WINDOWS)
362
360
)
363
361
endif ()
364
362
endif ()
363
+ # set UMF_PROXY_LIB_ENABLED
365
364
if (UMF_PROXY_LIB_BASED_ON_POOL STREQUAL SCALABLE )
366
365
if (UMF_POOL_SCALABLE_ENABLED )
367
366
set (UMF_PROXY_LIB_ENABLED ON )
@@ -391,10 +390,12 @@ else()
391
390
)
392
391
endif ()
393
392
393
+ # set optional symbols for map/def files
394
+ #
395
+ # TODO: ref. #649
394
396
set (UMF_OPTIONAL_SYMBOLS_LINUX "" )
395
397
set (UMF_OPTIONAL_SYMBOLS_WINDOWS "" )
396
398
397
- # Conditional configuration for Level Zero provider
398
399
if (UMF_BUILD_LEVEL_ZERO_PROVIDER )
399
400
add_optional_symbol (umfLevelZeroMemoryProviderOps )
400
401
endif ()
@@ -413,12 +414,8 @@ if(UMF_BUILD_BENCHMARKS)
413
414
add_subdirectory (benchmark )
414
415
endif ()
415
416
416
- if (UMF_BUILD_EXAMPLES )
417
- if (NOT UMF_DISABLE_HWLOC )
418
- add_subdirectory (examples )
419
- else ()
420
- message (WARNING "Examples cannot be build - hwloc disabled" )
421
- endif ()
417
+ if (UMF_BUILD_EXAMPLES AND NOT UMF_DISABLE_HWLOC )
418
+ add_subdirectory (examples )
422
419
endif ()
423
420
424
421
if (UMF_FORMAT_CODE_STYLE )
@@ -551,12 +548,12 @@ if(UMF_FORMAT_CODE_STYLE)
551
548
552
549
add_custom_target (
553
550
black-format-check
554
- COMMAND ${BLACK} --check --verbose ${CMAKE_SOURCE_DIR }
551
+ COMMAND ${BLACK} --check --verbose ${UMF_CMAKE_SOURCE_DIR }
555
552
COMMENT "Check Python files formatting using black formatter" )
556
553
557
554
add_custom_target (
558
555
black-format-apply
559
- COMMAND ${BLACK} ${CMAKE_SOURCE_DIR }
556
+ COMMAND ${BLACK} ${UMF_CMAKE_SOURCE_DIR }
560
557
COMMENT "Format Python files using black formatter" )
561
558
endif ()
562
559
0 commit comments