Add Gpu profiler interface

avx_docs
liaogang 8 years ago
parent 76a41f3147
commit 2e9ea1cece

@ -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());
}

Loading…
Cancel
Save