Skip to content
This repository was archived by the owner on Jul 31, 2024. It is now read-only.

Commit 76ff978

Browse files
authored
Merge pull request #216 from NERSC/release-3.2.1
Release 3.2.1 - pytimem fix - fix missing import of component_bundle and component_tuple - added additional python tests - Ability to build with static libraries: python bindings, mpip library, mallocp library, ompt library, ncclp library, KokkosP libraries - Setting TIMEMORY_BUILD_PYTHON to OFF now results in searching for external pybind11 install - Renamed some CMake files in cmake/Modules - Updated caliper and gotcha submodules to support {CALIPER,GOTCHA}_INSTALL_{CONFIG,HEADER} options - Added TIMEMORY_INSTALL_PYTHON option - Fixed BUILD_STATIC_LIBS=ON + CMAKE_POSITION_INDEPENDENT_CODE=ON - Fixed TIMEMORY_USE_CUDA=ON + TIMEMORY_REQUIRE_PACKAGES=ON to fail - If TIMEMORY_REQUIRED_PACKAGES=OFF, search for packages first before adding submodule - Extended setup.py to support more options and support non-development install (no headers or cmake config) - Removed TIMEMORY_EMBED_PYTHON option - Disable timemory-jump when no shared libraries are built since dlopen isn't possible - Replaced allocator member functions construct, destroy, allocate, deallocate with calls to static functions of allocator traits - added support for CMAKE_ARGS env variable in setup.py - remove absolute rpath when SKBUILD/SPACK_BUILD (since these have staging directories) - timemory-{c,cxx,fortran} alias libraries in build tree - toggled python function profiler to not include line number by default - This can cause strange results when generators are used
2 parents 2bdd28e + 1357647 commit 76ff978

File tree

94 files changed

+938
-2495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+938
-2495
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ jobs:
241241
python ./pyctest-runner.py -SF --pyctest-site=CircleCI --pyctest-model=Continuous --pyctest-build-type=Release -j 1
242242
--build-libs shared --python --tools avail timem --cxx-standard=17 --compile-time-perf ${HOME}/ctp
243243
-- -V --output-on-failure
244-
-- -DTIMEMORY_BUILD_{CALIPER,COMPILER_INSTRUMENTATION}=OFF -DPYTHON_EXECUTABLE=$(which python) -DTIMEMORY_BUILD_PYTHON_{HATCHET,TIMEMORY_BUILD_PYTHON_LINE_PROFILER}=OFF -DCMAKE_INSTALL_PREFIX=${HOME}/timemory-install
244+
-- -DTIMEMORY_BUILD_{CALIPER,COMPILER_INSTRUMENTATION}=OFF -DPYTHON_EXECUTABLE=$(which python) -DTIMEMORY_BUILD_PYTHON_{HATCHET,LINE_PROFILER}=OFF -DCMAKE_INSTALL_PREFIX=${HOME}/timemory-install
245245
- run:
246246
name: install
247247
command: >

.requirements/build.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
Cython
22
scikit-build
33
cmake
4-
ninja

CHANGELOG.md

+25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# timemory
22

3+
## Version 3.2.1
4+
5+
> Date: Fri Jul 9 16:55:33 2021 -0500
6+
7+
- pytimem fix
8+
- fix missing import of component_bundle and component_tuple
9+
- added additional python tests
10+
- Ability to build with static libraries: python bindings, mpip library, mallocp library, ompt library, ncclp library, KokkosP libraries
11+
- Setting TIMEMORY_BUILD_PYTHON to OFF now results in searching for external pybind11 install
12+
- Renamed some CMake files in cmake/Modules
13+
- Updated caliper and gotcha submodules to support {CALIPER,GOTCHA}_INSTALL_{CONFIG,HEADER} options
14+
- Added TIMEMORY_INSTALL_PYTHON option
15+
- Fixed BUILD_STATIC_LIBS=ON + CMAKE_POSITION_INDEPENDENT_CODE=ON
16+
- Fixed TIMEMORY_USE_CUDA=ON + TIMEMORY_REQUIRE_PACKAGES=ON to fail
17+
- If TIMEMORY_REQUIRED_PACKAGES=OFF, search for packages first before adding submodule
18+
- Extended setup.py to support more options and support non-development install (no headers or cmake config)
19+
- Removed TIMEMORY_EMBED_PYTHON option
20+
- Disable timemory-jump when no shared libraries are built since dlopen isn't possible
21+
- Replaced allocator member functions construct, destroy, allocate, deallocate with calls to static functions of allocator traits
22+
- added support for CMAKE_ARGS env variable in setup.py
23+
- remove absolute rpath when SKBUILD/SPACK_BUILD (since these have staging directories)
24+
- timemory-{c,cxx,fortran} alias libraries in build tree
25+
- toggled python function profiler to not include line number by default
26+
- This can cause strange results when generators are used
27+
328
## Version 3.2.0
429

