Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
update profling log when NS_PROFILING is OFF
Browse files Browse the repository at this point in the history
Signed-off-by: zhenwei-intel <[email protected]>
  • Loading branch information
zhenwei-intel committed Jan 31, 2024
1 parent bb80273 commit ae2ac1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neural_speed/core/ne_layers.c
Original file line number Diff line number Diff line change
Expand Up @@ -10882,6 +10882,7 @@ void ne_graph_compute(struct ne_context* ctx, struct ne_cgraph* cgraph) {
}

void ne_graph_profiling(const struct ne_cgraph* cgraph) {
#ifdef NS_PERF
int64_t perf_total_per_op_us[NE_OP_COUNT] = {0};

NE_PRINT("=== GRAPH Profiling ===\n");
Expand All @@ -10904,6 +10905,10 @@ void ne_graph_profiling(const struct ne_cgraph* cgraph) {
}
NE_PRINT("perf_total_per_op_us[%24s] = %7.3f ms\n", "INNER PRODUCT", (double)ip_duration / 1000.0);
NE_PRINT("========================================\n");

#else
NE_PRINT("\n[Warning] To collect profiling data, please recompile with NS_PROFILING=ON.\n");
#endif
}

void ne_graph_reset(struct ne_cgraph* cgraph) {
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
extdir = ext_fullpath.parent.resolve()

output_dir = f"{extdir}{os.sep}"
NS_PROFILING_ENV = os.environ.get("NS_PROFILING", "OFF")
cmake_args = [
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={output_dir}",
f"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY={output_dir}",
Expand All @@ -104,6 +105,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"-DNS_WITH_AVX2={'ON' if NS_WITH_AVX2 else 'OFF'}",
f"-DNS_WITH_TESTS=OFF",
f"-DNS_PYTHON_API=ON",
f"-DNS_PROFILING={NS_PROFILING_ENV}",
]
if sys.platform == "linux": # relative_rpath
cmake_args.append('-DCMAKE_BUILD_RPATH=$ORIGIN/')
Expand Down

0 comments on commit ae2ac1f

Please sign in to comment.