From 7176010f68b46c67b713e3078cc2418dd57bd9ae Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Tue, 15 Feb 2022 13:52:44 -0800 Subject: [PATCH] Add missing libkineto_defs.bzl for LoggerObserver Implementation (#529) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Pull Request resolved: https://github.com/pytorch/kineto/pull/529 The bazel definition file was not updated when the Logger Observer Implementation was committed. This causes link time failures due to missing definitions for CPU library in PyTorch. Test Plan: Fixes a failure in PyTorch builds: ``` [7/60] Building CXX object third_party/kineto/libkineto/CMakeFiles/kineto_base.dir/src/Logger.cpp.o /scratch/aaronshi/pytorch/third_party/kineto/libkineto/src/Logger.cpp:28:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] #pragma GCC diagnostic ignored "-Wglobal-constructors" ^~~~~~~~~~~~~~~~~~~~~~~ [33/60] Linking CXX executable bin/ProcessGroupMPITest FAILED: bin/ProcessGroupMPITest : && /data/shared/bin/c++ -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -DNDEBUG -rdynamic -Wl,-rpath -Wl,/opt/amazon/openmpi/lib -Wl,--enable-new-dtags -pthread test_cpp_c10d/CMakeFiles/ProcessGroupMPITest.dir/ProcessGroupMPITest.cpp.o -o bin/ProcessGroupMPITest -Wl,-rpath,/scratch/aaronshi/pytorch/build/lib:/opt/amazon/openmpi/lib:/fsx/users/aaronshi/conda/envs/pytorch37/lib: lib/libtorch_cpu.so /opt/amazon/openmpi/lib/libmpi.so -lpthread lib/libprotobuf.a lib/libc10.so -pthread /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_intel_lp64.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_gnu_thread.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_core.so -fopenmp -lpthread -lm /usr/lib/x86_64-linux-gnu/libdl.so && : lib/libtorch_cpu.so: undefined reference to `libkineto::toString(libkineto::LoggerOutputType)' collect2: error: ld returned 1 exit status [34/60] Linking CXX executable bin/HashStoreTest FAILED: bin/HashStoreTest : && /data/shared/bin/c++ -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -DNDEBUG -rdynamic -Wl,-rpath -Wl,/opt/amazon/openmpi/lib -Wl,--enable-new-dtags -pthread test_cpp_c10d/CMakeFiles/HashStoreTest.dir/HashStoreTest.cpp.o -o bin/HashStoreTest -Wl,-rpath,/scratch/aaronshi/pytorch/build/lib:/fsx/users/aaronshi/conda/envs/pytorch37/lib: lib/libtorch_cpu.so lib/libgtest_main.a -lpthread lib/libprotobuf.a lib/libc10.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_intel_lp64.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_gnu_thread.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_core.so -fopenmp -lpthread -lm /usr/lib/x86_64-linux-gnu/libdl.so lib/libgtest.a -pthread && : lib/libtorch_cpu.so: undefined reference to `libkineto::toString(libkineto::LoggerOutputType)' collect2: error: ld returned 1 exit status [35/60] Linking CXX executable bin/TCPStoreTest FAILED: bin/TCPStoreTest : && /data/shared/bin/c++ -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -DNDEBUG -rdynamic -Wl,-rpath -Wl,/opt/amazon/openmpi/lib -Wl,--enable-new-dtags -pthread test_cpp_c10d/CMakeFiles/TCPStoreTest.dir/TCPStoreTest.cpp.o -o bin/TCPStoreTest -Wl,-rpath,/scratch/aaronshi/pytorch/build/lib:/fsx/users/aaronshi/conda/envs/pytorch37/lib: lib/libtorch_cpu.so lib/libgtest_main.a -lpthread lib/libprotobuf.a lib/libc10.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_intel_lp64.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_gnu_thread.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_core.so -fopenmp -lpthread -lm /usr/lib/x86_64-linux-gnu/libdl.so lib/libgtest.a -pthread && : lib/libtorch_cpu.so: undefined reference to `libkineto::toString(libkineto::LoggerOutputType)' collect2: error: ld returned 1 exit status [36/60] Linking CXX executable bin/FileStoreTest FAILED: bin/FileStoreTest : && /data/shared/bin/c++ -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -DNDEBUG -rdynamic -Wl,-rpath -Wl,/opt/amazon/openmpi/lib -Wl,--enable-new-dtags -pthread test_cpp_c10d/CMakeFiles/FileStoreTest.dir/FileStoreTest.cpp.o -o bin/FileStoreTest -Wl,-rpath,/scratch/aaronshi/pytorch/build/lib:/fsx/users/aaronshi/conda/envs/pytorch37/lib: lib/libtorch_cpu.so lib/libgtest_main.a -lpthread lib/libprotobuf.a lib/libc10.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_intel_lp64.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_gnu_thread.so /fsx/users/aaronshi/conda/envs/pytorch37/lib/libmkl_core.so -fopenmp -lpthread -lm /usr/lib/x86_64-linux-gnu/libdl.so lib/libgtest.a -pthread && : lib/libtorch_cpu.so: undefined reference to `libkineto::toString(libkineto::LoggerOutputType)' collect2: error: ld returned 1 exit status [37/60] Linking CXX shared library lib/libtorch_cuda.so ninja: build stopped: subcommand failed. ``` Reviewed By: briancoutinho Differential Revision: D34227122 Pulled By: aaronenyeshi fbshipit-source-id: b44989430c9aa9a61c17c4adde30195013fc1199 --- libkineto/libkineto_defs.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libkineto/libkineto_defs.bzl b/libkineto/libkineto_defs.bzl index ecf913a26..330c54a22 100644 --- a/libkineto/libkineto_defs.bzl +++ b/libkineto/libkineto_defs.bzl @@ -42,6 +42,7 @@ def get_libkineto_cpu_only_srcs(with_api = True): "src/CuptiActivityApi.cpp", "src/Demangle.cpp", "src/GenericTraceActivity.cpp", + "src/ILoggerObserver.cpp", "src/Logger.cpp", "src/init.cpp", "src/output_csv.cpp", @@ -58,6 +59,7 @@ def get_libkineto_public_headers(): "include/GenericTraceActivity.h", "include/GenericTraceActivity.h", "include/IActivityProfiler.h", + "include/ILoggerObserver.h", "include/ITraceActivity.h", "include/TraceSpan.h", "include/ThreadUtil.h",