Skip to content

Commit

Permalink
Merge pull request #216 from NERSC/release-3.2.1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jrmadsen committed Jul 11, 2021
2 parents 2bdd28e + 1357647 commit 76ff978
Show file tree
Hide file tree
Showing 94 changed files with 938 additions and 2,495 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -241,7 +241,7 @@ jobs:
python ./pyctest-runner.py -SF --pyctest-site=CircleCI --pyctest-model=Continuous --pyctest-build-type=Release -j 1
--build-libs shared --python --tools avail timem --cxx-standard=17 --compile-time-perf ${HOME}/ctp
-- -V --output-on-failure
-- -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
-- -DTIMEMORY_BUILD_{CALIPER,COMPILER_INSTRUMENTATION}=OFF -DPYTHON_EXECUTABLE=$(which python) -DTIMEMORY_BUILD_PYTHON_{HATCHET,LINE_PROFILER}=OFF -DCMAKE_INSTALL_PREFIX=${HOME}/timemory-install
- run:
name: install
command: >
Expand Down
1 change: 0 additions & 1 deletion .requirements/build.txt
@@ -1,4 +1,3 @@
Cython
scikit-build
cmake
ninja
25 changes: 25 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,30 @@
# timemory

## Version 3.2.1

> Date: Fri Jul 9 16:55:33 2021 -0500
- 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

## Version 3.2.0

> Date: Sun Jun 27 21:10:57 2021 -0500
Expand Down
48 changes: 15 additions & 33 deletions CMakeLists.txt
Expand Up @@ -14,11 +14,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND
message(AUTHOR_WARNING "In-source build")
endif()

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

#----------------------------------------------------------------------------------------#
# project
Expand Down Expand Up @@ -70,33 +70,17 @@ else()
# set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

set(TIMEMORY_GIT_DESCRIBE "unknown")
set(TIMEMORY_GIT_REVISION "unknown")

find_package(Git QUIET)
if(Git_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE TIMEMORY_GIT_DESCRIBE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE TIMEMORY_GIT_REVISION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

# install directories
include(GNUInstallDirs)
# cmake installation folder -- change CMAKE_INSTALL_DATAROOTDIR to tweak this
set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME})

