diff --git a/projects/rocprofiler-systems/.github/workflows/cpack-bionic-rocm.yml b/projects/rocprofiler-systems/.github/workflows/cpack-bionic-rocm.yml index 74fed005ad..0aeb636e25 100644 --- a/projects/rocprofiler-systems/.github/workflows/cpack-bionic-rocm.yml +++ b/projects/rocprofiler-systems/.github/workflows/cpack-bionic-rocm.yml @@ -136,7 +136,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: stgz-installers + name: ubuntu-bionic-rocm-stgz-installers path: | build-release/omnitrace-*.sh @@ -144,7 +144,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: deb-installers + name: ubuntu-bionic-rocm-deb-installers path: | build-release/omnitrace_*.deb diff --git a/projects/rocprofiler-systems/.github/workflows/cpack-bionic.yml b/projects/rocprofiler-systems/.github/workflows/cpack-bionic.yml index ecb254df1d..3f3a35f04d 100644 --- a/projects/rocprofiler-systems/.github/workflows/cpack-bionic.yml +++ b/projects/rocprofiler-systems/.github/workflows/cpack-bionic.yml @@ -112,7 +112,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: stgz-installers + name: ubuntu-bionic-stgz-installers path: | build-release/omnitrace-*.sh @@ -120,7 +120,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: deb-installers + name: ubuntu-bionic-deb-installers path: | build-release/omnitrace_*.deb diff --git a/projects/rocprofiler-systems/.github/workflows/cpack-focal-rocm.yml b/projects/rocprofiler-systems/.github/workflows/cpack-focal-rocm.yml index 763598c27e..4fc643c4c3 100644 --- a/projects/rocprofiler-systems/.github/workflows/cpack-focal-rocm.yml +++ b/projects/rocprofiler-systems/.github/workflows/cpack-focal-rocm.yml @@ -136,7 +136,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: stgz-installers + name: ubuntu-focal-rocm-stgz-installers path: | build-release/omnitrace-*.sh @@ -144,7 +144,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: deb-installers + name: ubuntu-focal-rocm-deb-installers path: | build-release/omnitrace_*.deb diff --git a/projects/rocprofiler-systems/.github/workflows/cpack-focal.yml b/projects/rocprofiler-systems/.github/workflows/cpack-focal.yml index f38d187c0c..e25ac8b4e7 100644 --- a/projects/rocprofiler-systems/.github/workflows/cpack-focal.yml +++ b/projects/rocprofiler-systems/.github/workflows/cpack-focal.yml @@ -112,7 +112,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: stgz-installers + name: ubuntu-focal-stgz-installers path: | build-release/omnitrace-*.sh @@ -120,7 +120,7 @@ jobs: timeout-minutes: 10 uses: actions/upload-artifact@v2 with: - name: deb-installers + name: ubuntu-focal-deb-installers path: | build-release/omnitrace_*.deb diff --git a/projects/rocprofiler-systems/CMakeLists.txt b/projects/rocprofiler-systems/CMakeLists.txt index 0e1de1c48b..60e141d22c 100644 --- a/projects/rocprofiler-systems/CMakeLists.txt +++ b/projects/rocprofiler-systems/CMakeLists.txt @@ -25,7 +25,7 @@ project( LANGUAGES C CXX VERSION ${OMNITRACE_VERSION} DESCRIPTION "CPU/GPU Application tracing with static/dynamic binary instrumentation" - HOMEPAGE_URL "https://github.com/AARInternal/omnitrace") + HOMEPAGE_URL "https://github.com/AMDResearch/omnitrace") message( STATUS @@ -54,11 +54,17 @@ include(MacroUtilities) # various functions and macros include(Compilers) # compiler identification include(BuildSettings) # compiler flags +# force this because dyninst always installs to lib +set(CMAKE_INSTALL_LIBDIR + "lib" + CACHE STRING "Object code libraries (lib)" FORCE) set(CMAKE_CXX_STANDARD 17 CACHE STRING "CXX language standard") -omnitrace_add_feature(CMAKE_CXX_STANDARD "CXX language standard") omnitrace_add_feature(CMAKE_BUILD_TYPE "Build optimization level") +omnitrace_add_feature(CMAKE_INSTALL_PREFIX "Installation prefix") +omnitrace_add_feature(CMAKE_CXX_COMPILER "C++ compiler") +omnitrace_add_feature(CMAKE_CXX_STANDARD "CXX language standard") omnitrace_add_option(CMAKE_CXX_STANDARD_REQUIRED "Require C++ language standard" ON) omnitrace_add_option(CMAKE_CXX_EXTENSIONS "Compiler specific language extensions" OFF) omnitrace_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Enable rpath to linked libraries" @@ -170,8 +176,13 @@ add_subdirectory(source) # # ------------------------------------------------------------------------------# -configure_file(${PROJECT_SOURCE_DIR}/scripts/setup-env.sh.in - ${PROJECT_BINARY_DIR}/scripts/setup-env.sh @ONLY) +configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/setup-env.sh.in + ${PROJECT_BINARY_DIR}/install-tree/setup-env.sh @ONLY) + +configure_file( + ${PROJECT_SOURCE_DIR}/cmake/Templates/modulefile.in + ${PROJECT_BINARY_DIR}/install-tree/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION} + @ONLY) install( PROGRAMS ${PROJECT_SOURCE_DIR}/scripts/omnitrace-merge.jl @@ -184,20 +195,22 @@ install( OPTIONAL) install( - FILES ${PROJECT_BINARY_DIR}/scripts/setup-env.sh + FILES ${PROJECT_BINARY_DIR}/install-tree/setup-env.sh DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME} OPTIONAL) +install( + FILES + ${PROJECT_BINARY_DIR}/install-tree/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME} + OPTIONAL) + # ------------------------------------------------------------------------------# # # examples # # ------------------------------------------------------------------------------# -if(OMNITRACE_BUILD_LTO) - omnitrace_restore_variables(LTO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION) -endif() - if(OMNITRACE_BUILD_EXAMPLES) add_subdirectory(examples) endif() diff --git a/projects/rocprofiler-systems/README.md b/projects/rocprofiler-systems/README.md index 852dcad4d8..0241aeed7b 100755 --- a/projects/rocprofiler-systems/README.md +++ b/projects/rocprofiler-systems/README.md @@ -1,71 +1,13 @@ # omnitrace: application tracing with static/dynamic binary instrumentation -It is highly recommended to use the ore-built binary installers for omnitrace which are provided in the "Assets" section of each release. +[![Ubuntu 18.04 (GCC 7, 8, MPICH)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-bionic.yml/badge.svg)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-bionic.yml) +[![Ubuntu 20.04 (GCC 7, 8, 9, 10)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal-external.yml/badge.svg)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal-external.yml) +[![Ubuntu 20.04 (GCC 9, external Dyninst)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal-dyninst-package.yml/badge.svg)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal-dyninst-package.yml) +[![Ubuntu 20.04 (GCC 9, MPICH, OpenMPI)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal.yml/badge.svg)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal.yml) +[![Ubuntu 20.04 (GCC 9, MPICH, OpenMPI, ROCm 4.3, 4.5, 5.0)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal-external-rocm.yml/badge.svg)](https://github.com/AMDResearch/omnitrace/actions/workflows/ubuntu-focal-external-rocm.yml) -## Dependencies - -- Ubuntu 18.04 or Ubuntu 20.04 - - Other OS distributions may be supported but are not tested -- GCC compiler v7+ - - Older GCC compilers may be supported but are not tested - - Clang compilers are generally supported for Omnitrace but not Dyninst -- [CMake](https://cmake.org/) v3.15+ -- [DynInst](https://github.com/dyninst/dyninst) for dynamic or static instrumentation - - [TBB](https://github.com/oneapi-src/oneTBB) required by Dyninst - - [ElfUtils](https://sourceware.org/elfutils/) required by Dyninst - - [LibIberty](https://github.com/gcc-mirror/gcc/tree/master/libiberty) required by Dyninst - - [Boost](https://www.boost.org/) required by Dyninst - - [OpenMP](https://www.openmp.org/) optional by Dyninst -- [ROCm](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html#ubuntu) (optional) - - HIP - - Roctracer for HIP API and kernel tracing -- [PAPI](https://icl.utk.edu/papi/) -- [libunwind](https://www.nongnu.org/libunwind/) for call-stack sampling -- Several optional third-party profiling tools supported by timemory (e.g. TAU, Caliper, CrayPAT, etc.) - -## Installing CMake - -If using Ubuntu 20.04, `apt-get install cmake` will install cmake v3.16.3. If using Ubuntu 18.04, the cmake version via apt is too old (v3.10.2). In this case, run: - -```console -python3 -m pip install `cmake==3.18.4` -export PATH=${HOME}/.local/bin -``` - -## Installing DynInst - -The easiest way to install Dyninst is to configure omnitrace with `-DOMNITRACE_BUILD_DYNINST` and have Dyninst install it's dependencies: -`-DDyninst_BUILD_TBB=ON -DDyninst_BUILD_ELFUTILS=ON -DDyninst_BUILD_BOOST=ON -DDyninst_BUILD_LIBIBERTY=ON`. - -```shell -git clone https://github.com/spack/spack.git -source ./spack/share/spack/setup-env.sh -spack compiler find -spack external find -spack install dyninst -spack load -r dyninst -``` - -## Installing omnitrace - -Omnitrace can have full MPI support (`-DOMNITRACE_USE_MPI=ON`) or partially (`-DOMNITRACE_USE_MPI_HEADERS=ON`). The only difference between these two modes -is whether or not the results collected via timemory can be aggregated into one output file. If full MPI support is selected, make sure your target application -is built against the same MPI distribution as omnitrace, i.e. do not build omnitrace with MPICH and use it on a target application built against OpenMPI. -If partial support is selected, build omnitrace against OpenMPI -- the reason this is recommended is because the `MPI_COMM_WORLD` in OpenMPI is a pointer to -`ompi_communicator_t` (8 bytes) whereas `MPI_COMM_WORLD` in MPICH is an `int` (4 bytes). Building omnitrace with partial MPI support and the MPICH header and using -on an application using OpenMPI will thus implicitly cast `MPI_COMM_WORLD` to 4 bytes in the MPI function wrappers before calling the underlying OpenMPI function -resulting in an incorrect address for `ompi_communicator_t` whereas partial MPI support with the OpenMPI headers does not cast `MPI_COMM_WORLD` into a smaller datatype -which used with MPICH. - -```shell -OMNITRACE_ROOT=${HOME}/sw/omnitrace -git clone https://github.com/AARInternal/omnitrace.git -cmake -B build-omnitrace -DOMNITRACE_USE_MPI=ON -DCMAKE_INSTALL_PREFIX=${OMNITRACE_ROOT} omnitrace -cmake --build build-omnitrace --target all --parallel 8 -cmake --build build-omnitrace --target install -export PATH=${OMNITRACE_ROOT}/bin:${PATH} -export LD_LIBRARY_PATH=${OMNITRACE_ROOT}/lib64:${OMNITRACE_ROOT}/lib:${LD_LIBRARY_PATH} -``` +Omnitrace is an AMD research project and should not be treated as an offical part of the ROCm software stack. +The documentation for omnitrace is available at [amdresearch.github.io/omnitrace](https://amdresearch.github.io/omnitrace/). ## Using Omnitrace Executable diff --git a/projects/rocprofiler-systems/cmake/ConfigCPack.cmake b/projects/rocprofiler-systems/cmake/ConfigCPack.cmake index 4475f26766..d02e2acad4 100644 --- a/projects/rocprofiler-systems/cmake/ConfigCPack.cmake +++ b/projects/rocprofiler-systems/cmake/ConfigCPack.cmake @@ -1,7 +1,8 @@ if(DYNINST_BUILD_ELFUTILS AND DYNINST_ELFUTILS_DOWNLOAD_VERSION) + omnitrace_add_feature(DYNINST_ELFUTILS_DOWNLOAD_VERSION "ElfUtils download version") foreach(_LIB dw elf) install( - FILES + PROGRAMS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/dyninst-tpls/lib/lib${_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/dyninst-tpls/lib/lib${_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX}.1 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/dyninst-tpls/lib/lib${_LIB}-${DYNINST_ELFUTILS_DOWNLOAD_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} @@ -32,6 +33,7 @@ set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") set(CPACK_PACKAGE_CONTACT "jonathan.madsen@amd.com") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) set(OMNITRACE_CPACK_SYSTEM_NAME "${_SYSTEM_NAME}" CACHE STRING "System name, e.g. Linux or Ubuntu-18.04") @@ -101,8 +103,9 @@ omnitrace_add_feature(OMNITRACE_PACKAGE_FILE_NAME "CPack filename") # # -------------------------------------------------------------------------------------- # -set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/AARInternal/omnitrace") -set(CPACK_DEBIAN_PACKAGE_RELEASE "${CMAKE_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}") +set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/AMDResearch/omnitrace") +set(CPACK_DEBIAN_PACKAGE_RELEASE + "${OMNITRACE_CPACK_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}") string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_DEBIAN_PACKAGE_RELEASE "${CPACK_DEBIAN_PACKAGE_RELEASE}") string(REPLACE "-" "~" CPACK_DEBIAN_PACKAGE_RELEASE "${CPACK_DEBIAN_PACKAGE_RELEASE}") @@ -166,7 +169,8 @@ if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX) set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}") endif() -set(CPACK_RPM_PACKAGE_RELEASE "${CMAKE_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}") +set(CPACK_RPM_PACKAGE_RELEASE + "${OMNITRACE_CPACK_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}") string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}") string(REPLACE "-" "~" CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}") diff --git a/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake b/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake index 03df1aa588..58526ab559 100644 --- a/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake +++ b/projects/rocprofiler-systems/cmake/Modules/FindROCmVersion.cmake @@ -190,10 +190,7 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) endforeach() endfunction() - # search for HIP to set ROCM_PATH - if(NOT hip_FOUND) - find_package(hip) - endif() + # search for HIP to set ROCM_PATH if(NOT hip_FOUND) find_package(hip) endif() function(COMPUTE_ROCM_VERSION_DIR) if(EXISTS "${ROCmVersion_VERSION_FILE}" AND IS_ABSOLUTE @@ -231,7 +228,7 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) set(_PATHS ${ROCmVersion_DIR}) else() set(_PATHS ${ROCmVersion_DIR} ${ROCmVersion_ROOT} ${ROCmVersion_ROOT_DIR} - ${ROCM_PATH} $ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} /opt/rocm) + $ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${ROCM_PATH} /opt/rocm) rocm_version_message(STATUS "ROCmVersion search paths: ${_PATHS}") endif() diff --git a/projects/rocprofiler-systems/cmake/Packages.cmake b/projects/rocprofiler-systems/cmake/Packages.cmake index db5ea414be..0f43bf076b 100644 --- a/projects/rocprofiler-systems/cmake/Packages.cmake +++ b/projects/rocprofiler-systems/cmake/Packages.cmake @@ -191,7 +191,7 @@ if(OMNITRACE_BUILD_DYNINST) omnitrace_target_compile_definitions( omnitrace-dyninst INTERFACE - DYNINST_API_RT="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$:${CMAKE_INSTALL_PREFIX}/lib/$:$" + DYNINST_API_RT="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/$:$" ) endif() @@ -466,6 +466,9 @@ if(NOT TARGET PTL::ptl-shared) set(PTL_USE_GPU OFF) set(PTL_DEVELOPER_INSTALL OFF) + if(NOT DEFINED BUILD_OBJECT_LIBS) + set(BUILD_OBJECT_LIBS OFF) + endif() omnitrace_save_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS diff --git a/projects/rocprofiler-systems/cmake/Templates/modulefile.in b/projects/rocprofiler-systems/cmake/Templates/modulefile.in new file mode 100644 index 0000000000..f6f43ddeb1 --- /dev/null +++ b/projects/rocprofiler-systems/cmake/Templates/modulefile.in @@ -0,0 +1,15 @@ +#%Module1.0 + +module-whatis "omnitrace (version @OMNITRACE_VERSION@)" + +proc ModulesHelp { } { +puts stderr "Loads omnitrace v@OMNITRACE_VERSION@" +} + +set ROOT [file normalize [file dirname [file normalize ${ModulesCurrentModulefile}]]/../../..] + +prepend-path CMAKE_PREFIX_PATH "${ROOT}" +prepend-path PATH "${ROOT}/bin" +prepend-path LD_LIBRARY_PATH "${ROOT}/@CMAKE_INSTALL_LIBDIR@" +prepend-path PYTHONPATH "${ROOT}/@CMAKE_INSTALL_PYTHONDIR@" +setenv @PROJECT_NAME@_DIR "${ROOT}/share/cmake/omnitrace" diff --git a/projects/rocprofiler-systems/scripts/setup-env.sh.in b/projects/rocprofiler-systems/cmake/Templates/setup-env.sh.in similarity index 58% rename from projects/rocprofiler-systems/scripts/setup-env.sh.in rename to projects/rocprofiler-systems/cmake/Templates/setup-env.sh.in index a6925fb489..47ef3ebcb3 100644 --- a/projects/rocprofiler-systems/scripts/setup-env.sh.in +++ b/projects/rocprofiler-systems/cmake/Templates/setup-env.sh.in @@ -8,7 +8,8 @@ if [ ! -d "${BASEDIR}" ]; then return 1 fi -export PATH=${BASEDIR}/bin:${PATH} -export LD_LIBRARY_PATH=${BASEDIR}/@CMAKE_INSTALL_LIBDIR@:${LD_LIBRARY_PATH} +PATH=${BASEDIR}/bin:${PATH} +LD_LIBRARY_PATH=${BASEDIR}/@CMAKE_INSTALL_LIBDIR@:${LD_LIBRARY_PATH} -return 0 +export PATH +export LD_LIBRARY_PATH diff --git a/projects/rocprofiler-systems/docker/Dockerfile.centos b/projects/rocprofiler-systems/docker/Dockerfile.centos new file mode 100644 index 0000000000..4581b3d1fe --- /dev/null +++ b/projects/rocprofiler-systems/docker/Dockerfile.centos @@ -0,0 +1,57 @@ +ARG DISTRO=centos +ARG VERSION=7 +FROM ${DISTRO}:${VERSION} + +ENV HOME /root +ENV SHELL /bin/bash +ENV BASH_ENV /etc/bash.bashrc +ENV DEBIAN_FRONTEND noninteractive + +WORKDIR /tmp +SHELL [ "/bin/bash", "-c" ] + +ENV PATH /usr/local/bin:${PATH} + +RUN yum update -y && \ + yum groupinstall -y "Development Tools" && \ + yum install -y centos-release-scl && \ + yum install -y epel-release && \ + yum install -y devtoolset-9 python3-pip openmpi3-devel zlib-devel numactl-devel papi-devel dpkg-devel dpkg-dev && \ + python3 -m pip install 'cmake==3.18.4' + +ARG AMDGPU_RPM=21.40.2/rhel/7.9/amdgpu-install-21.40.2.40502-1.el7.noarch.rpm +# ARG AMDGPU_RPM=latest/rhel/7.9/amdgpu-install-21.50.50000-1.el7.noarch.rpm + +RUN yum install -y https://repo.radeon.com/amdgpu-install/${AMDGPU_RPM} && \ + amdgpu-install --usecase=rocm,hip,hiplibsdk --no-dkms --skip-broken -y && \ + yum install -y rocm-hip-sdk roctracer-dev rocm-smi-lib rocprofiler-dev && \ + yum update -y && \ + yum clean all + +RUN ln -s /opt/rocm-* /opt/rocm + +WORKDIR /home +SHELL [ "/bin/bash", "--login", "-c" ] +COPY ./entrypoint-centos.sh /docker-entrypoint.sh +ENTRYPOINT [ "/docker-entrypoint.sh" ] + +#1 yum update +#2 yum groupinstall "Development Tools" +#3 yum install devtoolset-9-toolchain +#4 yum install devtoolset-9 +#5 yum install devtoolset-7-toolchain +#6 yum search devtoolset +#7 yum search -a devtoolset +#8 yum search --help +#9 yum repolist +#10 yum list available +#11 yum list available devtoolset* +#12 yum list available devtoolset\* +#13 subscription-manager list --available +#14 yum install subscription-manager +#15 subscription-manager list --available +#16 yum install centos-release-scl +#17 yum-config-manager --enable rhel-server-rhscl-7-rpms +#18 yum install devtoolset-7 +#19 yum install devtoolset-9 +#20 scl enable devtoolset-9 bash diff --git a/projects/rocprofiler-systems/docker/Dockerfile.opensuse b/projects/rocprofiler-systems/docker/Dockerfile.opensuse new file mode 100644 index 0000000000..64e0f94e5d --- /dev/null +++ b/projects/rocprofiler-systems/docker/Dockerfile.opensuse @@ -0,0 +1,32 @@ +ARG DISTRO=opensuse/leap +ARG VERSION=15.3 +FROM ${DISTRO}:${VERSION} + +ENV HOME /root +ENV SHELL /bin/bash +ENV BASH_ENV /etc/bash.bashrc +ENV DEBIAN_FRONTEND noninteractive + +WORKDIR /tmp +SHELL [ "/bin/bash", "-c" ] + +ENV PATH /usr/local/bin:${PATH} + +RUN zypper update -y && \ + zypper dist-upgrade -y && \ + zypper install -y -t pattern devel_basis && \ + zypper install -y python3-pip openmpi3-devel gcc-c++ git libnuma-devel dpkg-devel rpm-build && \ + python3 -m pip install 'cmake==3.18.4' + +# ARG AMDGPU_RPM=21.40.2/sle/15/amdgpu-install-21.40.2.40502-1.noarch.rpm +ARG AMDGPU_RPM=latest/sle/15/amdgpu-install-21.50.50000-1.noarch.rpm + +RUN zypper --no-gpg-checks install -y https://repo.radeon.com/amdgpu-install/${AMDGPU_RPM} && \ + zypper addrepo https://download.opensuse.org/repositories/devel:languages:perl/SLE_15/devel:languages:perl.repo && \ + zypper --non-interactive --gpg-auto-import-keys refresh && \ + amdgpu-install --usecase=rocm,hip,hiplibsdk --no-dkms -y && \ + zypper install -y rocm-hip-sdk roctracer-dev rocm-smi-lib rocprofiler-dev && \ + zypper clean --all + +WORKDIR /home +SHELL [ "/bin/bash", "--login", "-c" ] diff --git a/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci b/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci new file mode 100644 index 0000000000..4cc2ed4cc6 --- /dev/null +++ b/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci @@ -0,0 +1,36 @@ +ARG DISTRO=opensuse/leap +ARG VERSION=15.3 +FROM ${DISTRO}:${VERSION} + +ENV HOME /root +ENV SHELL /bin/bash +ENV BASH_ENV /etc/bash.bashrc +ENV DEBIAN_FRONTEND noninteractive + +WORKDIR /tmp +SHELL [ "/bin/bash", "-c" ] + +ENV PATH /usr/local/bin:${PATH} + +ARG EXTRA_PACKAGES="" +ARG ELFUTILS_DOWNLOAD_VERSION="0.183" +ARG NJOBS="12" + +RUN zypper update -y && \ + zypper dist-upgrade -y && \ + zypper install -y -t pattern devel_basis && \ + zypper install -y python3-pip openmpi3-devel gcc-c++ git libnuma-devel dpkg-devel rpm-build papi-devel && \ + python3 -m pip install 'cmake==3.18.4' + +COPY ./dyninst-source /tmp/dyninst + +RUN cd /tmp/dyninst && \ + cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_BOOST=ON -DBUILD_TBB=ON -DBUILD_ELFUTILS=ON -DBUILD_LIBIBERTY=ON && \ + cmake --build build --target all --parallel ${NJOBS} && \ + cmake --build build --target install --parallel ${NJOBS} && \ + cd /tmp && \ + shopt -s dotglob extglob && \ + rm -rf * + +WORKDIR /home +SHELL [ "/bin/bash", "--login", "-c" ] diff --git a/projects/rocprofiler-systems/docker/Dockerfile b/projects/rocprofiler-systems/docker/Dockerfile.ubuntu similarity index 100% rename from projects/rocprofiler-systems/docker/Dockerfile rename to projects/rocprofiler-systems/docker/Dockerfile.ubuntu diff --git a/projects/rocprofiler-systems/docker/Dockerfile.ci b/projects/rocprofiler-systems/docker/Dockerfile.ubuntu.ci similarity index 100% rename from projects/rocprofiler-systems/docker/Dockerfile.ci rename to projects/rocprofiler-systems/docker/Dockerfile.ubuntu.ci diff --git a/projects/rocprofiler-systems/docker/build-docker-ci.sh b/projects/rocprofiler-systems/docker/build-docker-ci.sh index 575e2adbe6..f89a1b9f7e 100755 --- a/projects/rocprofiler-systems/docker/build-docker-ci.sh +++ b/projects/rocprofiler-systems/docker/build-docker-ci.sh @@ -2,33 +2,79 @@ set -e -if [ ! -f Dockerfile.ci ]; then cd docker; fi - -if [ ! -f Dockerfile.ci ]; then - echo "Error! Execute script from source directory" - exit 1 -fi - -rm -rf ./dyninst-source -cp -r ../external/dyninst ./dyninst-source -rm -rf ./dyninst-source/{build,install}* - : ${DISTRO:=ubuntu} : ${VERSIONS:=20.04 18.04} : ${NJOBS=$(nproc)} : ${ELFUTILS_VERSION:=0.183} +send-error() +{ + echo -e "\nError: ${@}" + exit 1 +} + +verbose-run() +{ + echo -e "\n\n### Executing \"${@}\"... ###\n" + eval $@ +} + +n=0 +while [[ $# -gt 0 ]] +do + case "${1}" in + "--distro") + shift + DISTRO=${1} + ;; + "--versions") + shift + VERSIONS=${1} + ;; + "-j") + shift + NJOBS=${1} + ;; + "--elfutils-version") + shift + ELFUTILS_VERSION=${1} + ;; + *) + send-error "Unsupported argument at position $((${n} + 1)) :: ${1}" + ;; + esac + n=$((${n} + 1)) + shift +done + +DOCKER_FILE=Dockerfile.${DISTRO}.ci + +if [ ! -f ${DOCKER_FILE} ]; then cd docker; fi + +if [ ! -f ${DOCKER_FILE} ]; then + echo "Error! Execute script from source directory" + exit 1 +fi + +verbose-run rm -rf ./dyninst-source +verbose-run cp -r ../external/dyninst ./dyninst-source +verbose-run rm -rf ./dyninst-source/{build,install}* + set -e +DISTRO_IMAGE=${DISTRO} + +if [ "${DISTRO}" = "opensuse" ]; then DISTRO_IMAGE="opensuse/leap"; fi + for VERSION in ${VERSIONS} do - docker build . \ - -f Dockerfile.ci \ + verbose-run docker build . \ + -f ${DOCKER_FILE} \ --tag jrmadsen/omnitrace-ci:${DISTRO}-${VERSION} \ - --build-arg DISTRO=${DISTRO} \ + --build-arg DISTRO=${DISTRO_IMAGE} \ --build-arg VERSION=${VERSION} \ --build-arg NJOBS=${NJOBS} \ --build-arg ELFUTILS_DOWNLOAD_VERSION=${ELFUTILS_VERSION} done -rm -rf ./dyninst-source +verbose-run rm -rf ./dyninst-source diff --git a/projects/rocprofiler-systems/docker/build-docker-release.sh b/projects/rocprofiler-systems/docker/build-docker-release.sh index 0eea44c7f2..0e1163f0f7 100755 --- a/projects/rocprofiler-systems/docker/build-docker-release.sh +++ b/projects/rocprofiler-systems/docker/build-docker-release.sh @@ -10,10 +10,11 @@ set -e build-release() { CONTAINER=$1 - ROCM_VERSION=$2 - CODE_VERSION=$3 + OS=$2 + ROCM_VERSION=$3 + CODE_VERSION=$4 MPI=$4 - docker run -it --rm -v ${PWD}:/home/omnitrace --env ROCM_VERSION=${ROCM_VERSION} --env VERSION=${CODE_VERSION} --env MPI=${MPI} ${CONTAINER} /home/omnitrace/scripts/build-release.sh + docker run -it --rm -v ${PWD}:/home/omnitrace --env DISTRO=${OS} --env ROCM_VERSION=${ROCM_VERSION} --env VERSION=${CODE_VERSION} --env MPI=${MPI} ${CONTAINER} /home/omnitrace/scripts/build-release.sh } : ${DISTRO:=ubuntu} @@ -21,6 +22,50 @@ build-release() : ${ROCM_VERSIONS:=5.0 4.5 4.3} : ${MPI:=0} +send-error() +{ + echo -e "\nError: ${@}" + exit 1 +} + +verbose-run() +{ + echo -e "\n\n### Executing \"${@}\"... ###\n" + eval $@ +} + +n=0 +while [[ $# -gt 0 ]] +do + case "${1}" in + "--distro") + shift + DISTRO=${1} + ;; + "--versions") + shift + VERSIONS=${1} + ;; + "--rocm-versions") + shift + ROCM_VERSIONS=${1} + ;; + *) + if [ "${n}" -eq 0 ]; then + DISTRO=${1} + elif [ "${n}" -eq 1 ]; then + VERSIONS=${1} + elif [ "${n}" -eq 2 ]; then + ROCM_VERSIONS=${1} + else + send-error "Unsupported argument at position $((${n} + 1)) :: ${1}" + fi + ;; + esac + n=$((${n} + 1)) + shift +done + CODE_VERSION=$(cat VERSION) for VERSION in ${VERSIONS} @@ -28,6 +73,6 @@ do TAG=${DISTRO}-${VERSION} for ROCM_VERSION in ${ROCM_VERSIONS} do - build-release jrmadsen/omnitrace-${TAG}-rocm-${ROCM_VERSION} ${ROCM_VERSION} ${CODE_VERSION} ${MPI} + build-release jrmadsen/omnitrace-${TAG}-rocm-${ROCM_VERSION} ${DISTRO}-${VERSION} ${ROCM_VERSION} ${CODE_VERSION} ${MPI} done done diff --git a/projects/rocprofiler-systems/docker/build-docker.sh b/projects/rocprofiler-systems/docker/build-docker.sh index 7d7ba46091..dc8aa364f5 100755 --- a/projects/rocprofiler-systems/docker/build-docker.sh +++ b/projects/rocprofiler-systems/docker/build-docker.sh @@ -3,19 +3,138 @@ : ${ROCM_VERSIONS:="5.0 4.5 4.3"} : ${DISTRO:=ubuntu} : ${VERSIONS:=20.04 18.04} +: ${CI:=""} set -e -if [ ! -f Dockerfile ]; then cd docker; fi +send-error() +{ + echo -e "\nError: ${@}" + exit 1 +} + +verbose-run() +{ + echo -e "\n\n### Executing \"${@}\"... ###\n" + eval $@ +} + +n=0 +while [[ $# -gt 0 ]] +do + case "${1}" in + "--distro") + shift + DISTRO=${1} + ;; + "--versions") + shift + VERSIONS=${1} + ;; + "--rocm-versions") + shift + ROCM_VERSIONS=${1} + ;; + *) + if [ "${n}" -eq 0 ]; then + DISTRO=${1} + elif [ "${n}" -eq 1 ]; then + VERSIONS=${1} + elif [ "${n}" -eq 2 ]; then + ROCM_VERSIONS=${1} + else + send-error "Unsupported argument at position $((${n} + 1)) :: ${1}" + fi + ;; + esac + n=$((${n} + 1)) + shift +done + +DOCKER_FILE="Dockerfile.${DISTRO}" + +if [ -n "${CI}" ]; then DOCKER_FILE="${DOCKER_FILE}.ci"; fi +if [ ! -f ${DOCKER_FILE} ]; then cd docker; fi +if [ ! -f ${DOCKER_FILE} ]; then send-error "File \"${DOCKER_FILE}\" not found"; fi for VERSION in ${VERSIONS} do for i in ${ROCM_VERSIONS} do - ROCM_REPO_VERSION=${i} - if [ "${i}" = "5.0" ]; then ROCM_REPO_VERSION=debian; fi - if [ "${i}" = "4.1" ]; then ROCM_REPO_DIST="xenial"; fi - if [ "${i}" = "4.0" ]; then ROCM_REPO_DIST="xenial"; fi - docker build . --tag jrmadsen/omnitrace-${DISTRO}-${VERSION}-rocm-${i} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg ROCM_REPO_VERSION=${ROCM_REPO_VERSION} --build-arg ROCM_REPO_DIST=${ROCM_REPO_DIST} + if [ "${DISTRO}" = "ubuntu" ]; then + ROCM_REPO_DIST="ubuntu" + ROCM_REPO_VERSION=${i} + case "${i}" in + 5.0*) + ROCM_REPO_VERSION="debian" + ;; + 4.1* | 4.0*) + ROCM_REPO_DIST="xenial" + ;; + *) + send-error "Unsupported combination :: ${DISTRO}-${VERSION} + ROCm ${i}" + ;; + esac + verbose-run docker build . -f ${DOCKER_FILE} --tag jrmadsen/omnitrace-${DISTRO}-${VERSION}-rocm-${i} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg ROCM_REPO_VERSION=${ROCM_REPO_VERSION} --build-arg ROCM_REPO_DIST=${ROCM_REPO_DIST} + elif [ "${DISTRO}" = "centos" ]; then + case "${VERSION}" in + 7) + RPM_PATH=7.9 + RPM_TAG=".el7" + ;; + 8) + RPM_PATH=8.5 + RPM_TAG=".el7" + ;; + *) + send-error "Invalid centos version ${VERSION}. Supported: 7, 8" + esac + case "${i}" in + 5.0*) + ROCM_RPM=latest/rhel/${RPM_PATH}/amdgpu-install-21.50.50000-1${RPM_TAG}.noarch.rpm + ;; + 4.5 | 4.5.2) + ROCM_RPM=21.40.2/rhel/${RPM_PATH}/amdgpu-install-21.40.2.40502-1${RPM_TAG}.noarch.rpm + ;; + 4.5.1) + ROCM_RPM=21.40.1/rhel/${RPM_PATH}/amdgpu-install-21.40.1.40501-1${RPM_TAG}.noarch.rpm + ;; + 4.5.0) + ROCM_RPM=21.40/rhel/${RPM_PATH}/amdgpu-install-21.40.1.40501-1${RPM_TAG}.noarch.rpm + ;; + *) + send-error "Unsupported combination :: ${DISTRO}-${VERSION} + ROCm ${i}" + ;; + esac + verbose-run docker build . -f ${DOCKER_FILE} --tag jrmadsen/omnitrace-${DISTRO}-${VERSION}-rocm-${i} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg AMDGPU_RPM=${ROCM_RPM} + elif [ "${DISTRO}" = "opensuse" ]; then + case "${VERSION}" in + 15.*) + DISTRO_IMAGE="opensuse/leap" + echo "DISTRO_IMAGE: ${DISTRO_IMAGE}" + ;; + *) + send-error "Invalid opensuse version ${VERSION}. Supported: 15.x" + ;; + esac + case "${i}" in + 5.0*) + ROCM_RPM=latest/sle/15/amdgpu-install-21.50.50000-1.noarch.rpm + ;; + 4.5 | 4.5.2) + ROCM_RPM=21.40.2/sle/15/amdgpu-install-21.40.2.40502-1.noarch.rpm + ;; + 4.5.1) + ROCM_RPM=21.40.1/sle/15/amdgpu-install-21.40.1.40501-1.noarch.rpm + ;; + 4.5.0) + ROCM_RPM=21.40/sle/15/amdgpu-install-21.40.1.40501-1.noarch.rpm + ;; + *) + send-error "Unsupported combination :: ${DISTRO}-${VERSION} + ROCm ${i}" + ;; + esac + verbose-run docker build . -f ${DOCKER_FILE} --tag jrmadsen/omnitrace-${DISTRO}-${VERSION}-rocm-${i} --build-arg DISTRO=${DISTRO_IMAGE} --build-arg VERSION=${VERSION} --build-arg AMDGPU_RPM=${ROCM_RPM} + fi done done diff --git a/projects/rocprofiler-systems/docker/entrypoint-centos.sh b/projects/rocprofiler-systems/docker/entrypoint-centos.sh new file mode 100755 index 0000000000..12bb238ab8 --- /dev/null +++ b/projects/rocprofiler-systems/docker/entrypoint-centos.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +source scl_source enable devtoolset-9 +source /etc/profile.d/modules.sh +module load mpi + +export LC_ALL=en_US.UTF-8 + +if [ -z "${1}" ]; then + exec bash +else + set -e + eval $@ +fi diff --git a/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake b/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake index 383c9b9e59..a409967a02 100644 --- a/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake +++ b/projects/rocprofiler-systems/examples/lulesh/cmake/Modules/Utilities.cmake @@ -81,6 +81,11 @@ function(CHECKOUT_GIT_SUBMODULE) set(_SUBMODULE_EXISTS OFF) if(EXISTS "${_SUBMODULE}" AND NOT IS_DIRECTORY "${_SUBMODULE}") set(_SUBMODULE_EXISTS ON) + else() + set(_SUBMODULE "${CMAKE_SOURCE_DIR}/.gitmodules") + if(EXISTS "${_SUBMODULE}" AND NOT IS_DIRECTORY "${_SUBMODULE}") + set(_SUBMODULE_EXISTS ON) + endif() endif() set(_HAS_REPO_URL OFF) diff --git a/projects/rocprofiler-systems/examples/openmp/CG/cg.cpp b/projects/rocprofiler-systems/examples/openmp/CG/cg.cpp index 4b41eac833..219c71bd74 100644 --- a/projects/rocprofiler-systems/examples/openmp/CG/cg.cpp +++ b/projects/rocprofiler-systems/examples/openmp/CG/cg.cpp @@ -57,7 +57,6 @@ Authors of the OpenMP code: #include "../common/npb-CPP.hpp" #include "npbparams.hpp" -#include "omp.h" /* * --------------------------------------------------------------------- diff --git a/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt b/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt index 4195ccb25e..5f72a1fc7e 100644 --- a/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt @@ -12,12 +12,14 @@ add_executable(openmp-lu ${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp $) find_program(CLANGXX_EXECUTABLE NAMES clang++) -if(CLANGXX_EXECUTABLE) +find_library(LIBOMP_LIBRARY + NAMES omp ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5) +if(CLANGXX_EXECUTABLE AND LIBOMP_LIBRARY) target_compile_options(openmp-common PUBLIC -W -Wall -fopenmp=libomp) target_compile_options(openmp-cg PRIVATE -W -Wall -fopenmp=libomp) - target_link_libraries(openmp-cg PRIVATE omp) + target_link_libraries(openmp-cg PRIVATE ${LIBOMP_LIBRARY}) target_compile_options(openmp-lu PRIVATE -W -Wall -fopenmp=libomp) - target_link_libraries(openmp-lu PRIVATE omp) + target_link_libraries(openmp-lu PRIVATE ${LIBOMP_LIBRARY}) omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-common) omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-cg) omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-lu) diff --git a/projects/rocprofiler-systems/examples/openmp/LU/lu.cpp b/projects/rocprofiler-systems/examples/openmp/LU/lu.cpp index cb0eb2a8fc..52fb02e015 100644 --- a/projects/rocprofiler-systems/examples/openmp/LU/lu.cpp +++ b/projects/rocprofiler-systems/examples/openmp/LU/lu.cpp @@ -59,7 +59,6 @@ Authors of the OpenMP code: #include "../common/npb-CPP.hpp" #include "npbparams.hpp" -#include "omp.h" /* * --------------------------------------------------------------------- @@ -2095,8 +2094,8 @@ read_input() * --------------------------------------------------------------------- */ FILE* fp; - int avoid_warning; - if((fp = fopen("inputlu.data", "r")) != NULL) + int avoid_warning = 0; + if((fp = fopen("inputlu.data", "r")) != nullptr) { printf("Reading from input file inputlu.data\n"); while(fgetc(fp) != '\n') @@ -2156,6 +2155,7 @@ read_input() ny0 = ISIZ2; nz0 = ISIZ3; } + (void) avoid_warning; /* * --------------------------------------------------------------------- * check problem size diff --git a/projects/rocprofiler-systems/external/dyninst b/projects/rocprofiler-systems/external/dyninst index 1cb91f1eea..bd17049666 160000 --- a/projects/rocprofiler-systems/external/dyninst +++ b/projects/rocprofiler-systems/external/dyninst @@ -1 +1 @@ -Subproject commit 1cb91f1eea4201c52723a37db0c23edf6e6b9b5d +Subproject commit bd170496665363d14b3f89f4c0cf960d3e962c94 diff --git a/projects/rocprofiler-systems/external/timemory b/projects/rocprofiler-systems/external/timemory index de1266606c..14fd2323bd 160000 --- a/projects/rocprofiler-systems/external/timemory +++ b/projects/rocprofiler-systems/external/timemory @@ -1 +1 @@ -Subproject commit de1266606c403409549bfed814aa1b0412411efc +Subproject commit 14fd2323bdb971c50500a0addaa86bc61443ecc1 diff --git a/projects/rocprofiler-systems/scripts/build-release.sh b/projects/rocprofiler-systems/scripts/build-release.sh index 8803b7345a..c8cf171f93 100755 --- a/projects/rocprofiler-systems/scripts/build-release.sh +++ b/projects/rocprofiler-systems/scripts/build-release.sh @@ -2,13 +2,18 @@ : ${EXTRA_ARGS:=""} : ${EXTRA_TAGS:=""} +: ${BUILD_DIR:=build-release} : ${VERSION:=0.0.4} : ${ROCM_VERSION:=4.5.0} : ${NJOBS:=8} +: ${DISTRO:=""} +: ${LTO:="ON"} -DISTRO=$(lsb_release -i | awk '{print $NF}')-$(lsb_release -r | awk '{print $NF}') +if [ -z "${DISTRO}" ]; then + DISTRO=$(lsb_release -i | awk '{print $NF}')-$(lsb_release -r | awk '{print $NF}') +fi -STANDARD_ARGS="-DCPACK_GENERATOR=STGZ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF -DOMNITRACE_MAX_THREADS=2048 -DOMNITRACE_BUILD_TESTING=OFF -DTIMEMORY_USE_LIBUNWIND=ON -DTIMEMORY_BUILD_LIBUNWIND=ON -DTIMEMORY_BUILD_PORTABLE=ON" +STANDARD_ARGS="-DCPACK_GENERATOR=STGZ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF -DOMNITRACE_MAX_THREADS=2048 -DOMNITRACE_BUILD_TESTING=OFF -DOMNITRACE_BUILD_EXAMPLES=OFF -DOMNITRACE_USE_MPI_HEADERS=ON -DOMNITRACE_USE_OMPT=ON -DOMNITRACE_CPACK_SYSTEM_NAME=${DISTRO} -DOMNITRACE_ROCM_VERSION=${ROCM_VERSION} -DOMNITRACE_BUILD_LTO=${LTO} -DTIMEMORY_USE_LIBUNWIND=ON -DTIMEMORY_BUILD_LIBUNWIND=ON -DTIMEMORY_BUILD_PORTABLE=ON" STANDARD_ARGS="${STANDARD_ARGS} -DOMNITRACE_BUILD_DYNINST=ON $(echo -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON)" if [ -n "${EXTRA_ARGS}" ]; then STANDARD_ARGS="${STANDARD_ARGS} ${EXTRA_ARGS}" @@ -25,45 +30,25 @@ echo -e "Working directory: $(pwd)" umask 0000 -if [ ! -f build-release/${PACKAGE_BASE_TAG}.sh ]; then - cmake -B build-release/${DISTRO}-core ${STANDARD_ARGS} -DCMAKE_INSTALL_PREFIX=build-release/${DISTRO}-core/install-release -DDYNINST_USE_OpenMP=OFF -DOMNITRACE_USE_MPI_HEADERS=OFF -DOMNITRACE_USE_HIP=OFF . - cmake --build build-release/${DISTRO}-core --target package --parallel ${NJOBS} - cp build-release/${DISTRO}-core/omnitrace-${VERSION}-Linux.sh build-release/${PACKAGE_BASE_TAG}.sh -fi +build-and-package() +{ + local DIR=${1} + shift + cmake -B ${BUILD_DIR}/${DIR} -DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/${DIR}/install-release ${STANDARD_ARGS} $@ . + cmake --build ${BUILD_DIR}/${DIR} --target all --parallel ${NJOBS} + pushd ${BUILD_DIR}/${DIR} + rm -f *.sh *.deb *.rpm + cpack -G STGZ + cpack -G DEB -D CPACK_PACKAGING_INSTALL_PREFIX=/opt/omnitrace + cpack -G RPM -D CPACK_PACKAGING_INSTALL_PREFIX=/opt/omnitrace + popd + cp ${BUILD_DIR}/${DIR}/omnitrace-${VERSION}-*.sh ${BUILD_DIR}/ + cp ${BUILD_DIR}/${DIR}/omnitrace_${VERSION}-*.deb ${BUILD_DIR}/ + cp ${BUILD_DIR}/${DIR}/omnitrace-${VERSION}-*.rpm ${BUILD_DIR}/ +} -apt-get install -y libopenmpi-dev openmpi-bin libudev-dev +build-and-package ${DISTRO}-core -DDYNINST_USE_OpenMP=OFF -DOMNITRACE_USE_HIP=OFF +# build-and-package ${DISTRO}-rocm-${ROCM_VERSION} -DOMNITRACE_USE_HIP=ON -DDYNINST_USE_OpenMP=ON +# build-and-package ${DISTRO}-rocm-${ROCM_VERSION}-papi -DOMNITRACE_USE_HIP=ON -DDYNINST_USE_OpenMP=ON -DOMNITRACE_USE_PAPI=ON -STANDARD_ARGS="${STANDARD_ARGS} -DOMNITRACE_USE_HIP=ON -DOMNITRACE_USE_MPI_HEADERS=ON -DDYNINST_USE_OpenMP=ON" - -if [ ! -f build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}.sh ]; then - cmake -B build-release/${DISTRO}-rocm-${ROCM_VERSION} -DCMAKE_INSTALL_PREFIX=build-release/${DISTRO}-rocm-${ROCM_VERSION}/install-release ${STANDARD_ARGS} . - cmake --build build-release/${DISTRO}-rocm-${ROCM_VERSION} --target package --parallel ${NJOBS} - cp build-release/${DISTRO}-rocm-${ROCM_VERSION}/omnitrace-${VERSION}-Linux.sh build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}.sh -fi - -STANDARD_ARGS="${STANDARD_ARGS} -DTIMEMORY_USE_PAPI=ON" - -if [ ! -f build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}-PAPI.sh ]; then - cmake -B build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi -DCMAKE_INSTALL_PREFIX=build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi/install-release ${STANDARD_ARGS} . - cmake --build build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi --target package --parallel ${NJOBS} - cp build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi/omnitrace-${VERSION}-Linux.sh build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}-PAPI.sh -fi - -if [ "${MPI}" -lt 1 ]; then exit 0; fi - -STANDARD_ARGS="${STANDARD_ARGS} -DOMNITRACE_USE_MPI=ON" - -if [ ! -f build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}-PAPI-OpenMPI.sh ]; then - cmake -B build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-openmpi -DCMAKE_INSTALL_PREFIX=build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-openmpi/install-release ${STANDARD_ARGS} . - cmake --build build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-openmpi --target package --parallel ${NJOBS} - cp build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-openmpi/omnitrace-${VERSION}-Linux.sh build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}-PAPI-OpenMPI.sh -fi - -apt-get purge -y libopenmpi-dev openmpi-bin -apt-get install -y libmpich-dev mpich - -if [ ! -f build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}-PAPI-MPICH.sh ]; then - cmake -B build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-mpich -DCMAKE_INSTALL_PREFIX=build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-mpich/install-release ${STANDARD_ARGS} . - cmake --build build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-mpich --target package --parallel ${NJOBS} - cp build-release/${DISTRO}-rocm-${ROCM_VERSION}-papi-mpich/omnitrace-${VERSION}-Linux.sh build-release/${PACKAGE_BASE_TAG}-ROCm-${ROCM_VERSION}-PAPI-MPICH.sh -fi +# build-and-package ${DISTRO}-rocm-${ROCM_VERSION}-papi-openmpi -DOMNITRACE_USE_HIP=ON -DDYNINST_USE_OpenMP=ON -DOMNITRACE_USE_PAPI=ON -DOMNITRACE_USE_MPI=ON diff --git a/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.cpp b/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.cpp index e04d047bf1..72d559ab24 100644 --- a/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.cpp +++ b/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.cpp @@ -1,26 +1,24 @@ -// MIT License +// MIT License // -// Copyright (c) 2020, The Regents of the University of California, -// through Lawrence Berkeley National Laboratory (subject to receipt of any -// required approvals from the U.S. Dept. of Energy). All rights reserved. +// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved. // -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. #include "avail.hpp" #include "library/api.hpp" diff --git a/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.hpp b/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.hpp index c9bbe36531..33812120b9 100644 --- a/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.hpp +++ b/projects/rocprofiler-systems/source/bin/omnitrace-avail/avail.hpp @@ -1,32 +1,24 @@ -// MIT License +// MIT License // -// Copyright (c) 2020, The Regents of the University of California, -// through Lawrence Berkeley National Laboratory (subject to receipt of any -// required approvals from the U.S. Dept. of Energy). All rights reserved. +// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved. // -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. - -/** \file timemory/tools/available.hpp - * \headerfile tools/available.hpp "tools/available.hpp" - * Handles serializing the settings - * - */ +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. #pragma once diff --git a/projects/rocprofiler-systems/source/bin/omnitrace/module_function.cpp b/projects/rocprofiler-systems/source/bin/omnitrace/module_function.cpp index ca78064b38..eedf6a9462 100644 --- a/projects/rocprofiler-systems/source/bin/omnitrace/module_function.cpp +++ b/projects/rocprofiler-systems/source/bin/omnitrace/module_function.cpp @@ -62,9 +62,12 @@ module_function::module_function(module_t* mod, procedure_t* proc) for(const auto& itr : basic_blocks) { - std::vector instructions{}; - itr->getInstructions(instructions); - num_instructions += instructions.size(); + std::vector _instructions{}; + itr->getInstructions(_instructions); + num_instructions += _instructions.size(); + instructions.reserve(instructions.size() + _instructions.size()); + for(auto&& iitr : _instructions) + instructions.emplace_back(iitr); } char modname[FUNCNAMELEN]; @@ -84,7 +87,10 @@ module_function::module_function(module_t* mod, procedure_t* proc) } std::pair _range{}; if(function->getAddressRange(_range.first, _range.second)) + { + start_address = _range.first; address_range = _range.second - _range.first; + } } void @@ -95,7 +101,8 @@ module_function::write_header(std::ostream& os) auto w2 = std::min(get_width()[2], absolute_max_width); std::stringstream ss; - ss << std::setw(14) << "AddressRange" + ss << std::setw(14) << "StartAddress" + << " " << std::setw(14) << "AddressRange" << " " << std::setw(14) << "#Instructions" << " " << std::setw(6) << "Ratio" << " " << std::setw(w0 + 8) << std::left << "Module" diff --git a/projects/rocprofiler-systems/source/bin/omnitrace/module_function.hpp b/projects/rocprofiler-systems/source/bin/omnitrace/module_function.hpp index 39041c76a7..c94149b8c5 100644 --- a/projects/rocprofiler-systems/source/bin/omnitrace/module_function.hpp +++ b/projects/rocprofiler-systems/source/bin/omnitrace/module_function.hpp @@ -28,6 +28,9 @@ #include #include +#include +#include + struct module_function { using width_t = std::array; @@ -74,16 +77,18 @@ struct module_function bool is_address_range_constrained() const; // checks address range constraint bool is_num_instructions_constrained() const; // check # instructions constraint - uint64_t address_range = 0; - uint64_t num_instructions = 0; - module_t* module = nullptr; - procedure_t* function = nullptr; - flow_graph_t* flow_graph = nullptr; - string_t module_name = {}; - string_t function_name = {}; - function_signature signature = {}; - basic_block_set_t basic_blocks = {}; - basic_loop_vec_t loop_blocks = {}; + size_t start_address = 0; + uint64_t address_range = 0; + uint64_t num_instructions = 0; + module_t* module = nullptr; + procedure_t* function = nullptr; + flow_graph_t* flow_graph = nullptr; + string_t module_name = {}; + string_t function_name = {}; + function_signature signature = {}; + basic_block_set_t basic_blocks = {}; + basic_loop_vec_t loop_blocks = {}; + std::vector instructions = {}; using str_msg_t = std::tuple; using str_msg_vec_t = std::vector; @@ -131,8 +136,11 @@ public: return _inc; }; + std::stringstream _addr{}; + _addr << "0x" << std::hex << rhs.start_address; // clang-format off - ss << std::setw(14) << rhs.address_range << " " + ss << std::setw(14) << _addr.str() << " " + << std::setw(14) << rhs.address_range << " " << std::setw(14) << rhs.num_instructions << " " << std::setw(6) << std::setprecision(2) << std::fixed << (rhs.address_range / static_cast(rhs.num_instructions)) << " " << std::setw(w0 + 8) << std::left << _get_str(rhs.module_name) << " " @@ -150,6 +158,13 @@ void module_function::serialize(ArchiveT& ar, const unsigned) { namespace cereal = tim::cereal; + if constexpr(tim::concepts::is_output_archive::value) + { + std::stringstream _addr{}; + _addr << "0x" << std::hex << start_address; + ar(cereal::make_nvp("start_address", _addr.str())); + } + ar(cereal::make_nvp("address_range", address_range), cereal::make_nvp("instructions", num_instructions), cereal::make_nvp("module", module_name), @@ -181,5 +196,17 @@ module_function::serialize(ArchiveT& ar, const unsigned) cereal::make_nvp("is_num_instructions_constrained", is_num_instructions_constrained())); ar.finishNode(); + // instructions can inflate JSON size so only output when verbosity is increased + // above default + if(verbose_level > 0) + { + std::vector _instructions{}; + _instructions.reserve(instructions.size()); + for(auto&& itr : instructions) + { + _instructions.emplace_back(itr.format()); + } + ar(cereal::make_nvp("instructions", _instructions)); + } } } diff --git a/projects/rocprofiler-systems/source/bin/omnitrace/omnitrace.cpp b/projects/rocprofiler-systems/source/bin/omnitrace/omnitrace.cpp index b1d50da5b6..6527d84544 100644 --- a/projects/rocprofiler-systems/source/bin/omnitrace/omnitrace.cpp +++ b/projects/rocprofiler-systems/source/bin/omnitrace/omnitrace.cpp @@ -1954,7 +1954,8 @@ instrument_entity(const string_t& function_name) "(std::_Sp_counted_base|std::(use|has)_facet|std::locale|::sentry|^std::_|::_(M|" "S)_|::basic_string[a-zA-Z,<>: ]+::_M_create)", regex_opts); - static std::regex leading("^(_|\\.|frame_dummy|\\(|targ|kmp_threadprivate_)", + static std::regex leading("^(_|\\.|frame_dummy|transaction clone|virtual " + "thunk|non-virtual thunk|\\(|targ|kmp_threadprivate_)", regex_opts); static std::regex trailing( "(_|\\.part\\.[0-9]+|\\.constprop\\.[0-9]+|\\.|\\.[0-9]+)$", regex_opts); diff --git a/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt b/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt index e9b0e9e223..f9f7ef8e6b 100644 --- a/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt +++ b/projects/rocprofiler-systems/source/bin/tests/CMakeLists.txt @@ -45,6 +45,8 @@ function(OMNITRACE_ADD_BIN_TEST) "${TEST_ENVIRONMENT}" TIMEOUT ${TEST_TIMEOUT} + DEPENDS + "${TEST_DEPENDS}" LABELS "omnitrace-bin;${TEST_LABELS}" PASS_REGULAR_EXPRESSION @@ -66,6 +68,8 @@ function(OMNITRACE_ADD_BIN_TEST) "${TEST_ENVIRONMENT}" TIMEOUT ${TEST_TIMEOUT} + DEPENDS + "${TEST_DEPENDS}" LABELS "omnitrace-bin;${TEST_LABELS}" PASS_REGULAR_EXPRESSION diff --git a/projects/rocprofiler-systems/source/docs/.gitignore b/projects/rocprofiler-systems/source/docs/.gitignore new file mode 100644 index 0000000000..483106172e --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/.gitignore @@ -0,0 +1,5 @@ +/build* +/_build +/_doxygen +/.gitinfo +/omnitrace.dox diff --git a/projects/rocprofiler-systems/source/docs/.nojekyll b/projects/rocprofiler-systems/source/docs/.nojekyll new file mode 100644 index 0000000000..e69de29bb2 diff --git a/projects/rocprofiler-systems/source/docs/Makefile b/projects/rocprofiler-systems/source/docs/Makefile new file mode 100644 index 0000000000..d4bb2cbb9e --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/projects/rocprofiler-systems/source/docs/about.md b/projects/rocprofiler-systems/source/docs/about.md new file mode 100644 index 0000000000..a20f89d9db --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/about.md @@ -0,0 +1,31 @@ +# About + +```eval_rst +.. toctree:: + :glob: + :maxdepth: 4 +``` + +[Browse Omnitrace source code on Github](https://github.com/AMDResearch/omnitrace) + +> [Omnitrace](https://github.com/AMDResearch/omnitrace) is an AMD research project and should +> not be treated as an offical part of the ROCm software stack. + +[Omnitrace](https://github.com/AMDResearch/omnitrace) is designed for both high-level and +comprehensive application tracing and profiling on both the CPU and GPU. +[Omnitrace](https://github.com/AMDResearch/omnitrace) supports both binary instrumentation +and sampling as a means of collecting various metrics. + +Visualization of the comprehensive omnitrace results can be viewed in any modern web browser by visiting [ui.perfetto.dev](https://ui.perfetto.dev/) +and loading the perfetto output (`.proto` files) produced by omnitrace. + +Aggregated high-level results are available in text files for human consumption and JSON files for programmatic analysis. +The JSON output files are compatible with the python package [hatchet](https://github.com/hatchet/hatchet) which converts +the performance data into pandas dataframes and facilitate multi-run comparisons, filtering, visualization in Jupyter notebooks, and much more. + +[Omnitrace](https://github.com/AMDResearch/omnitrace) has two distinct configuration steps: + +1. Configuring which functions and modules are instrumented in the target binaries (i.e. executable and/or libraries) + - [Instrumenting with Omnitrace](instrumenting.md) +2. Configuring what the instrumentation does happens when the instrumented binaries are executed + - [Customizing Omnitrace Runtime](runtime.md) diff --git a/projects/rocprofiler-systems/source/docs/conf.py b/projects/rocprofiler-systems/source/docs/conf.py new file mode 100644 index 0000000000..2762450dfd --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/conf.py @@ -0,0 +1,164 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# sys.path.insert(0, os.path.abspath('.')) + +import os +import sys +import subprocess as sp + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("..")) + + +def install(package): + sp.call([sys.executable, "-m", "pip", "install", package]) + + +# Check if we're running on Read the Docs' servers +read_the_docs_build = os.environ.get("READTHEDOCS", None) == "True" + + +# -- Project information ----------------------------------------------------- +project = "omnitrace" +copyright = "2022, Advanced Micro Devices, Inc." +author = "Audacious Software Group" + +version = open(os.path.join("..", "VERSION")).read().strip() +# The full version, including alpha/beta/rc tags +release = version + +_docdir = os.path.realpath(os.getcwd()) +_srcdir = os.path.realpath(os.path.join(os.getcwd(), "..")) +_sitedir = os.path.realpath(os.path.join(os.getcwd(), "..", "site")) +_staticdir = os.path.realpath(os.path.join(_docdir, "_static")) +_templatedir = os.path.realpath(os.path.join(_docdir, "_templates")) + +if not os.path.exists(_staticdir): + os.makedirs(_staticdir) + +if not os.path.exists(_templatedir): + os.makedirs(_templatedir) + + +# -- General configuration --------------------------------------------------- + +install("sphinx_rtd_theme") + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.todo", + "sphinx.ext.viewcode", + "sphinx.ext.githubpages", + "sphinx.ext.mathjax", + "sphinx.ext.autosummary", + "sphinx.ext.napoleon", + "sphinx_markdown_tables", + "recommonmark", + "breathe", +] + +source_suffix = { + ".rst": "restructuredtext", + ".md": "markdown", +} + +from recommonmark.parser import CommonMarkParser + +source_parsers = {".md": CommonMarkParser} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The master toctree document. +master_doc = "index" + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +default_role = None + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_rtd_theme" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +html_theme_options = { + 'analytics_id': 'G-1HLBBRSTT9', # Provided by Google in your dashboard + 'analytics_anonymize_ip': False, + 'logo_only': False, + 'display_version': True, + 'prev_next_buttons_location': 'bottom', + 'style_external_links': False, + 'vcs_pageview_mode': '', + # 'style_nav_header_background': 'white', + # Toc options + 'collapse_navigation': True, + 'sticky_navigation': True, + 'navigation_depth': 4, + 'includehidden': True, + 'titles_only': False +} + +# Breathe Configuration +breathe_projects = {"omnitrace": "_doxygen/xml"} +breathe_default_project = "omnitrace" +breathe_default_members = ('members', ) +breathe_projects_source = { + "auto": ( + "../source", + [ + "lib/omnitrace-user/omnitrace/user.h", + ], + ) +} + +from pygments.styles import get_all_styles + +# The name of the Pygments (syntax highlighting) style to use. +styles = list(get_all_styles()) +preferences = ("emacs", "pastie", "colorful") +for pref in preferences: + if pref in styles: + pygments_style = pref + break + +from recommonmark.transform import AutoStructify + +# app setup hook +def setup(app): + app.add_config_value( + "recommonmark_config", + { + "auto_toc_tree_section": "Contents", + "enable_eval_rst": True, + "enable_auto_doc_ref": False, + }, + True, + ) + app.add_transform(AutoStructify) diff --git a/projects/rocprofiler-systems/source/docs/critical_trace.md b/projects/rocprofiler-systems/source/docs/critical_trace.md new file mode 100644 index 0000000000..17466a3c08 --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/critical_trace.md @@ -0,0 +1,29 @@ +# Generating a Critical Trace + +```eval_rst +.. toctree:: + :glob: + :maxdepth: 4 +``` + +## Overview + +A critical trace is defined in omnitrace as the most time-consuming path through a parallelized code. +The steps for generating a critical trace are: + +1. Enable the `OMNITRACE_CRITICAL_TRACE` setting +2. Configure any other relevant critical-trace settings, as needed + - `omnitrace-avail --categories settings::critical-trace` +3. Execute application +4. Locate the JSON files with `call-chain` in their name +5. Provide these files to the `omnitrace-critical-trace` executable +6. Open generated perfetto file in [ui.perfetto.dev](https://ui.perfetto.dev/) + +## omnitrace-critical-trace Executable + +The `omnitrace-critical-trace` executable post-processes one or more `call-chain` JSON files and generates a perfetto output +for visualizing the critical trace. + +**INCOMPLETE** + +This executable is still under-development. diff --git a/projects/rocprofiler-systems/source/docs/environment.yml b/projects/rocprofiler-systems/source/docs/environment.yml new file mode 100644 index 0000000000..439d98869a --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/environment.yml @@ -0,0 +1,22 @@ +name: omnitrace-docs +channels: + - conda-forge + - defaults +dependencies: + - python=3.9 + - cmake + - curl + - doxygen + - git + - graphviz + - matplotlib + - mkdocs + - numpy + - openssl + - pillow + - pip + - setuptools + - breathe <4.30.0 + - sphinx <4.0.0 + - sphinx-markdown-tables + - docutils diff --git a/projects/rocprofiler-systems/source/docs/features.md b/projects/rocprofiler-systems/source/docs/features.md new file mode 100644 index 0000000000..bd6a3a49ad --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/features.md @@ -0,0 +1,76 @@ +# Features + +```eval_rst +.. toctree:: + :glob: + :maxdepth: 4 +``` + +## Overview + +[Omnitrace](https://github.com/AMDResearch/omnitrace) is designed to be highly extensible. Internally, it leverages the +[timemory performance analysis toolkit](https://github.com/NERSC/timemory) to +manage extensions, resources, data, etc. + +### Data Collection Modes + +- Dynamic instrumentation + - Runtime instrumentation + - Instrument executable and shared libraries at runtime + - Binary rewriting + - Generate a new executable and/or library with instrumentation built-in +- Statistical sampling + - Periodic software interrupts per-thread +- Background thread sampling + - Record process and system-level values while an application executes +- Critical trace generation + +### Data Analysis + +- Critical trace generation (beta) +- Support for + +### Parallelism API Support + +- Built-in MPI support +- Kokkos-Tools support + +### GPU Metrics + +- HIP API tracing +- ROCM HSA API tracing +- Kernel runtime tracing +- System-level sampling (via rocm-smi) + - Memory usage + - Power usage + - Temperature + - Utilization + +### CPU Metrics + +- CPU hardware counters sampling and profiles +- CPU frequency sampling +- Various timing metrics + - Wall time + - CPU time (process and/or thread) + - CPU utilization (process and/or thread) + - User CPU time + - Kernel CPU time +- Various memory metrics + - High-water mark (sampling and profiles) + - Memory page allocation + - Virtual memory usage +- Network statistics +- I/O metrics +- ... many more + +### Third-party API support + +- OpenMP-Tools (OMPT) +- TAU +- LIKWID +- Caliper +- CrayPAT +- VTune +- NVTX +- ROCTX diff --git a/projects/rocprofiler-systems/source/docs/generate-doxyfile.cmake b/projects/rocprofiler-systems/source/docs/generate-doxyfile.cmake new file mode 100644 index 0000000000..9cce9f437e --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/generate-doxyfile.cmake @@ -0,0 +1,19 @@ +if(NOT DEFINED SOURCE_DIR) + message(FATAL_ERROR "Please define SOURCE_DIR") +endif() + +get_filename_component(SOURCE_DIR "${SOURCE_DIR}" ABSOLUTE) + +find_program(DOT_EXECUTABLE NAMES dot) + +if(NOT DOT_EXECUTABLE) + message(FATAL_ERROR "Please install dot and/or specify DOT_EXECUTABLE") +endif() + +file(READ "${SOURCE_DIR}/VERSION" FULL_VERSION_STRING LIMIT_COUNT 1) +string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}") +string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)" "\\1.\\2.\\3" OMNITRACE_VERSION + "${FULL_VERSION_STRING}") + +configure_file(${SOURCE_DIR}/docs-source/omnitrace.dox.in + ${SOURCE_DIR}/docs-source/omnitrace.dox @ONLY) diff --git a/projects/rocprofiler-systems/source/docs/getting_started.md b/projects/rocprofiler-systems/source/docs/getting_started.md new file mode 100644 index 0000000000..027bbf1a69 --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/getting_started.md @@ -0,0 +1,11 @@ +# Getting Started + +```eval_rst +.. toctree:: + :glob: + :maxdepth: 3 + + instrumenting + runtime + critical_trace +``` diff --git a/projects/rocprofiler-systems/source/docs/index.md b/projects/rocprofiler-systems/source/docs/index.md new file mode 100644 index 0000000000..9a6316f964 --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/index.md @@ -0,0 +1,15 @@ +# Welcome to the [Omnitrace](https://github.com/AMDResearch/omnitrace) Documentation! + +```eval_rst +.. toctree:: + :glob: + :maxdepth: 4 + :caption: Table of Contents + + about + features + installation + getting_started + output + user_api +``` diff --git a/projects/rocprofiler-systems/source/docs/installation.md b/projects/rocprofiler-systems/source/docs/installation.md new file mode 100644 index 0000000000..d811771a9d --- /dev/null +++ b/projects/rocprofiler-systems/source/docs/installation.md @@ -0,0 +1,162 @@ +# Installation + +```eval_rst +.. toctree:: + :glob: + :maxdepth: 4 +``` + +- Ubuntu 18.04 or Ubuntu 20.04 + - Other OS distributions may be supported but are not tested +- GCC compiler v7+ + - Older GCC compilers may be supported but are not tested + - Clang compilers are generally supported for [Omnitrace](https://github.com/AMDResearch/omnitrace) but not Dyninst +- [CMake](https://cmake.org/) v3.15+ +- [DynInst](https://github.com/dyninst/dyninst) for dynamic or static instrumentation + - [TBB](https://github.com/oneapi-src/oneTBB) required by Dyninst + - [ElfUtils](https://sourceware.org/elfutils/) required by Dyninst + - [LibIberty](https://github.com/gcc-mirror/gcc/tree/master/libiberty) required by Dyninst + - [Boost](https://www.boost.org/) required by Dyninst + - [OpenMP](https://www.openmp.org/) optional by Dyninst +- [ROCm](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html#ubuntu) (optional) + - HIP + - Roctracer for HIP API and kernel tracing + - ROCM-SMI for GPU monitoring +- [PAPI](https://icl.utk.edu/papi/) +- [libunwind](https://www.nongnu.org/libunwind/) for call-stack sampling +- Several optional third-party profiling tools supported by timemory (e.g. TAU, Caliper, CrayPAT, etc.) + +## Installing omnitrace from binary distributions + +Every omnitrace release provides binary installer scripts of the form: + +```shell +omnitrace-{VERSION}-{OS_DISTRIB}-{OS_VERSION}[-ROCm-{ROCM_VERSION}[-{EXTRA}]].sh +``` + +E.g.: + +```shell +omnitrace-0.0.5-Ubuntu-18.04.sh +omnitrace-0.0.5-Ubuntu-18.04-ROCm-4.3.0.sh +omnitrace-0.0.5-Ubuntu-18.04-ROCm-4.5.0.sh +... +omnitrace-0.0.5-Ubuntu-20.04-ROCm-4.5.0-PAPI.sh +omnitrace-0.0.5-Ubuntu-20.04-ROCm-4.5.0-PAPI-MPICH.sh +omnitrace-0.0.5-Ubuntu-20.04-ROCm-4.5.0-PAPI-OpenMPI.sh +``` + +The EXTRA fields such as PAPI, MPICH, and OpenMPI are built against the libraries provided by the +OS package manager, e.g. `apt-get install libpapi-dev` for Ubuntu. + +### Download the appropriate binary distribution + +```shell +wget https://github.com/AMDResearch/omnitrace/releases/download/v/