运行时
rocprof --trace-start off没有效果
2022-05-05 22:36:07
107

我想要使用rocprof --trace-start off来从指定位置开始trace,然而产生的results.json等还是从程序最初开始trace。

简单的代码示例 main.cpp:

#include <iostream>
#include <hip/hip_runtime.h>
#include <roctracer_ext.h>

__global__ void kernel_a(){
    int Id = blockIdx.x*blockDim.x+threadIdx.x;
    if(Id==0){
	printf("kernel a\n");
    }
}
__global__ void kernel_b(){
    int Id = blockIdx.x*blockDim.x+threadIdx.x;
    if(Id==0){
	printf("kernel b\n");
    }   
}

int main()
{
    kernel_a<<<1, 32>>>();
    hipDeviceSynchronize();
    //从这里开始trace
    roctracer_start();
    kernel_b<<<1, 32>>>();
    hipDeviceSynchronize();
    return 0;
}

我使用CMake构建编译系统,CMakeLists.txt如下:

project(test)
cmake_minimum_required(VERSION 3.10.2)

find_package(hip REQUIRED)
include_directories(${ROCM_PATH}/roctracer/include)
link_directories(${ROCM_PATH}/roctracer/lib)

add_executable(test src/main.cpp)
target_link_libraries(test -lroctracer64 hip::device)

命令:rocprof --hip-trace --trace-start off ./test

产生的results.jsonattachmentId-image.png

可见仍然记录了kernel_a与kernel_b。

ROCM版本是dtk-21.04。我有搞错了什么吗?期待您的回复。

全部评论(5)
只看楼主
T
tianlh
2楼

补充:建议您使用最新版dtk21.10.1,里面有自研的hipprof可以使用。

2022/5/7
M
mhaohit
回复 @tianlh

有hipprof的文档或介绍吗

2022/5/15
T
tianlh
回复 @tianlh

请参考
https://developer.hpccube.com/gitbook//dcu_developer/DeveloperGuide/dcu_programming/DCU_programming_chapter3_7.html

2022/5/16
L
lizhigong
1楼

您好,照着您的代码试了一下,rocprof --trace-start off没有效果,可以在程序开始时手动调用roctracer_stop(),解决这个问题。

2022/5/7
M
mhaohit
回复 @lizhigong

然而手动调用roctracer_stop()一样没有效果。

2022/5/15
没有更多内容了
--
楼主
Level.4
0 帖子
楼主热帖
暂无数据