Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add taco as 3rd party lib by CMake FetchContent_Declare #535

Open
miaodi opened this issue Oct 11, 2022 · 1 comment
Open

Add taco as 3rd party lib by CMake FetchContent_Declare #535

miaodi opened this issue Oct 11, 2022 · 1 comment

Comments

@miaodi
Copy link

miaodi commented Oct 11, 2022

I would like to add a taco as a 3rd party library to my project. In the CMakeLists.txt of my project I did the following:

include(FetchContent)
FetchContent_Declare(
  taco
  GIT_REPOSITORY https://github.com/tensor-compiler/taco.git
  GIT_TAG master
)
FetchContent_MakeAvailable(taco)

When compiling, the compiler complains

[ 48%] Building CXX object _deps/taco-build/src/CMakeFiles/taco.dir/lower/tensor_path.cpp.o
/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp: In member function ‘std::vector<taco::ir::Stmt> taco::LowererImplImperative::constructInnerLoopCasePreamble(taco::ir::Expr, taco::IndexVar, taco::MergeLattice, std::map<taco::Iterator, taco::ir::Expr>&)’:
/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp:1935:21: error: reference to ‘conjunction’ is ambiguous
 1935 |       nonZeroCase = conjunction({coordComparisons[i], valueComparisons[i]});
      |                     ^~~~~~~~~~~
In file included from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp:12:
/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/include/taco/ir/ir_generators.h:20:6: note: candidates are: ‘taco::ir::Expr taco::ir::conjunction(std::vector<taco::ir::Expr>)’
   20 | Expr conjunction(std::vector<Expr> exprs);
      |      ^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/include/taco/lower/mode_format_impl.h:4,
                 from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/include/taco/lower/mode_format_compressed.h:4,
                 from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp:1:
/usr/include/c++/9/type_traits:155:12: note:                 ‘template<class ... _Bn> struct std::conjunction’
  155 |     struct conjunction
      |            ^~~~~~~~~~~

If I build this taco without using FetchContent_Declare (mkdir build && cd build && cmake ..), this issue won't show up.

After I fixed this by adding the scope 'taco::ir::' to conjunction, I got the second issue:

/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/tools/taco.cpp:35:10: fatal error: taco/version.h: No such file or directory
   35 | #include "taco/version.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [_deps/taco-build/tools/CMakeFiles/taco-tool.dir/build.make:76: _deps/taco-build/tools/CMakeFiles/taco-tool.dir/taco.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:889: _deps/taco-build/tools/CMakeFiles/taco-tool.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

which also does not happen when I compile taco without using FetchContent_Declare.

Could I get some help on this issue?

@rohany
Copy link
Contributor

rohany commented Oct 27, 2022

I don't have much experience using TACO's cmake build in this way. I would recommend instead cloning the TACO repository and cmake installing it, then using find_package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants