From 95570f6f62af60b490eeeb4ca4214f9ecab8ad23 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Mon, 24 Jun 2024 16:11:08 -0700 Subject: [PATCH 1/3] Adding custom debugger executable parameter to the apex_exec script This allows calling rocgdb or cuda-gdb or a different gdb --- src/scripts/apex_exec | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/scripts/apex_exec b/src/scripts/apex_exec index 4341c07d..e8b49781 100755 --- a/src/scripts/apex_exec +++ b/src/scripts/apex_exec @@ -29,6 +29,7 @@ $(basename "$0") executable where APEX options are zero or more of: --apex:help show this usage message --apex:debug run with APEX in debugger + --apex:debugger debugger executable name (default: gdb) --apex:verbose enable verbose list of APEX environment variables --apex:screen enable screen text output (on by default) --apex:screen-detail enable detailed text output (off by default) @@ -185,6 +186,9 @@ while (( "$#" )); do ;; --apex:debug) debug=yes + if [ "$debugger" == "" ] ; then + debugger=gdb + fi shift ;; --apex:pthread) @@ -422,6 +426,16 @@ while (( "$#" )); do postprocess=yes shift ;; + --apex:debugger) + debug=yes + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + debugger=$2 + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + usage + fi + ;; --apex:concur_max|--apex:concur-max) if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then export APEX_MEASURE_CONCURRENCY_MAX_TIMERS=$2 @@ -710,11 +724,7 @@ else gdbargs="-batch -q" fi #echo "set env LD_AUDIT=${APEX_LD_AUDIT}" >> ./.gdbcmds - if [ $hip = yes ] ; then - debugger="rocgdb -x ${gdbcmds} ${gdbargs} --args" - else - debugger="gdb -x ${gdbcmds} ${gdbargs} --args" - fi + debugger="${debugger} -x ${gdbcmds} ${gdbargs} --args" else export LD_LIBRARY_PATH=${APEX_LD_LIBRARY_PATH} export LD_PRELOAD=${APEX_LD_PRELOAD} From 9277a79078575a6469656cdf21d2694420433fa5 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Thu, 11 Jul 2024 17:13:33 -0700 Subject: [PATCH 2/3] Updating counter scatterplot script to handle new counter set of columns. --- src/scripts/counter_scatterplot.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scripts/counter_scatterplot.py b/src/scripts/counter_scatterplot.py index a873d8d8..e5610e84 100755 --- a/src/scripts/counter_scatterplot.py +++ b/src/scripts/counter_scatterplot.py @@ -29,18 +29,18 @@ def shorten_name(name): index = 0 for row in spamreader: index = index + 1 - if len(row) == 3 and not row[0].strip().startswith("#"): + if len(row) == 4 and not row[1].strip().startswith("#"): try: - mytup = (float(row[0])/1000000000.0,float(row[1]),counter) + mytup = (float(row[1])/1000000000.0,float(row[2]),counter) except ValueError as e: print(index, " Bad row: ", row) continue - if float(row[0]) > max_timestamp: - max_timestamp = float(row[0]) - if row[2] not in dictionary: - dictionary[row[2]] = [mytup] + if float(row[1]) > max_timestamp: + max_timestamp = float(row[1]) + if row[3] not in dictionary: + dictionary[row[3]] = [mytup] else: - dictionary[row[2]].append(mytup) + dictionary[row[3]].append(mytup) if (index % 100000 == 0): print (index, 'rows parsed...', end='\r', flush=True) print ("Parsed", index, "samples") From 314bb8d04fd45f9a0a17d6cd6a0a840d19ed8a88 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Fri, 26 Jul 2024 15:09:22 -0700 Subject: [PATCH 3/3] Fixing null (unknown) parent pointers. --- src/apex/taskstubs_implementation.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/apex/taskstubs_implementation.cpp b/src/apex/taskstubs_implementation.cpp index 65512af6..f6493630 100644 --- a/src/apex/taskstubs_implementation.cpp +++ b/src/apex/taskstubs_implementation.cpp @@ -42,9 +42,11 @@ std::shared_ptr safeLookup( auto task = getMyMap().find(guid); if (task == getMyMap().end()) { // in the common map? - mtx.lock(); + std::scoped_lock lock{mtx}; task = getCommonMap().find(guid); - mtx.unlock(); + if (task == getCommonMap().end()) { + return nullptr; + } getMyMap()[guid] = task->second; } return task->second; @@ -78,12 +80,14 @@ extern "C" { // need to look up the parent shared pointers? std::vector> parent_tasks; for (uint64_t i = 0 ; i < parent_count ; i++) { - parent_tasks.push_back(safeLookup(parent_guids[i])); + auto tmp = safeLookup(parent_guids[i]); + if (tmp != nullptr) + parent_tasks.push_back(tmp); } // if no name, use address if (timer_name == nullptr || strlen(timer_name) == 0) { // TODO: need to handle multiple parents! - if (parent_count > 0) { + if (parent_tasks.size() > 0) { auto task = apex::new_task( (apex_function_address)function_address, timer_guid, parent_tasks[0]); @@ -96,7 +100,7 @@ extern "C" { } } else { // TODO: need to handle multiple parents! - if (parent_count > 0) { + if (parent_tasks.size() > 0) { auto task = apex::new_task(timer_name, timer_guid, parent_tasks[0]); safeInsert(timer_guid, task); } else {