530
> Date: Sun Jun 27 21:10:57 2021 -0500

CMakeLists.txt

+15-33
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND
1414
message(AUTHOR_WARNING "In-source build")
1515
endif()
1616

17-
if(APPLE AND NOT "$ENV{CONDA_PYTHON_EXE}" STREQUAL "")
18-
# disable by default bc conda will set these and cause problem with python bindings
19-
set(CMAKE_C_FLAGS "" CACHE STRING "")
20-
set(CMAKE_CXX_FLAGS "" CACHE STRING "")
21-
endif()
17+
# if(APPLE AND NOT "$ENV{CONDA_PYTHON_EXE}" STREQUAL "")
18+
# # disable by default bc conda will set these and cause problem with python bindings
19+
# set(CMAKE_C_FLAGS "" CACHE STRING "")
20+
# set(CMAKE_CXX_FLAGS "" CACHE STRING "")
21+
# endif()
2222

2323
#----------------------------------------------------------------------------------------#
2424
# project
@@ -70,33 +70,17 @@ else()
7070
# set(CMAKE_POSITION_INDEPENDENT_CODE ON)
7171
endif()
7272

73-
set(TIMEMORY_GIT_DESCRIBE "unknown")
74-
set(TIMEMORY_GIT_REVISION "unknown")
75-
76-
find_package(Git QUIET)
77-
if(Git_FOUND)
78-
execute_process(
79-
COMMAND ${GIT_EXECUTABLE} describe --tags
80-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
81-
OUTPUT_VARIABLE TIMEMORY_GIT_DESCRIBE
82-
ERROR_QUIET
83-
OUTPUT_STRIP_TRAILING_WHITESPACE)
84-
execute_process(
85-
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
86-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
87-
OUTPUT_VARIABLE TIMEMORY_GIT_REVISION
88-
ERROR_QUIET
89-
OUTPUT_STRIP_TRAILING_WHITESPACE)
90-
endif()
91-
9273
# install directories
9374
include(GNUInstallDirs)
9475
# cmake installation folder -- change CMAKE_INSTALL_DATAROOTDIR to tweak this
9576
set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME})
9677

9778
if(UNIX AND NOT APPLE)
9879
set(CMAKE_INSTALL_RPATH
99-
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/timemory:\$ORIGIN:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/timemory")
80+
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/timemory:\$ORIGIN")
81+
if(NOT SKBUILD AND NOT SPACK_BUILD)
82+
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/timemory")
83+
endif()
10084
endif()
10185

10286
# create the full path version and generic path versions
@@ -183,14 +167,12 @@ option(TIMEMORY_QUIET_CONFIG "Make timemory configuration quieter" OFF)
183167
mark_as_advanced(TIMEMORY_QUIET_CONFIG)
184168

185169
if(SKBUILD)
186-
set(_BUILD_SHARED_CXX ON)
170+
if(BUILD_STATIC_LIBS AND TIMEMORY_USE_PYTHON)
171+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
172+
endif()
187173
else()
188-
if((TIMEMORY_BUILD_PYTHON OR TIMEMORY_USE_PYTHON) AND NOT BUILD_SHARED_LIBS)
189-
if(NOT TIMEMORY_BUILD_QUIET)
190-
message(AUTHOR_WARNING "BUILD_SHARED_LIBS=OFF --> disabling TIMEMORY_BUILD_PYTHON...")
191-
endif()
192-
set(TIMEMORY_BUILD_PYTHON OFF)
193-
set(TIMEMORY_USE_PYTHON OFF)
174+
if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS AND TIMEMORY_USE_PYTHON AND NOT CMAKE_POSITION_INDEPENDENT_CODE)
175+
message(FATAL_ERROR "Error! Python compilation with static libraries requires CMAKE_POSITION_INDEPENDENT_CODE to be ON")
194176
endif()
195177
endif()
196178

