2
0

Code Coverage Support (#46)

* Code-coverage support

* Examples update

- code-coverage example
- tweak transpose and parallel-overhead

* Coverage output + testing

- config::get_setting value(...)
- REGULAR_EXPRESSION -> REGEX in cmake func args
- coverage.hpp header
- coverage JSON
- coverage tests

* cmake formatting

* Library instrumentation w/o main + more

- fixed library instrumentation w/o main
- use TIMEMORY_PROJECT_NAME in output messages
- removed '--driver' option from omnitrace exe
- support coverage in trace mode
- OMNITRACE_KOKKOS_KERNEL_LOGGER
- support multiple calls to omnitrace_set_env after init if already called
- support multiple calls to omnitrace_set_mpi after init if same args
- support multiple calls to omnitrace_init if same mode
- unique_ptr_t for thread_data which calls finalize when thread_data is destroyed
- tweaked openmp tests
- improved finalization

* Replace CI --output-on-failure with -V

* Fix to OMNITRACE_DL_INVOKE

* omnitrace-exe and testing updates

- omnitrace::omnitrace-timemory interface library
- support for configs in omnitrace exe
- print-{available,instrumented,...} opts no longer exit w/o --simulate
- all tests apply --print-instrumented functions
- tweaked coverage tests
- print-* options print instructions not address range

* Remove OMNITRACE_DEBUG_FINALIZE=ON from CI

* Python cmake tweaks

* Tweak test ordering

* Upload CI artifacts if fail or success

* CI Python tweaks

- Use OMNITRACE_PYTHON_PREFIX and OMNITRACE_PYTHON_ENVS

* CI ELFULTILS_DOWNLOAD_VERSION

* test tweaks

- labels and more coverage tests

* tweak to omnitrace --config handling

* Update module/function constraint handling + PP

- tweak pre-processor definition handling
- removed free-standing module_constraint
- remove free-standing routine_constraint
- remove module_name.find("omnitrace") module constraint
- fully handle the output path of omnitrace *-instr files
- get_use_code_coverage config option
- print-coverage option
- coverage_module_functions

* use github.job not github.name

* Re-enable HSA_ENABLE_INTERRUPT

- remove coverage address report

[ROCm/rocprofiler-systems commit: 791375bb24]
Este cometimento está contido em:
Jonathan R. Madsen
2022-04-25 17:00:52 -05:00
cometido por GitHub
ascendente 28ade7fbb9
cometimento 72d0a7d08a
58 ficheiros modificados com 2572 adições e 794 eliminações
@@ -0,0 +1,88 @@
#include <atomic>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <thread>
#include <vector>
#define NOINLINE __attribute__((noinline))
std::atomic<long> total{ 0 };
long
fib(long n) NOINLINE;
void
run_real(size_t nitr, long) NOINLINE;
void
run_fake(size_t nitr, long) NOINLINE;
int
main(int argc, char** argv)
{
using exec_t = void (*)(size_t, long);
std::string _name = argv[0];
auto _pos = _name.find_last_of('/');
if(_pos != std::string::npos) _name = _name.substr(_pos + 1);
size_t nthread = std::min<size_t>(16, std::thread::hardware_concurrency());
size_t nitr = 5000;
long nfib = 10;
if(argc > 1) nfib = atol(argv[1]);
if(argc > 2) nthread = atol(argv[2]);
if(argc > 3) nitr = atol(argv[3]);
exec_t _exec = &run_real;
// ensure that compiler cannot optimize run_fake away
if(std::getenv("CODE_COVERAGE_USE_FAKE") != nullptr) _exec = &run_fake;
printf("[%s] Threads: %zu\n[%s] Iterations: %zu\n[%s] fibonacci(%li)...\n",
_name.c_str(), nthread, _name.c_str(), nitr, _name.c_str(), nfib);
std::vector<std::thread> threads{};
for(size_t i = 0; i < nthread; ++i)
{
size_t _nitr = ((i % 2) == 1) ? (nitr - (0.1 * nitr)) : (nitr + (0.1 * nitr));
_nitr = std::max<size_t>(_nitr, 1);
threads.emplace_back(_exec, _nitr, nfib);
}
auto _nitr = std::max<size_t>(nitr - 0.25 * nitr, 1);
(*_exec)(_nitr, nfib - 0.1 * nfib);
for(auto& itr : threads)
itr.join();
printf("[%s] fibonacci(%li) x %lu = %li\n", _name.c_str(), nfib, nthread,
total.load());
return 0;
}
long
fib(long n)
{
return (n < 2) ? n : fib(n - 1) + fib(n - 2);
}
void
run_real(size_t nitr, long n)
{
long local = 0;
for(size_t i = 0; i < nitr; ++i)
local += fib(n);
total += local;
}
void
run_fake(size_t nitr, long n)
{
long local = 0;
for(size_t i = 0; i < nitr; ++i)
local += fib(n);
total += local;
}