Skip to content

Commit 5363c82

Browse files
authored
Revert "Correct the setting of profiler to nvprof to get precise gpu_time. (#1214)" (#1217)
This reverts commit 97612cd.
1 parent 97612cd commit 5363c82

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

api/common/launch.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ def run(self, cmd):
4040
parse_status, gpu_time = self._parse_logs(stdout.split("\n"))
4141
if parse_status:
4242
return gpu_time
43-
print("Running Error:\n {}".format(stdout))
43+
print("Runing Error:\n {}".format(stdout))
4444
return 0.0
4545

4646
def _nvprof(self, cmd):
47-
return system.run_command("nvprof --profile-from-start off {}".format(
48-
cmd))
47+
#return system.run_command("nvprof --profile-from-start off {}".format(
48+
# cmd))
49+
return system.run_command("nvprof {}".format(cmd))
4950

5051
def _parse_logs(self, logs):
5152
line_from = None
@@ -97,12 +98,13 @@ def run(self, cmd):
9798
parse_status, gpu_time = self._parse_logs(stdout.split("\n"))
9899
if parse_status:
99100
return gpu_time
100-
print("Running Error:\n {}".format(stdout))
101+
print("Runing Error:\n {}".format(stdout))
101102
return 0.0
102103

103104
def _nsight(self, cmd):
104-
return system.run_command(
105-
"nsys nvprof --profile-from-start=off -o tmp.qdrep {}".format(cmd))
105+
#return system.run_command(
106+
# "nsys nvprof --profile-from-start=off -o tmp.qdrep {}".format(cmd))
107+
return system.run_command("nsys nvprof -o tmp.qdrep {}".format(cmd))
106108

107109
def _parse_logs(self, logs):
108110
kernel_line_from = None
@@ -174,17 +176,16 @@ def launch(benchmark_script, benchmark_script_args, with_nvprof=False):
174176
"""
175177

176178
def _set_profiler(args, value):
177-
if "--profiler" in args:
178-
for i in range(len(args)):
179-
if args[i] == "--profiler":
180-
args[i + 1] = value
181-
break
182-
else:
179+
for i in range(len(args)):
180+
if args[i] == "--profiler":
181+
args[i + 1] = value
182+
break
183+
if i >= len(args):
183184
args.append("--profiler")
184185
args.append(value)
185186

186-
if with_nvprof:
187-
_set_profiler(benchmark_script_args, "nvprof")
187+
#if with_nvprof:
188+
# _set_profiler(benchmark_script_args, "nvprof")
188189
cmd = "{} {} {}".format(sys.executable, benchmark_script,
189190
" ".join(benchmark_script_args))
190191
if with_nvprof:
@@ -193,7 +194,7 @@ def _set_profiler(args, value):
193194
else:
194195
runner = NvprofRunner()
195196
gpu_time = runner.run(cmd)
196-
_set_profiler(benchmark_script_args, "none")
197+
#_set_profiler(benchmark_script_args, "none")
197198
return gpu_time
198199
else:
199200
stdout, exit_code = system.run_command(cmd)

api/run_op_benchmark.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ install_package() {
2323
installed_version=`python -c "import ${package_name}; print(${package_name}.__version__)"`
2424
if [ "${installed_version}" > "${package_version}" ]; then
2525
echo "-- ${package_name} ${installed_version} (newer than ${package_version}) is already installed."
26-
elif [ "${installed_version}" == "${package_version}" ]; then
26+
elif [ "${installed_version}" = "${package_version}" ]; then
2727
echo "-- ${package_name} ${package_version} is already installed."
2828
else
2929
echo "-- Update ${package_name}: ${installed_version} -> ${package_version}"

0 commit comments

Comments
 (0)