Unverified Commit b31acf90 authored by one's avatar one Committed by GitHub
Browse files

Fix some lint warnings (#3)

* Fix some lint warnings
* Exclude some paths in cpplint
* Fix some tests and formatting
parent 37a70cbe
# Copyright (c) Microsoft Corporation. # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License. # Licensed under the MIT License.
CPPSOURCES := $(shell find $(CURDIR) -regextype posix-extended -regex '.*\.(c|cpp|h|hpp|cc|cxx|cu)') CPPSOURCES := $(shell find $(CURDIR) \
-path $(CURDIR)/.git -prune -o \
-path $(CURDIR)/.venv -prune -o \
-path $(CURDIR)/build -prune -o \
-path $(CURDIR)/third_party -prune -o \
-regextype posix-extended -regex '.*\.(c|cpp|h|hpp|cc|cxx|cu)' -print)
CLANG_FORMAT ?= clang-format-14
.PHONY: cpplint cppformat cppbuild thirdparty postinstall .PHONY: cpplint cppformat cppbuild thirdparty postinstall
cpplint: cpplint:
clang-format --verbose --dry-run --Werror $(CPPSOURCES) $(CLANG_FORMAT) --verbose --dry-run --Werror $(CPPSOURCES)
cppformat: cppformat:
clang-format --verbose -i $(CPPSOURCES) $(CLANG_FORMAT) --verbose -i $(CPPSOURCES)
cppbuild: cppbuild:
cd ./superbench/benchmarks/ && bash build.sh cd ./superbench/benchmarks/ && bash build.sh
......
...@@ -253,7 +253,7 @@ def add_parser_arguments(self): ...@@ -253,7 +253,7 @@ def add_parser_arguments(self):
help='Set default device to be used for the benchmark process.', help='Set default device to be used for the benchmark process.',
) )
def _preprocess(self): def _preprocess(self): # noqa: C901
"""Preprocess/preparation operations before the benchmarking. """Preprocess/preparation operations before the benchmarking.
Return: Return:
......
...@@ -126,7 +126,6 @@ def _process_raw_result(self, cmd_idx, raw_output): ...@@ -126,7 +126,6 @@ def _process_raw_result(self, cmd_idx, raw_output):
batch_count_index = header.index('batch_count') batch_count_index = header.index('batch_count')
m_index = header.index('m') m_index = header.index('m')
n_index = header.index('n')
k_index = header.index('k') k_index = header.index('k')
gflops_index = header.index('hipblaslt-Gflops') gflops_index = header.index('hipblaslt-Gflops')
......
...@@ -1046,9 +1046,9 @@ int RunAllToAllBench(const Opts &opts, int gpu_count, int src_rank, int dst_rank ...@@ -1046,9 +1046,9 @@ int RunAllToAllBench(const Opts &opts, int gpu_count, int src_rank, int dst_rank
return -1; return -1;
} }
} }
SMOneToAllCopyKernel<<<gpu_count * opts.all_to_all_num_thread_blocks_per_rank, SMOneToAllCopyKernel<<<gpu_count * opts.all_to_all_num_thread_blocks_per_rank, thread_block_size, 0,
thread_block_size, 0, streams[rank]>>>( streams[rank]>>>((ulong2 **)dst_buffer_gpu_args[rank],
(ulong2 **)dst_buffer_gpu_args[rank], (ulong2 *)src_buffers_gpu[rank], opts.size, rank, dst_rank, (ulong2 *)src_buffers_gpu[rank], opts.size, rank, dst_rank,
gpu_count); gpu_count);
if (i == opts.num_warm_up + opts.num_loops - 1) { if (i == opts.num_warm_up + opts.num_loops - 1) {
cuda_err = cudaEventRecord(stop_events[rank], streams[rank]); cuda_err = cudaEventRecord(stop_events[rank], streams[rank]);
......
...@@ -530,7 +530,7 @@ def __merge_monitor_metrics(self, node_path): ...@@ -530,7 +530,7 @@ def __merge_monitor_metrics(self, node_path):
return metrics_summary return metrics_summary
def _run_proc(self, benchmark_name, mode, vars): def _run_proc(self, benchmark_name, mode, vars): # noqa: C901
"""Run the process. """Run the process.
Args: Args:
......
...@@ -99,7 +99,8 @@ def test_hipblaslt_gemm_result_parsing(self): ...@@ -99,7 +99,8 @@ def test_hipblaslt_gemm_result_parsing(self):
Is supported 1 / Total solutions: 1 Is supported 1 / Total solutions: 1
[0]:transA,transB,grouped_gemm,batch_count,m,n,k,alpha,lda,stride_a,beta,ldb,stride_b,ldc,stride_c,ldd,stride_d,a_type,b_type,c_type,d_type,compute_type,scaleA,scaleB,scaleC,scaleD,amaxD,activation_type,bias_vector,bias_type,hipblaslt-Gflops,us [0]:transA,transB,grouped_gemm,batch_count,m,n,k,alpha,lda,stride_a,beta,ldb,stride_b,ldc,stride_c,ldd,stride_d,a_type,b_type,c_type,d_type,compute_type,scaleA,scaleB,scaleC,scaleD,amaxD,activation_type,bias_vector,bias_type,hipblaslt-Gflops,us
N,N,0,1,4096,4096,4096,1,4096,16777216,0,4096,16777216,4096,16777216,4096,16777216,f32_r,f32_r,f32_r,f32_r,f32_r,0,0,0,0,0,none,0,non-supported type,1595.18,86159.1 N,N,0,1,4096,4096,4096,1,4096,16777216,0,4096,16777216,4096,16777216,4096,16777216,
f32_r,f32_r,f32_r,f32_r,f32_r,0,0,0,0,0,none,0,non-supported type,1595.18,86159.1
""" """
self.assertTrue(benchmark._process_raw_result(0, example_raw_output)) self.assertTrue(benchmark._process_raw_result(0, example_raw_output))
self.assertEqual(ReturnCode.SUCCESS, benchmark.return_code) self.assertEqual(ReturnCode.SUCCESS, benchmark.return_code)
......
...@@ -188,7 +188,7 @@ def test_get_mode_command(self): ...@@ -188,7 +188,7 @@ def test_get_mode_command(self):
}, },
'expected_command': ( 'expected_command': (
'mpirun -tag-output -allow-run-as-root -hostfile hostfile -map-by ppr:8:node -bind-to numa ' 'mpirun -tag-output -allow-run-as-root -hostfile hostfile -map-by ppr:8:node -bind-to numa '
'-mca coll_hcoll_enable 0 -x SB_MICRO_PATH=/sb -x FOO=BAR -x RANK=2 -x NUM=8 ' '-mca coll_hcoll_enable 0 -x "SB_MICRO_PATH=/sb" -x "FOO=BAR" -x "RANK=2" -x "NUM=8" '
f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo'
), ),
}, },
...@@ -213,7 +213,7 @@ def test_get_mode_command(self): ...@@ -213,7 +213,7 @@ def test_get_mode_command(self):
}, },
'expected_command': ( 'expected_command': (
'mpirun -tag-output -allow-run-as-root -host localhost:8 -bind-to numa ' 'mpirun -tag-output -allow-run-as-root -host localhost:8 -bind-to numa '
'-mca coll_hcoll_enable 0 -x SB_MICRO_PATH=/sb -x FOO=BAR -x RANK=2 -x NUM=8 ' '-mca coll_hcoll_enable 0 -x "SB_MICRO_PATH=/sb" -x "FOO=BAR" -x "RANK=2" -x "NUM=8" '
f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo'
), ),
}, },
...@@ -225,6 +225,7 @@ def test_get_mode_command(self): ...@@ -225,6 +225,7 @@ def test_get_mode_command(self):
'node_num': 1, 'node_num': 1,
'proc_num': 4, 'proc_num': 4,
'proc_rank': 1, 'proc_rank': 1,
'bind_to': 'numa',
'mca': {}, 'mca': {},
'env': { 'env': {
'NCCL_BUFFSIZE': 4194304, 'NCCL_BUFFSIZE': 4194304,
...@@ -233,7 +234,7 @@ def test_get_mode_command(self): ...@@ -233,7 +234,7 @@ def test_get_mode_command(self):
}, },
}, },
'expected_command': ( 'expected_command': (
"mpirun -tag-output -allow-run-as-root -host localhost:4 -bind-to numa " 'mpirun -tag-output -allow-run-as-root -host localhost:4 -bind-to numa '
'-x "NCCL_BUFFSIZE=4194304" -x "NCCL_RINGS=0 1 2 3|0 3 2 1" -x PATH ' '-x "NCCL_BUFFSIZE=4194304" -x "NCCL_RINGS=0 1 2 3|0 3 2 1" -x PATH '
f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo'
), ),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment