attach/detach: change workload of unit test to accommodate SDK's current limitation (#1169)
* add double mode of workload dynamic_share with on remove sleeping and set ROCP_TOOL_ATTACH=1 for running workload * add comment in dynamic_shared.hip to exaplain how to use argv * refactor the attach/detach profiling time in unit tests
This commit is contained in:
@@ -71,6 +71,9 @@ config["METRIC_LOGGING"] = False
|
||||
num_kernels = 3
|
||||
num_devices = 1
|
||||
|
||||
attach_detach_interval_msec_no_delay = 10000
|
||||
attach_detach_interval_msec_with_delay = 60000
|
||||
|
||||
DEFAULT_ABS_DIFF = 15
|
||||
DEFAULT_REL_DIFF = 50
|
||||
MAX_REOCCURING_COUNT = 28
|
||||
@@ -1778,14 +1781,75 @@ def test_pc_sampling_stochastic(binary_handler_profile_rocprof_compute):
|
||||
def test_live_attach_detach_block(binary_handler_profile_rocprof_compute):
|
||||
options = ["--block", "3.1.1", "4.1.1", "5.1.1"]
|
||||
workload_dir = test_utils.get_output_dir()
|
||||
process_workload = subprocess.Popen(config["app_hip_dynamic_shared"])
|
||||
# TODO: temp fix for sdk defautly disable attach/detach,
|
||||
# remove after it sets default to enable
|
||||
env = os.environ.copy()
|
||||
env["ROCP_TOOL_ATTACH"] = "1"
|
||||
|
||||
# set the time to detach here to 1 mins, which is 60000 msec
|
||||
time_to_detach = "60000"
|
||||
process_workload = subprocess.Popen(config["app_hip_dynamic_shared"], env=env)
|
||||
|
||||
attach_detach = dict()
|
||||
attach_detach["attach_pid"] = process_workload.pid
|
||||
attach_detach["attach-duration-msec"] = time_to_detach
|
||||
attach_detach["attach-duration-msec"] = attach_detach_interval_msec_no_delay
|
||||
|
||||
_ = binary_handler_profile_rocprof_compute(
|
||||
config,
|
||||
workload_dir,
|
||||
options,
|
||||
check_success=True,
|
||||
roof=False,
|
||||
app_name="app_hip_dynamic_shared",
|
||||
attach_detach_para=attach_detach,
|
||||
)
|
||||
|
||||
# kill the process of the workload at thsi point if it's still running
|
||||
if process_workload.poll() is None:
|
||||
print(
|
||||
f"rocprof-compute has detached and finished, "
|
||||
f"killing workload process (pid={process_workload.pid})..."
|
||||
)
|
||||
process_workload.kill()
|
||||
process_workload.wait()
|
||||
|
||||
file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels)
|
||||
validate(
|
||||
inspect.stack()[0][3],
|
||||
workload_dir,
|
||||
file_dict,
|
||||
)
|
||||
|
||||
assert test_utils.check_file_pattern(
|
||||
"- 3.1.1", f"{workload_dir}/profiling_config.yaml"
|
||||
)
|
||||
assert test_utils.check_file_pattern(
|
||||
"- 4.1.1", f"{workload_dir}/profiling_config.yaml"
|
||||
)
|
||||
assert test_utils.check_file_pattern(
|
||||
"- 5.1.1", f"{workload_dir}/profiling_config.yaml"
|
||||
)
|
||||
test_utils.clean_output_dir(config["cleanup"], workload_dir)
|
||||
|
||||
|
||||
@pytest.mark.skip(
|
||||
reason="Temporarily disabled: \
|
||||
waiting for SDK fix for no outputfile with thread sleeping"
|
||||
)
|
||||
@pytest.mark.live_attach_detach
|
||||
def test_live_attach_detach_block_thread_sleep(binary_handler_profile_rocprof_compute):
|
||||
options = ["--block", "3.1.1", "4.1.1", "5.1.1"]
|
||||
workload_dir = test_utils.get_output_dir()
|
||||
# TODO: temp fix for sdk defautly disable attach/detach,
|
||||
# remove after it sets default to enable
|
||||
env = os.environ.copy()
|
||||
env["ROCP_TOOL_ATTACH"] = "1"
|
||||
|
||||
process_workload = subprocess.Popen(
|
||||
[config["app_hip_dynamic_shared"], "--enable-sleep"], env=env
|
||||
)
|
||||
|
||||
attach_detach = dict()
|
||||
attach_detach["attach_pid"] = process_workload.pid
|
||||
attach_detach["attach-duration-msec"] = attach_detach_interval_msec_with_delay
|
||||
|
||||
_ = binary_handler_profile_rocprof_compute(
|
||||
config,
|
||||
@@ -1831,14 +1895,17 @@ def test_live_attach_detach_singlepath_launch_stats(
|
||||
):
|
||||
options = ["--set", "launch_stats"]
|
||||
workload_dir = test_utils.get_output_dir()
|
||||
process_workload = subprocess.Popen(config["app_hip_dynamic_shared"])
|
||||
|
||||
# set the time to detach here to 1 mins, which is 60000 msec
|
||||
time_to_detach = "60000"
|
||||
# TODO: temp fix for sdk defautly disable attach/detach,
|
||||
# remove after it sets default to enable
|
||||
env = os.environ.copy()
|
||||
env["ROCP_TOOL_ATTACH"] = "1"
|
||||
|
||||
process_workload = subprocess.Popen(config["app_hip_dynamic_shared"], env=env)
|
||||
|
||||
attach_detach = dict()
|
||||
attach_detach["attach_pid"] = process_workload.pid
|
||||
attach_detach["attach-duration-msec"] = time_to_detach
|
||||
attach_detach["attach-duration-msec"] = attach_detach_interval_msec_no_delay
|
||||
|
||||
_ = binary_handler_profile_rocprof_compute(
|
||||
config,
|
||||
|
||||
Reference in New Issue
Block a user