Skip to content

Commit

Permalink
Debugging kokkos support on summit
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Aug 11, 2020
1 parent 32a589a commit 2a2d52f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/apex/apex_kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
#include <stack>
#include <vector>

/*
static std::mutex memory_mtx;
static std::unordered_map<void*,apex::profiler*>& memory_map() {
static std::unordered_map<void*,apex::profiler*> themap;
return themap;
}
*/
static std::stack<apex::profiler*>& timer_stack() {
static APEX_NATIVE_TLS std::stack<apex::profiler*> thestack;
return thestack;
Expand Down Expand Up @@ -159,13 +161,16 @@ extern "C" void kokkosp_pop_profile_region() {
*/
extern "C" void kokkosp_allocate_data(SpaceHandle_t handle, const char* name,
void* ptr, uint64_t size) {
APEX_UNUSED(ptr);
std::stringstream ss;
ss << "Kokkos " << handle.name << " data, " << name;
/*
std::string tmp{ss.str()};
auto p = apex::start(tmp);
memory_mtx.lock();
memory_map().insert(std::pair<void*,apex::profiler*>(ptr, p));
memory_mtx.unlock();
*/
ss << ": Bytes";
std::string tmp2{ss.str()};
double bytes = (double)(size);
Expand All @@ -181,12 +186,15 @@ extern "C" void kokkosp_deallocate_data(SpaceHandle handle, const char* name,
void* ptr, uint64_t size) {
APEX_UNUSED(handle);
APEX_UNUSED(name);
APEX_UNUSED(ptr);
APEX_UNUSED(size);
/*
memory_mtx.lock();
auto p = memory_map()[ptr];
memory_map().erase(ptr);
memory_mtx.unlock();
apex::stop(p);
*/
}

/* This function will be called whenever a Kokkos::deep_copy function is
Expand Down
9 changes: 5 additions & 4 deletions src/scripts/apex_exec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash

LANG="C"
export LANG
Expand Down Expand Up @@ -45,11 +45,11 @@ fi
if [ ! -x "$prog" ] ; then
prog=`which $prog 2>/dev/null`
fi

if [ ! -x "$prog" ] ; then
echo "apex_exec: $1: command not found"
exit
fi
fi
#fi

if [ $apple = 1 ]; then
Expand All @@ -64,7 +64,8 @@ fi
echo "LD_AUDIT=$APEX_LD_AUDITOR"
export LD_PRELOAD=$APEX_LD_PRELOAD
fi

export KOKKOS_PROFILE_LIBRARY=$BASEDIR/lib/libapex$SHLIBX

$@
retval=$?
unset LD_PRELOAD
Expand Down

0 comments on commit 2a2d52f

Please sign in to comment.