@@ -202,7 +184,7 @@ endif()
202184
set(_TLS_DESCRIPT "Thread-local static model: 'global-dynamic', 'local-dynamic', 'initial-exec', 'local-exec'")
203185
set(_TLS_OPTIONS "global-dynamic" "local-dynamic" "initial-exec" "local-exec")
204186

205-
if(SKBUILD OR TIMEMORY_BUILD_PYTHON OR TIMEMORY_USE_PYTHON OR TIMEMORY_USE_DYNINST)
187+
if(SKBUILD OR TIMEMORY_USE_PYTHON OR TIMEMORY_USE_DYNINST)
206188
set(TIMEMORY_TLS_MODEL "global-dynamic" CACHE STRING "${_TLS_DESCRIPT}")
207189
# ensure local override
208190
set(TIMEMORY_TLS_MODEL "global-dynamic")

MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ recursive-exclude _skbuild *
4646
recursive-exclude build *
4747
recursive-exclude dist *
4848
recursive-exclude external/hatchet/build *
49+
50+
# bypass global exclude of git files
51+
52+
include docs/.gitinfo

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.0
1+
3.2.1

cmake/Modules/BuildSettings.cmake

+42-16
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,54 @@ include_guard(DIRECTORY)
1010

1111
include(GNUInstallDirs)
1212
include(Compilers)
13+
include(FindPackageHandleStandardArgs)
1314

1415
target_compile_definitions(timemory-compile-options INTERFACE $<$<CONFIG:DEBUG>:DEBUG>)
1516

16-
if(CMAKE_DL_LIBS)
17-
set(dl_LIBRARY ${CMAKE_DL_LIBS})
18-
target_link_libraries(timemory-compile-options INTERFACE ${CMAKE_DL_LIBS})
19-
else()
20-
find_library(dl_LIBRARY NAMES dl)
17+
#----------------------------------------------------------------------------------------#
18+
# dynamic linking and runtime libraries
19+
#
20+
if(CMAKE_DL_LIBS AND NOT "${CMAKE_DL_LIBS}" STREQUAL "dl")
21+
# if cmake provides dl library, use that
22+
set(dl_LIBRARY ${CMAKE_DL_LIBS} CACHE FILEPATH "dynamic linking system library")
23+
endif()
24+
25+
foreach(_TYPE dl rt dw)
26+
if(NOT ${_TYPE}_LIBRARY)
27+
find_library(${_TYPE}_LIBRARY NAMES ${_TYPE})
28+
endif()
29+
endforeach()
30+
31+
find_package_handle_standard_args(dl-library REQUIRED_VARS dl_LIBRARY)
32+
find_package_handle_standard_args(rt-library REQUIRED_VARS rt_LIBRARY)
33+
# find_package_handle_standard_args(dw-library REQUIRED_VARS dw_LIBRARY)
34+
35+
if(TIMEMORY_BUILD_PORTABLE)
2136
if(dl_LIBRARY)
22-
target_link_libraries(timemory-compile-options INTERFACE ${dl_LIBRARY})
37+
set(dl_LIBRARY dl)
38+
else()
39+
set(dl_LIBRARY)
40+
endif()
41+
elseif(dl_LIBRARY)
42+
add_rpath(${dl_LIBRARY})
43+
endif()
44+
45+
if(dl_LIBRARY)
46+
target_link_libraries(timemory-compile-options INTERFACE ${dl_LIBRARY})
47+
endif()
48+
49+
if(TIMEMORY_BUILD_PORTABLE)
50+
if(rt_LIBRARY)
51+
set(rt_LIBRARY rt)
52+
else()
53+
set(rt_LIBRARY)
2354
endif()
55+
elseif(rt_LIBRARY)
56+
add_rpath(${rt_LIBRARY})
2457
endif()
2558

59+
#----------------------------------------------------------------------------------------#
60+
2661
if(WIN32)
2762
set(OS_FLAG "/bigobj")
2863
else()
@@ -72,15 +107,6 @@ endif()
72107
add_interface_library(timemory-compile-debuginfo
73108
"Attempts to set best flags for more expressive profiling information in debug or optimized binaries")
74109

