提交 2e9ea1ce 编写于 作者: L liaogang

Add Gpu profiler interface

上级 76a41f31
......@@ -335,4 +335,14 @@ extern bool hl_cuda_event_is_ready(hl_event_t event);
*/
extern void hl_device_synchronize();
/**
* @brief gpu profiler start
*/
extern void hl_profiler_start();
/**
* @brief gpu profiler stop
*/
extern void hl_profiler_end();
#endif // HL_CUDA_H_
......@@ -93,4 +93,8 @@ inline bool hl_cuda_event_is_ready(hl_event_t event) { return true; }
inline void hl_device_synchronize() {}
inline void hl_profiler_start() {}
inline void hl_profiler_end() {}
#endif // HL_CUDA_STUB_H_
......@@ -17,6 +17,7 @@ limitations under the License. */
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <cuda_profiler_api.h>
#include <mutex>
#include "hl_cuda.h"
#include "hl_cuda.ph"
......@@ -133,8 +134,9 @@ void* cudart_dso_handle = nullptr;
__macro(cudaGetLastError) \
__macro(cudaFuncSetCacheConfig) \
__macro(cudaRuntimeGetVersion) \
__macro(cudaGetErrorString)
__macro(cudaGetErrorString) \
__macro(cudaProfilerStart) \
__macro(cudaProfilerStop)
CUDA_ROUTINE_EACH(DYNAMIC_LOAD_CUDART_WRAP)
#undef CUDA_ROUNTINE_EACH
......@@ -756,3 +758,10 @@ bool hl_cuda_event_is_ready(hl_event_t event) {
}
return true;
}
void hl_profiler_start() {
CHECK_CUDA(dynload::cudaProfilerStart());
}
void hl_profiler_end() {
CHECK_CUDA(dynload::cudaProfilerStop());
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册