if(UNIX AND NOT APPLE)
set(CMAKE_INSTALL_RPATH
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/timemory:\$ORIGIN:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/timemory")
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/timemory:\$ORIGIN")
if(NOT SKBUILD AND NOT SPACK_BUILD)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/timemory")
endif()
endif()

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

if(SKBUILD)
set(_BUILD_SHARED_CXX ON)
if(BUILD_STATIC_LIBS AND TIMEMORY_USE_PYTHON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
else()
if((TIMEMORY_BUILD_PYTHON OR TIMEMORY_USE_PYTHON) AND NOT BUILD_SHARED_LIBS)
if(NOT TIMEMORY_BUILD_QUIET)
message(AUTHOR_WARNING "BUILD_SHARED_LIBS=OFF --> disabling TIMEMORY_BUILD_PYTHON...")
endif()
set(TIMEMORY_BUILD_PYTHON OFF)
set(TIMEMORY_USE_PYTHON OFF)
if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS AND TIMEMORY_USE_PYTHON AND NOT CMAKE_POSITION_INDEPENDENT_CODE)
message(FATAL_ERROR "Error! Python compilation with static libraries requires CMAKE_POSITION_INDEPENDENT_CODE to be ON")
endif()
endif()

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

if(SKBUILD OR TIMEMORY_BUILD_PYTHON OR TIMEMORY_USE_PYTHON OR TIMEMORY_USE_DYNINST)
if(SKBUILD OR TIMEMORY_USE_PYTHON OR TIMEMORY_USE_DYNINST)
set(TIMEMORY_TLS_MODEL "global-dynamic" CACHE STRING "${_TLS_DESCRIPT}")
# ensure local override
set(TIMEMORY_TLS_MODEL "global-dynamic")
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Expand Up @@ -46,3 +46,7 @@ recursive-exclude _skbuild *
recursive-exclude build *
recursive-exclude dist *
recursive-exclude external/hatchet/build *

# bypass global exclude of git files

include docs/.gitinfo
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.2.0
3.2.1
58 changes: 42 additions & 16 deletions cmake/Modules/BuildSettings.cmake
Expand Up @@ -10,19 +10,54 @@ include_guard(DIRECTORY)

include(GNUInstallDirs)
include(Compilers)
include(FindPackageHandleStandardArgs)

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

if(CMAKE_DL_LIBS)
set(dl_LIBRARY ${CMAKE_DL_LIBS})
target_link_libraries(timemory-compile-options INTERFACE ${CMAKE_DL_LIBS})
else()
find_library(dl_LIBRARY NAMES dl)
#----------------------------------------------------------------------------------------#
# dynamic linking and runtime libraries
#
if(CMAKE_DL_LIBS AND NOT "${CMAKE_DL_LIBS}" STREQUAL "dl")
# if cmake provides dl library, use that
set(dl_LIBRARY ${CMAKE_DL_LIBS} CACHE FILEPATH "dynamic linking system library")
endif()

foreach(_TYPE dl rt dw)
if(NOT ${_TYPE}_LIBRARY)
find_library(${_TYPE}_LIBRARY NAMES ${_TYPE})
endif()
endforeach()

find_package_handle_standard_args(dl-library REQUIRED_VARS dl_LIBRARY)
find_package_handle_standard_args(rt-library REQUIRED_VARS rt_LIBRARY)
# find_package_handle_standard_args(dw-library REQUIRED_VARS dw_LIBRARY)

if(TIMEMORY_BUILD_PORTABLE)
if(dl_LIBRARY)
target_link_libraries(timemory-compile-options INTERFACE ${dl_LIBRARY})
set(dl_LIBRARY dl)
else()
set(dl_LIBRARY)
endif()
elseif(dl_LIBRARY)
add_rpath(${dl_LIBRARY})
endif()

if(dl_LIBRARY)
target_link_libraries(timemory-compile-options INTERFACE ${dl_LIBRARY})
endif()

if(TIMEMORY_BUILD_PORTABLE)
if(rt_LIBRARY)
set(rt_LIBRARY rt)
else()
set(rt_LIBRARY)
endif()
elseif(rt_LIBRARY)
add_rpath(${rt_LIBRARY})
endif()

#----------------------------------------------------------------------------------------#

if(WIN32)
set(OS_FLAG "/bigobj")
else()
Expand Down Expand Up @@ -72,15 +107,6 @@ endif()
add_interface_library(timemory-compile-debuginfo
"Attempts to set best flags for more expressive profiling information in debug or optimized binaries")

# if cmake provides dl library, use that
if(CMAKE_DL_LIBS)
set(dl_LIBRARY "${CMAKE_DL_LIBS}" CACHE STRING "dynamic linking libraries")
endif()

find_library(rt_LIBRARY NAMES rt)
find_library(dl_LIBRARY NAMES dl)
find_library(dw_LIBRARY NAMES dw)

add_target_flag_if_avail(timemory-compile-debuginfo
"-g"
"-fno-omit-frame-pointer"
Expand Down Expand Up @@ -333,7 +359,7 @@ set(VECTOR_DEFINITION TIMEMORY_VEC)
set(VECTOR_INTERFACE_TARGET timemory-vector)
set(ARCH_INTERFACE_TARGET timemory-arch)

include(ArchConfig)
include(ConfigCpuArch)

add_cmake_defines(TIMEMORY_VEC VALUE)

Expand Down
6 changes: 5 additions & 1 deletion cmake/Modules/ClangFormat.cmake
Expand Up @@ -113,14 +113,18 @@ if(CLANG_FORMATTER)
COMMAND ${CLANG_FORMATTER} -i ${examples})
endif()

set(_MSG "'${CLANG_FORMATTER}'")
if(BLACK_FORMATTER)
set(_COMMAND ${_COMMAND}
COMMAND ${BLACK_FORMATTER} -q ${PROJECT_SOURCE_DIR})
set(_MSG "${_MSG} and '${BLACK_FORMATTER}'")
endif()

add_custom_target(${FORMAT_NAME}
${_COMMAND}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "[${PROJECT_NAME}] Running '${CLANG_FORMATTER}'..."
COMMENT "[${PROJECT_NAME}] Running ${_MSG}..."
SOURCES ${headers} ${sources} ${examples})

unset(_MSG)
endif()
30 changes: 17 additions & 13 deletions cmake/Modules/Compilers.cmake
Expand Up @@ -174,21 +174,25 @@ macro(ADD_C_FLAG_IF_AVAIL FLAG)
string(REPLACE "-" "_" FLAG_NAME "${FLAG_NAME}")
string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}")
string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}")
timemory_begin_flag_check()
check_c_compiler_flag("-Werror" c_werror)
if(c_werror)
check_c_compiler_flag("${FLAG} -Werror" ${FLAG_NAME})
if(NOT TIMEMORY_BUILD_C)
set(${FLAG_NAME} ON)
else()
check_c_compiler_flag("${FLAG}" ${FLAG_NAME})
endif()
timemory_end_flag_check()
if(${FLAG_NAME})
if("${_LTARG}" STREQUAL "")
list(APPEND ${PROJECT_NAME}_C_FLAGS "${FLAG}")
list(APPEND ${PROJECT_NAME}_C_COMPILE_OPTIONS "${FLAG}")
add_target_c_flag(${LIBNAME}-compile-options ${FLAG})
timemory_begin_flag_check()
check_c_compiler_flag("-Werror" c_werror)
if(c_werror)
check_c_compiler_flag("${FLAG} -Werror" ${FLAG_NAME})
else()
add_target_c_flag(${_TARG} ${FLAG})
check_c_compiler_flag("${FLAG}" ${FLAG_NAME})
endif()
timemory_end_flag_check()
if(${FLAG_NAME})
if("${_LTARG}" STREQUAL "")
list(APPEND ${PROJECT_NAME}_C_FLAGS "${FLAG}")
list(APPEND ${PROJECT_NAME}_C_COMPILE_OPTIONS "${FLAG}")
add_target_c_flag(${LIBNAME}-compile-options ${FLAG})
else()
add_target_c_flag(${_TARG} ${FLAG})
endif()
endif()
endif()
endif()
Expand Down
42 changes: 26 additions & 16 deletions cmake/Modules/CUDAConfig.cmake → cmake/Modules/ConfigCUDA.cmake
Expand Up @@ -157,28 +157,38 @@ if("CUDA" IN_LIST LANGUAGES)
${CUDA_INCLUDE_DIRS}
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})

