Files
rocm-systems/scripts/test-find-package.sh
T
Jonathan R. Madsen 846301bcaf Address and thread sanitizer fixes (#250)
* Address and thread sanitizer fixes

- Fix compilation with clang
- Tweak perfetto copy to build tree
- Added suppression files to scripts
- fix LD_PRELOAD support in omnitrace-causal and omnitrace-sample
- use spin_mutex and spin_lock from timemory instead of atomic_mutex and atomic_lock
- state uses atomic
- fix some memory leaks
- tweak testing
  - mpi tests do not use preload
  - increase timeout when using sanitizers
  - add env LD_PRELOAD when using sanitizers

* Tweak perfetto build

* Update timemory submodule

* Update version to 1.8.1

* Update omnitrace-leak.supp

* Update timemory submodule

- fixed spin_mutex implementation

* Remove previously added addr_space->allowTraps(instr_traps)

- this appears to cause errors during binary rewrite

* causal testing updates

- relaxed causal validation on CI systems (to account for hyperthreading decreasing prediction)
- improved impact calculation
- other general improvements to validate-causal-json.py

* Improve fork handling for perfetto

- numerous updates changing perfetto:: to ::perfetto::
- added perfetto_fwd.hpp

* Updated fork example

- user API for validation that stopping/starting perfetto is valid

* Misc fixes to perfetto + fork support

- tweak regions in fork example
- handle disabling tmp files
- get rid of stop/start with perfetto before/after fork
- fixed sampling support during fork
- tweak env of fork test

* Fix find_package in build-tree

* Fix buildtree export

* Fix buildtree export

* Restructured ConfigInstall before adding examples

* Guard against creating tmp file in sampling when disabled

* Fix buildtree package

* formatting

* exit handlers on child processes

- quick exit to avoid perfetto cleanup

* Further tweaking of causal tests for reliability

- enable PROCESSOR_AFFINITY
- decrease to 5 iterations

* Further tweaking of causal tests for reliability

- disable PROCESSOR_AFFINITY for fast func e2e tests
- enabling affinity results in (valid) speedup predictions greater than zero

* Fixes to fork handling

- use pthread_atfork for redundancy if fork_gotcha fails

* cmake formatting

* Fix fork init settings + install components

- remove dl from PROJECT_BUILD_TARGETS

* Testing tweaks

- fix mpi-binary-rewrite-run regex when OMNITRACE_VERBOSE set > 1 in env
- increase causal e2e iterations to 8

* Fix "Test User API"

- test-find-package.sh included dl component

* Further tweaks to causal validation

- further considerations of variance
2023-02-27 12:09:03 -06:00

155 regels
4.0 KiB
Bash
Executable File

#!/bin/bash -e
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
cd $(dirname ${SCRIPT_DIR})
echo -e "Working directory: $(pwd)"
error-message()
{
echo -e "\nError! ${@}\n"
exit -1
}
verbose-run()
{
echo -e "\n##### Executing \"${@}\"... #####\n"
eval $@
}
if [ -d "$(realpath /tmp)" ]; then
: ${TMPDIR:=/tmp}
export TMPDIR
fi
: ${EXAMPLE_DIR:=examples}
: ${EXAMPLE_NAME:=user-api}
: ${SOURCE_DIR:=$(mktemp -t -d omnitrace-test-source-XXXX)}
: ${BINARY_DIR:=$(mktemp -t -d omnitrace-test-build-XXXX)}
: ${INSTALL_DIR:=$(mktemp -t -d omnitrace-install-XXXX)}
: ${INSTALL_SCRIPT:=""}
usage()
{
print_option() { printf " --%-10s %-24s %s (default: %s)\n" "${1}" "${2}" "${3}" "${4}"; }
echo "Options:"
print_option example-name "<NAME>" "Name of the example project" "${EXAMPLE_NAME}"
print_option example-dir "<PATH>" "Directory containing example" "${EXAMPLE_DIR}"
print_option source-dir "<PATH>" "Location to copy example to" "${SOURCE_DIR}"
print_option binary-dir "<PATH>" "Location to build" "${BINARY_DIR}"
print_option install-dir "<PATH>" "Location of omnitrace installation" "${INSTALL_DIR}"
print_option install-script "<FILEPATH>" "Absolute path to the installer script" ""
}
while [[ $# -gt 0 ]]
do
ARG=${1}
shift
VAL=""
while [[ $# -gt 0 ]]
do
VAL=${1}
shift
break
done
if [ -z "${VAL}" ]; then
echo "Error! Missing value for argument \"${ARG}\""
usage
exit -1
fi
case "${ARG}" in
--example-name)
EXAMPLE_NAME=${VAL}
continue
;;
--example-dir)
EXAMPLE_DIR=${VAL}
continue
;;
--source-dir)
SOURCE_DIR=${VAL}
continue
;;
--binary-dir)
BINARY_DIR=${VAL}
continue
;;
--install-dir)
INSTALL_DIR=${VAL}
continue
;;
--install-script)
INSTALL_SCRIPT=${VAL}
continue
;;
*)
echo -e "Error! Unknown option : ${ARG}"
usage
exit -1
;;
esac
done
if [ ! -f "${INSTALL_DIR}/include/omnitrace/user.h" ]; then
if [ -z "${INSTALL_SCRIPT}" ]; then
error-message "Unable to find \"omnitrace/user.h\" in \"${INSTALL_DIR}/include\" and installation script not provided"
elif [ ! -f "${INSTALL_SCRIPT}" ]; then
error-message "Unable to locate \"${INSTALL_SCRIPT}\" in directory \"${PWD}\""
else
verbose-run mkdir -p ${INSTALL_DIR}
verbose-run $(realpath ${INSTALL_SCRIPT}) --prefix=${INSTALL_DIR} --skip-license --exclude-subdir
fi
fi
if [ ! -d ${SOURCE_DIR} ]; then
verbose-run mkdir -p ${SOURCE_DIR}
fi
verbose-run cp -v -r ${EXAMPLE_DIR}/${EXAMPLE_NAME}/* ${SOURCE_DIR}/
verbose-run pushd ${SOURCE_DIR}
cat << EOF > CMakeLists.txt
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
project(test LANGUAGES C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(omnitrace REQUIRED COMPONENTS user)
find_package(Threads REQUIRED)
get_target_property(LIBS omnitrace::omnitrace INTERFACE_LINK_LIBRARIES)
foreach(_LIB \${LIBS})
foreach(_VAR LINK_LIBRARIES INCLUDE_DIRECTORIES)
get_target_property(_VAL \${_LIB} INTERFACE_\${_VAR})
if(_VAL)
message(STATUS "\${_LIB} :: \${_VAR} :: \${_VAL}")
endif()
endforeach()
endforeach()
file(GLOB sources \${CMAKE_CURRENT_LIST_DIR}/*.cpp \${CMAKE_CURRENT_LIST_DIR}/*.c)
add_executable(app \${sources})
target_link_libraries(app PRIVATE Threads::Threads omnitrace::omnitrace)
EOF
export CMAKE_PREFIX_PATH=${INSTALL_DIR}:${CMAKE_PREFIX_PATH}
verbose-run find .
verbose-run cmake -B ${BINARY_DIR} ${SOURCE_DIR}
verbose-run cmake --build ${BINARY_DIR} --target all --parallel 2 -- VERBOSE=1
set +e
verbose-run pushd ${BINARY_DIR}
verbose-run ./app
verbose-run popd
verbose-run popd