-
Notifications
You must be signed in to change notification settings - Fork 10
use dmabuf option when the ibperf binaries have them configured #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
37cd488
de6cc87
3b0595e
6cef5d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,10 @@ | |
|
|
||
| from cvs.lib.utils_lib import * | ||
|
|
||
| from cvs.lib import globals | ||
|
|
||
| log = globals.log | ||
|
|
||
|
|
||
| def detect_rocm_path(phdl, config_rocm_path): | ||
| """ | ||
|
|
@@ -64,6 +68,39 @@ def detect_rocm_path(phdl, config_rocm_path): | |
| return '/opt/rocm' | ||
|
|
||
|
|
||
| def check_perftest_dmabuf_support(shdl, binary_path, head_node): | ||
| """ | ||
| Check if the given perftest binary on the cluster node supports the | ||
| --use_rocm_dmabuf flag by executing the binary's help output and | ||
| grepping for the flag. | ||
|
|
||
| Args: | ||
| phdl: Pssh handle used to execute commands on one or more cluster nodes. | ||
| binary_path (str): Full path to the perftest binary on the node. | ||
|
|
||
| Returns: | ||
| bool: True if the binary supports --use_rocm_dmabuf on any host, | ||
| False otherwise. | ||
| """ | ||
| cmd = f'{binary_path} --help 2>&1 | grep use_rocm_dmabuf | wc -l' | ||
| log.info("Checking dmabuf support: %s", cmd) | ||
| dmabuf_available = False | ||
|
|
||
| # if head_node is None, that would be a programming error | ||
| # but we still cover the edge case | ||
| if head_node is None: | ||
| log.warning("ibperf dmabuf check failed: head_node is None, check programming and re-run") | ||
| return dmabuf_available | ||
| try: | ||
| dmabuf_check_out = shdl.exec(cmd) | ||
| dmabuf_available = int(dmabuf_check_out[head_node].strip()) > 0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dmabuf_check_out = shdl.exec(cmd) We can use above logic, without head_node argument, the for loop will iterate once as the dmabuf_check_out will have ouptput from one node(head_node) |
||
| log.info("dmabuf available in ibperf build" if dmabuf_available else "dmabuf not available in ibperf build") | ||
| return dmabuf_available | ||
| except Exception as e: | ||
| log.warning(f"ibperf dmabuf check failed: {e}") | ||
| return dmabuf_available | ||
|
|
||
|
|
||
| def get_ib_bw_pps(phdl, msg_size, cmd): | ||
| res_dict = {} | ||
|
|
||
|
|
@@ -177,6 +214,7 @@ def verify_expected_lat(lat_test, msg_size, res_dict, expected_res): | |
|
|
||
|
|
||
| def run_ib_perf_bw_test( | ||
| shdl, | ||
| phdl, | ||
| bw_test, | ||
| gpu_numa_dict, | ||
|
|
@@ -189,6 +227,7 @@ def run_ib_perf_bw_test( | |
| port_no=1516, | ||
| duration=60, | ||
| rocm_path='', | ||
| cluster_node_list=None, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We no need to pass cluster_node_list , because shdl is connection handle to head node only |
||
| ): | ||
| app_port = port_no | ||
| result_dict = {} | ||
|
|
@@ -201,6 +240,11 @@ def run_ib_perf_bw_test( | |
| log.info(f'Setting LD_LIBRARY_PATH to {rocm_path}/lib for perftest binaries') | ||
| phdl.exec(f'echo "export LD_LIBRARY_PATH={rocm_path}/lib:$LD_LIBRARY_PATH" >> /tmp/ib_cmds_file.txt') | ||
| server_addr = None | ||
|
|
||
| # if cluster_node_list is None that would be programming error | ||
| if cluster_node_list: | ||
| head_node = cluster_node_list[0] | ||
| dmabuf_supported = check_perftest_dmabuf_support(shdl, f'{app_path}/{bw_test}', head_node) | ||
| for node in bck_nic_dict.keys(): | ||
| result_dict[node] = {} | ||
| cmd_dict[node] = [] | ||
|
|
@@ -215,7 +259,15 @@ def run_ib_perf_bw_test( | |
| for gpu_no in range(0, 8): | ||
| card_no = 'card' + str(gpu_no) | ||
| rdma_dev = gpu_nic_dict[node][card_no]['rdma_dev'] | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{bw_test} -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -b -F -D {duration} -p {port_no} -s {msg_size} -q {qp_count} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| if dmabuf_supported: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can simplify like below to avoid code duplication in if else ` cmd = " ".join(cmd_parts) + f" > /tmp/ib_perf_{inst_count}_logs 2>&1 &" |
||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{bw_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} --use_rocm_dmabuf -x {gid_index} --report_gbits -b -F -D {duration} -p {port_no} \ | ||
| -s {msg_size} -q {qp_count} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| else: | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{bw_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -b -F -D {duration} -p {port_no} \ | ||
| -s {msg_size} -q {qp_count} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
|
|
||
| cmd_dict[node].append(f'echo "{cmd}" >> /tmp/ib_cmds_file.txt') | ||
| inst_count = inst_count + 1 | ||
| port_no = port_no + 1 | ||
|
|
@@ -228,7 +280,14 @@ def run_ib_perf_bw_test( | |
| for gpu_no in range(0, 8): | ||
| card_no = 'card' + str(gpu_no) | ||
| rdma_dev = gpu_nic_dict[node][card_no]['rdma_dev'] | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{bw_test} -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -b -F -D {duration} -p {port_no} -s {msg_size} -q {qp_count} {server_addr} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| if dmabuf_supported: | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{bw_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} --use_rocm_dmabuf -x {gid_index} --report_gbits -b -F -D {duration} -p {port_no} \ | ||
| -s {msg_size} -q {qp_count} {server_addr} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| else: | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{bw_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -b -F -D {duration} -p {port_no} \ | ||
| -s {msg_size} -q {qp_count} {server_addr} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| cmd_dict[node].append(f'echo "{cmd}" >> /tmp/ib_cmds_file.txt') | ||
| inst_count = inst_count + 1 | ||
| port_no = port_no + 1 | ||
|
|
@@ -269,7 +328,18 @@ def run_ib_perf_bw_test( | |
|
|
||
|
|
||
| def run_ib_perf_lat_test( | ||
| phdl, lat_test, gpu_numa_dict, gpu_nic_dict, bck_nic_dict, app_path, msg_size, gid_index, port_no=1516, rocm_path='' | ||
| shdl, | ||
| phdl, | ||
| lat_test, | ||
| gpu_numa_dict, | ||
| gpu_nic_dict, | ||
| bck_nic_dict, | ||
| app_path, | ||
| msg_size, | ||
| gid_index, | ||
| port_no=1516, | ||
| rocm_path='', | ||
| cluster_node_list=None, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We no need to pass cluster_node_list , because shdl is connection handle to head node only |
||
| ): | ||
| app_port = port_no | ||
| result_dict = {} | ||
|
|
@@ -282,6 +352,10 @@ def run_ib_perf_lat_test( | |
| log.info(f'Setting LD_LIBRARY_PATH to {rocm_path}/lib for perftest binaries') | ||
| phdl.exec(f'echo "export LD_LIBRARY_PATH={rocm_path}/lib:$LD_LIBRARY_PATH" >> /tmp/ib_cmds_file.txt') | ||
| server_addr = None | ||
| # if cluster_node_list is None that would be programming error | ||
| if cluster_node_list: | ||
| head_node = cluster_node_list[0] | ||
| dmabuf_supported = check_perftest_dmabuf_support(shdl, f'{app_path}/{lat_test}', head_node) | ||
| for node in bck_nic_dict.keys(): | ||
| result_dict[node] = {} | ||
| cmd_dict[node] = [] | ||
|
|
@@ -296,7 +370,15 @@ def run_ib_perf_lat_test( | |
| for gpu_no in range(0, 8): | ||
| card_no = 'card' + str(gpu_no) | ||
| rdma_dev = gpu_nic_dict[node][card_no]['rdma_dev'] | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{lat_test} -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -F -p {port_no} -s {msg_size} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| if dmabuf_supported: | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{lat_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} --use_rocm_dmabuf -x {gid_index} --report_gbits -F -p {port_no} \ | ||
| -s {msg_size} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| else: | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{lat_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -F -p {port_no} \ | ||
| -s {msg_size} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
|
|
||
| cmd_dict[node].append(f'echo "{cmd}" >> /tmp/ib_cmds_file.txt') | ||
| inst_count = inst_count + 1 | ||
| port_no = port_no + 1 | ||
|
|
@@ -309,7 +391,14 @@ def run_ib_perf_lat_test( | |
| for gpu_no in range(0, 8): | ||
| card_no = 'card' + str(gpu_no) | ||
| rdma_dev = gpu_nic_dict[node][card_no]['rdma_dev'] | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{lat_test} -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -F -p {port_no} -s {msg_size} {server_addr} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| if dmabuf_supported: | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{lat_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} --use_rocm_dmabuf -x {gid_index} --report_gbits -F -p {port_no} \ | ||
| -s {msg_size} {server_addr} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| else: | ||
| cmd = f'numactl --physcpubind={gpu_numa_dict[node][card_no]["local_cpulist"]} --localalloc {app_path}/{lat_test} \ | ||
| -d {rdma_dev} --use_rocm={gpu_no} -x {gid_index} --report_gbits -F -p {port_no} \ | ||
| -s {msg_size} {server_addr} > /tmp/ib_perf_{inst_count}_logs & 2>&1' | ||
| cmd_dict[node].append(f'echo "{cmd}" >> /tmp/ib_cmds_file.txt') | ||
| inst_count = inst_count + 1 | ||
| port_no = port_no + 1 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no need to pass head_node to this function, because shdl isa Pssh instance with only one node in the list(head_node) refer https://github.com/ROCm/cvs/pull/235/changes#diff-fc999b79285f07a1d04220513c8cc33f07b30514861fdf7baea8058c53a85bd8R170