find_library(CUDA_dl_LIBRARY
NAMES dl)
if(NOT CUDA_dl_LIBRARY)
if(dl_LIBRARY)
set(CUDA_dl_LIBRARY ${dl_LIBRARY})
else()
find_library(CUDA_dl_LIBRARY NAMES dl)
endif()
endif()

target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE
${CUDA_CUDART_LIBRARY} ${CUDA_rt_LIBRARY})
if(NOT CUDA_rt_LIBRARY)
if(rt_LIBRARY)
set(CUDA_rt_LIBRARY ${rt_LIBRARY})
else()
find_library(CUDA_rt_LIBRARY NAMES rt)
endif()
endif()

target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE
${CUDA_cudadevrt_LIBRARY} ${CUDA_rt_LIBRARY})
if(NOT CUDA_dl_LIBRARY)
set(CUDA_dl_LIBRARY)
endif()

target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE
${CUDA_cudart_static_LIBRARY} ${CUDA_rt_LIBRARY})
if(NOT CUDA_rt_LIBRARY)
set(CUDA_rt_LIBRARY)
endif()

if(CUDA_dl_LIBRARY)
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE
${CUDA_dl_LIBRARY})
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart INTERFACE
${CUDA_CUDART_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY})

target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE
${CUDA_dl_LIBRARY})
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-device INTERFACE
${CUDA_cudadevrt_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY})

target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE
${CUDA_dl_LIBRARY})
endif()
target_link_libraries(${PROJECT_CUDA_INTERFACE_PREFIX}-cudart-static INTERFACE
${CUDA_cudart_static_LIBRARY} ${CUDA_rt_LIBRARY} ${CUDA_dl_LIBRARY})

else()
message(FATAL_ERROR
Expand Down
@@ -1,7 +1,7 @@
# Try to find the libraries and headers for Caliper optional dependencies
# Usage of this module is as follows
#
# include(CaliperDepends)
# include(ConfigCaliper)
#

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

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

find_path(LIBUNWIND_INCLUDE_DIR
NAMES unwind.h libunwind.h
Expand Down
Expand Up @@ -2,7 +2,17 @@
# Configures architecture options
#

find_package(CpuArch)
set(_CpuArch_COMPONENTS)
if(TIMEMORY_BUILD_PORTABLE)
set(CpuArch_FIND_DEFAULT ON)
if(MSVC)
set(_CpuArch_COMPONENTS OPTIONAL_COMPONENTS sse sse2 avx avx2)
else()
set(_CpuArch_COMPONENTS OPTIONAL_COMPONENTS sse sse2 sse3 ssse3 sse4 sse4_1 sse4_2 fma avx avx2 altivec)
endif()
endif()

find_package(CpuArch ${_CpuArch_COMPONENTS})

if(CpuArch_FOUND)

Expand Down

0 comments on commit 76ff978

Please sign in to comment.