FS#66436 - [python-pytorch-cuda] Cmake display warnings when using find_package(Torch)
Attached to Project:
Community Packages
Opened by Benjamin Charlier (bcharlier) - Monday, 27 April 2020, 15:26 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Tuesday, 28 April 2020, 19:43 GMT
Opened by Benjamin Charlier (bcharlier) - Monday, 27 April 2020, 15:26 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Tuesday, 28 April 2020, 19:43 GMT
|
Details
Dear Maintainer,
Description: Trying to reproduce the simple example described here: https://pytorch.org/tutorials/advanced/cpp_frontend.html. I realize that the files /usr/lib64/cmake/Caffe2Config.cmake /usr/lib64/cmake/Gloo/GlooConfig.cmake /usr/lib64/cmake/Torch/Config.cmake have some references (in the comments) to <install-prefix>/share/cmake/Caffe2Config.cmake <install-prefix>/share/cmake/Gloo/GlooConfig.cmake <install-prefix>/share/cmake/Torch/Config.cmake It makes cmake throwing warnings during configuration. I guess that some paths should be update in the ***Config.cmake files to fit the directory structure of Arch. Additional info: * package version(s): 1.5.0-2 * config and/or log files etc. * link to upstream bug report, if any Steps to reproduce: I am compiling the following project with 2 files : ``` dcgan/ CMakeLists.txt dcgan.cpp ``` The 'CMakeLists.txt' file contains ``` cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(dcgan) set(CMAKE_PREFIX_PATH "/usr/lib/python3.8/site-packages/torch/") find_package(Torch REQUIRED) add_executable(dcgan dcgan.cpp) target_link_libraries(dcgan "${TORCH_LIBRARIES}") set_property(TARGET dcgan PROPERTY CXX_STANDARD 14) ``` and the main file 'dcgan.cpp' contains ``` #include <torch/torch.h> #include <iostream> int main() { torch::Tensor tensor = torch::eye(3); std::cout << tensor << std::endl; } ``` Buildig the project, cmake throw warnings: ``` ... -- Caffe2: Found gflags with new-style gflags target. -- Caffe2: Cannot find glog automatically. Using legacy find. CMake Warning (dev) at /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message): The package name passed to `find_package_handle_standard_args` (glog) does not match the name of the calling package (Caffe2). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern. Call Stack (most recent call first): /usr/lib64/cmake/Caffe2/public/glog.cmake:49 (find_package_handle_standard_args) /usr/lib64/cmake/Caffe2/Caffe2Config.cmake:36 (include) /usr/lib64/cmake/Torch/TorchConfig.cmake:40 (find_package) CMakeLists.txt:5 (find_package) This warning is for project developers. Use -Wno-dev to suppress it. ... CMake Warning (dev) at /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message): The package name passed to `find_package_handle_standard_args` (torch) does not match the name of the calling package (Torch). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern. Call Stack (most recent call first): /usr/lib64/cmake/Torch/TorchConfig.cmake:130 (find_package_handle_standard_args) CMakeLists.txt:5 (find_package) This warning is for project developers. Use -Wno-dev to suppress it. ... ``` |
This task depends upon
Closed by Sven-Hendrik Haase (Svenstaro)
Tuesday, 28 April 2020, 19:43 GMT
Reason for closing: Won't fix
Tuesday, 28 April 2020, 19:43 GMT
Reason for closing: Won't fix
That being said, Pytorch c++ api has evolved a lot between 1.4 and 1.5 and I am experiencing problems building C++/cuda codes with this new api (codes were working with previous versions of pytorch). There are missing symbols in the compiled binary whereas the shared object dependencies list is suspiciously long. To fix that, I was planning to use the find_package(Torch) in the project but this does not suffice.
Anyway, the problem is independent from the Arch package and I suggest to close the task. Thanks for your reactivity. Sorry for the trouble.