75-
# if cmake provides dl library, use that
76-
if(CMAKE_DL_LIBS)
77-
set(dl_LIBRARY "${CMAKE_DL_LIBS}" CACHE STRING "dynamic linking libraries")
78-
endif()
79-
80-
find_library(rt_LIBRARY NAMES rt)
81-
find_library(dl_LIBRARY NAMES dl)
82-
find_library(dw_LIBRARY NAMES dw)
83-
84110
add_target_flag_if_avail(timemory-compile-debuginfo
85111
"-g"
86112
"-fno-omit-frame-pointer"
@@ -333,7 +359,7 @@ set(VECTOR_DEFINITION TIMEMORY_VEC)
333359
set(VECTOR_INTERFACE_TARGET timemory-vector)
334360
set(ARCH_INTERFACE_TARGET timemory-arch)
335361

336-
include(ArchConfig)
362+
include(ConfigCpuArch)
337363

338364
add_cmake_defines(TIMEMORY_VEC VALUE)
339365

cmake/Modules/ClangFormat.cmake

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,18 @@ if(CLANG_FORMATTER)
113113
COMMAND ${CLANG_FORMATTER} -i ${examples})
114114
endif()
115115

116+
set(_MSG "'${CLANG_FORMATTER}'")
116117
if(BLACK_FORMATTER)
117118
set(_COMMAND ${_COMMAND}
118119
COMMAND ${BLACK_FORMATTER} -q ${PROJECT_SOURCE_DIR})
120+
set(_MSG "${_MSG} and '${BLACK_FORMATTER}'")
119121
endif()
120122

121123
add_custom_target(${FORMAT_NAME}
122124
${_COMMAND}
123125
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
124-
COMMENT "[${PROJECT_NAME}] Running '${CLANG_FORMATTER}'..."
126+
COMMENT "[${PROJECT_NAME}] Running ${_MSG}..."
125127
SOURCES ${headers} ${sources} ${examples})
128+
129+
unset(_MSG)
126130
endif()

cmake/Modules/Compilers.cmake

+17-13
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,25 @@ macro(ADD_C_FLAG_IF_AVAIL FLAG)
174174
string(REPLACE "-" "_" FLAG_NAME "${FLAG_NAME}")
175175
string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}")
176176
string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}")
177-
timemory_begin_flag_check()
178-
check_c_compiler_flag("-Werror" c_werror)
179-
if(c_werror)
180-
check_c_compiler_flag("${FLAG} -Werror" ${FLAG_NAME})
177+
if(NOT TIMEMORY_BUILD_C)
178+
set(${FLAG_NAME} ON)
181179
else()
182-
check_c_compiler_flag("${FLAG}" ${FLAG_NAME})
183-
endif()
184-
timemory_end_flag_check()
185-
if(${FLAG_NAME})
186-
if("${_LTARG}" STREQUAL "")
187-
list(APPEND ${PROJECT_NAME}_C_FLAGS "${FLAG}")
188-
list(APPEND ${PROJECT_NAME}_C_COMPILE_OPTIONS "${FLAG}")
189-
add_target_c_flag(${LIBNAME}-compile-options ${FLAG})
180+
timemory_begin_flag_check()
181+
check_c_compiler_flag("-Werror" c_werror)
182+
if(c_werror)
183+
check_c_compiler_flag("${FLAG} -Werror" ${FLAG_NAME})
190184
else()
191-
add_target_c_flag(${_TARG} ${FLAG})
185+
check_c_compiler_flag("${FLAG}" ${FLAG_NAME})
186+
endif()
187+
timemory_end_flag_check()
188+
if(${FLAG_NAME})
189+
if("${_LTARG}" STREQUAL "")
190+
list(APPEND ${PROJECT_NAME}_C_FLAGS "${FLAG}")
191+
list(APPEND ${PROJECT_NAME}_C_COMPILE_OPTIONS "${FLAG}")
192+
add_target_c_flag(${LIBNAME}-compile-options ${FLAG})
193+
else()
194+
add_target_c_flag(${_TARG} ${FLAG})
195+
endif()
192196
endif()
193197
endif()
194198
endif()

cmake/Modules/CUDAConfig.cmake cmake/Modules/ConfigCUDA.cmake

+26-16
Original file line numberDiff line numberDiff line change
@@ -157,28 +157,38 @@ if("CUDA" IN_LIST LANGUAGES)
157157
${CUDA_INCLUDE_DIRS}
158158
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
159159

