Skip to content

Commit

Permalink
Merge pull request #199 from crtrott/fix_single_library_symbol_sharing
Browse files Browse the repository at this point in the history
Fix an issue in simple-kernel-timer with mismatched linked symbols
  • Loading branch information
crtrott authored Aug 3, 2023
2 parents 9b93b9e + 398c5a6 commit ef39361
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
33 changes: 33 additions & 0 deletions profiling/simple-kernel-timer/kp_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,38 @@ char* outputDelimiter;
int current_region_level = 0;
KernelPerformanceInfo* regions[512];

void increment_counter(const char* name, KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

currentEntry = info;
} else {
currentEntry = count_map[nameStr];
}

currentEntry->startTimer();
}

void increment_counter_region(const char* name, KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

regions[current_region_level] = info;
} else {
regions[current_region_level] = count_map[nameStr];
}

regions[current_region_level]->startTimer();
current_region_level++;
}

} // namespace KernelTimer
} // namespace KokkosTools
35 changes: 2 additions & 33 deletions profiling/simple-kernel-timer/kp_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,8 @@ extern char* outputDelimiter;
extern int current_region_level;
extern KernelPerformanceInfo* regions[512];

inline void increment_counter(const char* name, KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

currentEntry = info;
} else {
currentEntry = count_map[nameStr];
}

currentEntry->startTimer();
}

inline void increment_counter_region(const char* name,
KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

regions[current_region_level] = info;
} else {
regions[current_region_level] = count_map[nameStr];
}

regions[current_region_level]->startTimer();
current_region_level++;
}
void increment_counter(const char* name, KernelExecutionType kType);
void increment_counter_region(const char* name, KernelExecutionType kType);

inline bool compareKernelPerformanceInfo(KernelPerformanceInfo* left,
KernelPerformanceInfo* right) {
Expand Down

0 comments on commit ef39361

Please sign in to comment.