Skip to content
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

Fix PAPI cpack packaging #112

Merged
merged 2 commits into from
Jul 25, 2022
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
42 changes: 10 additions & 32 deletions cmake/PAPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -200,46 +200,26 @@ externalproject_add(
PREFIX ${PROJECT_BINARY_DIR}/external/papi
SOURCE_DIR ${OMNITRACE_PAPI_SOURCE_DIR}/src
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND
PATCH_COMMAND
${CMAKE_COMMAND} -E env CC=${PAPI_C_COMPILER}
CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation LIBS=-lrt LDFLAGS=-lrt
${OMNITRACE_PAPI_EXTRA_ENV} <SOURCE_DIR>/configure
--prefix=${OMNITRACE_PAPI_INSTALL_DIR} --with-static-lib=yes --with-shared-lib=no
--with-perf-events --with-tests=no --with-components=${_OMNITRACE_PAPI_COMPONENTS}
BUILD_COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install
CONFIGURE_COMMAND
${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install
BUILD_COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils
INSTALL_COMMAND "")

file(
WRITE ${PROJECT_BINARY_DIR}/external/papi/build-utils.cmake
"
cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR)

execute_process(
COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\\\ -O3\\\ -g ${OMNITRACE_PAPI_EXTRA_ENV}
${MAKE_EXECUTABLE} utils install-utils
WORKING_DIRECTORY ${OMNITRACE_PAPI_SOURCE_DIR}/src
RESULT_VARIABLE _RET
OUTPUT_VARIABLE _OUT
ERROR_VARIABLE _ERR)

if(NOT \${_RET} EQUAL 0)
message(\"\${_OUT}\")
message(FATAL_ERROR \"\${_ERR}\")
endif()
")

add_custom_command(
TARGET omnitrace-papi-build
POST_BUILD
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/external/papi/build-utils.cmake)

# target for re-executing the installation
add_custom_target(
omnitrace-papi-install
COMMAND
${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static utils install install-utils
COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install
COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -g\ -Wno-stringop-truncation
${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils
WORKING_DIRECTORY ${OMNITRACE_PAPI_SOURCE_DIR}/src
COMMENT "Installing PAPI...")

Expand Down Expand Up @@ -279,8 +259,6 @@ target_link_libraries(omnitrace-papi INTERFACE ${PAPI_LIBRARY} ${PAPI_pfm_LIBRAR
omnitrace_target_compile_definitions(omnitrace-papi INTERFACE OMNITRACE_USE_PAPI
TIMEMORY_USE_PAPI=1)

include(GNUInstallDirs)

install(
DIRECTORY ${OMNITRACE_PAPI_INSTALL_DIR}/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
Expand Down
2 changes: 1 addition & 1 deletion docker/build-docker-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ build-release()
shift
local DOCKER_ARGS=""
tty -s && DOCKER_ARGS="-it" || DOCKER_ARGS=""
verbose-run docker run ${DOCKER_ARGS} --rm -v ${PWD}:/home/omnitrace --stop-signal "SIGINT" --env DISTRO=${OS} --env ROCM_VERSION=${ROCM_VERSION} --env VERSION=${CODE_VERSION} --env PYTHON_VERSIONS="${PYTHON_VERSIONS}" ${CONTAINER} /home/omnitrace/scripts/build-release.sh ${@}
verbose-run docker run ${DOCKER_ARGS} --rm -v ${PWD}:/home/omnitrace --stop-signal "SIGINT" --env DISTRO=${OS} --env ROCM_VERSION=${ROCM_VERSION} --env VERSION=${CODE_VERSION} --env PYTHON_VERSIONS="${PYTHON_VERSIONS}" --env IS_DOCKER=1 ${CONTAINER} /home/omnitrace/scripts/build-release.sh ${@}
}

reset-last()
Expand Down
7 changes: 7 additions & 0 deletions scripts/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
: ${WITH_MPI:=0}
: ${WITH_ROCM:=0}
: ${WITH_ROCM_MPI:=0}
: ${IS_DOCKER:=0}

if [ -z "${DISTRO}" ]; then
if [ -f /etc/os-release ]; then
Expand Down Expand Up @@ -207,6 +208,10 @@ build-and-package-base()
if [ "${CLEAN}" -gt 0 ]; then
verbose-run cmake --build ${BUILD_DIR}/${DIR} --target clean
fi
pushd ${BUILD_DIR}/${DIR}
verbose-run cat CPackConfig.cmake
verbose-run cat cmake_install.cmake
popd
verbose-run cmake --build ${BUILD_DIR}/${DIR} --target all --parallel ${NJOBS}
verbose-run cmake --build ${BUILD_DIR}/${DIR} --target install --parallel ${NJOBS}
pushd ${BUILD_DIR}/${DIR}
Expand Down Expand Up @@ -284,6 +289,8 @@ if [ -d /opt/conda/bin ]; then
source activate
fi

if [ "${IS_DOCKER}" -ne 0 ]; then git config --global --add safe.directory ${PWD}; fi

build-and-package ${WITH_CORE} ${DISTRO}-core -DOMNITRACE_USE_HIP=OFF
build-and-package ${WITH_MPI} ${DISTRO}-${MPI_IMPL} -DOMNITRACE_USE_HIP=ON
build-and-package ${WITH_ROCM} ${DISTRO}-rocm-${ROCM_VERSION} -DOMNITRACE_USE_HIP=ON
Expand Down