Skip to content

Commit

Permalink
rename nvprof-connector to nvtx-connector, add hooks for kokkosp_begi…
Browse files Browse the repository at this point in the history
…n_fence, kokkosp_end_fence, and kokkosp_profile_event
  • Loading branch information
cwpearson committed Mar 21, 2023
1 parent 0026352 commit e25a7cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ LDFLAGS=-L$(CUDA_ROOT)/lib64
LIBS=-lnvToolsExt
SHARED_CXXFLAGS=-shared -fPIC

all: kp_nvprof_connector.so
all: kp_nvtx_connector.so

MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST))))

CXXFLAGS+=-I${MAKEFILE_PATH} -I${MAKEFILE_PATH}/../../common/makefile-only -I${MAKEFILE_PATH}../all

kp_nvprof_connector.so: ${MAKEFILE_PATH}kp_nvprof_connector.cpp
kp_nvtx_connector.so: ${MAKEFILE_PATH}kp_nvtx_connector.cpp
$(CXX) $(SHARED_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) \
-o $@ ${MAKEFILE_PATH}kp_nvprof_connector.cpp $(LIBS)
-o $@ ${MAKEFILE_PATH}kp_nvtx_connector.cpp $(LIBS)

clean:
rm *.so
rm -f kp_nvtx_connector.so
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,23 @@ void kokkosp_stop_profile_section(const uint32_t sID) {
nvtxRangeEnd(section.id);
}

void kokkosp_profile_event(const char *name) {
nvtxMarkA(name);
}

void kokkosp_begin_fence(const char *name, const uint32_t deviceId,
uint64_t *handle) {
if (nullptr == name) {
name = "anon. Kokkos fence";
}
nvtxRangeId_t id = nvtxRangeStartA(name);
*handle = id; // handle will be provided back to end_fence
}
void kokkosp_end_fence(uint64_t handle) {
nvtxRangeId_t id = handle;
nvtxRangeEnd(id);
}

} // namespace NVProfConnector
} // namespace KokkosTools

Expand All @@ -143,4 +160,4 @@ EXPOSE_END_PARALLEL_SCAN(impl::kokkosp_end_parallel_scan)
EXPOSE_BEGIN_PARALLEL_REDUCE(impl::kokkosp_begin_parallel_reduce)
EXPOSE_END_PARALLEL_REDUCE(impl::kokkosp_end_parallel_reduce)
// TODO: expose section stuff
} // extern "C"
} // extern "C"

0 comments on commit e25a7cb

Please sign in to comment.