160-
find_library(CUDA_dl_LIBRARY
161-
NAMES dl)
160+
if(NOT CUDA_dl_LIBRARY)
161+
if(dl_LIBRARY)
162+
set(CUDA_dl_LIBRARY ${dl_LIBRARY})
163+
else()
164+
find_library(CUDA_dl_LIBRARY NAMES dl)
165+
endif()
166+
endif()
162167

163-
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE
164-
${CUDA_CUDART_LIBRARY} ${CUDA_rt_LIBRARY})
168+
if(NOT CUDA_rt_LIBRARY)
169+
if(rt_LIBRARY)
170+
set(CUDA_rt_LIBRARY ${rt_LIBRARY})
171+
else()
172+
find_library(CUDA_rt_LIBRARY NAMES rt)
173+
endif()
174+
endif()
165175

166-
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE
167-
${CUDA_cudadevrt_LIBRARY} ${CUDA_rt_LIBRARY})
176+
if(NOT CUDA_dl_LIBRARY)
177+
set(CUDA_dl_LIBRARY)
178+
endif()
168179

169-
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE
170-
${CUDA_cudart_static_LIBRARY} ${CUDA_rt_LIBRARY})
180+
if(NOT CUDA_rt_LIBRARY)
181+
set(CUDA_rt_LIBRARY)
182+
endif()
171183

172-
if(CUDA_dl_LIBRARY)
173-
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE
174-
${CUDA_dl_LIBRARY})
184+
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE
185+
${CUDA_CUDART_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY})
175186

176-
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE
177-
${CUDA_dl_LIBRARY})
187+
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE
188+
${CUDA_cudadevrt_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY})
178189

179-
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE
180-
${CUDA_dl_LIBRARY})
181-
endif()
190+
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE
191+
${CUDA_cudart_static_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY})
182192

183193
else()
184194
message(FATAL_ERROR

cmake/Modules/CaliperDepends.cmake cmake/Modules/ConfigCaliper.cmake

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Try to find the libraries and headers for Caliper optional dependencies
22
# Usage of this module is as follows
33
#
4-
# include(CaliperDepends)
4+
# include(ConfigCaliper)
55
#
66

77
set(CALIPER_OPTION_PREFIX ON CACHE INTERNAL "Prefix caliper options with CALIPER_")
@@ -11,9 +11,9 @@ set(CALIPER_WITH_PAPI OFF CACHE BOOL "Enable PAPI in Caliper")
1111
set(CALIPER_WITH_MPI OFF CACHE BOOL "Enable MPI in Caliper")
1212
set(CALIPER_WITH_CUPTI OFF CACHE BOOL "Enable CUPTI in Caliper")
1313

14-
if(TIMEMORY_USE_CUPTI)
15-
set(CALIPER_WITH_CUPTI OFF CACHE BOOL "Enable cupti in Caliper")
16-
endif()
14+
# always sync with timemory settings
15+
set(CALIPER_INSTALL_CONFIG ${TIMEMORY_INSTALL_CONFIG} CACHE BOOL "Install cmake and pkg-config files" FORCE)
16+
set(CALIPER_INSTALL_HEADERS ${TIMEMORY_INSTALL_HEADERS} CACHE BOOL "Install caliper headers" FORCE)
1717

1818
find_path(LIBUNWIND_INCLUDE_DIR
1919
NAMES unwind.h libunwind.h

cmake/Modules/ArchConfig.cmake cmake/Modules/ConfigCpuArch.cmake

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22
# Configures architecture options
33
#
44

5-
find_package(CpuArch)
5+
set(_CpuArch_COMPONENTS)
6+
if(TIMEMORY_BUILD_PORTABLE)
7+
set(CpuArch_FIND_DEFAULT ON)
8+
if(MSVC)
9+
set(_CpuArch_COMPONENTS OPTIONAL_COMPONENTS sse sse2 avx avx2)
10+
else()
11+
set(_CpuArch_COMPONENTS OPTIONAL_COMPONENTS sse sse2 sse3 ssse3 sse4 sse4_1 sse4_2 fma avx avx2 altivec)
12+
endif()
13+
endif()
14+
15+
find_package(CpuArch ${_CpuArch_COMPONENTS})
616

717
if(CpuArch_FOUND)
818

0 commit comments

Comments
 (0)