emstoudenmire / TNML

Tensor network machine learning. Based on the paper "Supervised Learning with Quantum Inspired Tensor Networks" http://arxiv.org/abs/1605.05775
MIT License
149 stars 52 forks source link

Showing error in "make" #2

Open sumantaphy opened 3 years ago

sumantaphy commented 3 years ago

DIR=/home/sumanta/software/ITensor ITENSOR_DIR=/home/sumanta/software/ITensor/itensor LIBPNG_DIR=/snap/gnome-3-38-2004/39/usr/lib/x86_64-linux-gnu PNGPP_DIR=/home/sumanta/software/png++ include $(DIR)/this_dir.mk include $(DIR)/options.mk While make it is showing the error follows (after giving the path of all these in the Makefile): Makefile:45: recipe for target 'linear.o' failed make: *** [linear.o] Error 1

make with:

"g++ -m64 -std=c++11 -fPIC -c -I. -I/home/sumanta/software/ITensor-2.1.1 -O2 -DNDEBUG -Wall -Wno-unused-variable -std=c++1y -I/home/sumanta/software/png++ -I/usr/local/include -o linear.o linear.cc"

Any kind of help is appreciable.

emstoudenmire commented 3 years ago

Sorry - I'm really not sure what the issue is based on on this information. You might be using a different version of make than the one I used when I made the provided Makefile. One thing you could do is to just view the commands that the Makefile is trying to run (for example your g++ above) and then run these directly instead of using make. Also the error could be due to the compilation itself failing, not due to make (and then make was just reporting that the error occurred). So it could be related to your ITensor setup or one of the dependencies.

sumantaphy commented 3 years ago

I am using GNU Make 4.1 during run. I have successfully installed ITensor (Version 3.1.0) and it is running smoothly. Let me just put the complete error: (Hope this might help)

g++ -m64 -std=c++17 -fconcepts -fPIC -c -I. -I'/home/sumanta/software/ITensor' -O2 -DNDEBUG -Wall -Wno-unknown-pragmas -Wno-unused-variable -std=c++1y -I/home/sumanta/software/png++ -I/usr/local/include -o linear.o linear.cc In file included from /home/sumanta/software/ITensor/itensor/util/iterate.h:20:0, from /home/sumanta/software/ITensor/itensor/global.h:26, from /home/sumanta/software/ITensor/itensor/qn.h:19, from /home/sumanta/software/ITensor/itensor/spectrum.h:20, from /home/sumanta/software/ITensor/itensor/decomp.h:19, from /home/sumanta/software/ITensor/itensor/all_basic.h:31, from /home/sumanta/software/ITensor/itensor/all_mps.h:33, from /home/sumanta/software/ITensor/itensor/all.h:31, from linear.cc:2: /home/sumanta/software/ITensor/itensor/util/itertools.h: In member function ‘void triqs::utility::prod_iter::_increment()’: /home/sumanta/software/ITensor/itensor/util/itertools.h:148:10: warning: ‘if constexpr’ only available with -std=c++1z or -std=gnu++1z if constexpr (N < sizeof...(It) - 1) { ^~~~~ /home/sumanta/software/ITensor/itensor/util/itertools.h: At global scope: /home/sumanta/software/ITensor/itensor/util/itertools.h:264:81: error: expected constructor, destructor, or type conversion before ‘;’ token template multiplied(T &&...)->multiplied<std::decay_t...>; ^ /home/sumanta/software/ITensor/itensor/util/itertools.h: In lambda function: /home/sumanta/software/ITensor/itensor/util/itertools.h:297:98: error: ‘apply’ is not a member of ‘std’ return transform(zip(std::forward(ranges)...), [lambda](std::tuple<T...> t) { return std::apply(lambda, t); }); ^~~~~ In file included from /home/sumanta/software/ITensor/itensor/tensor/mat.h:406:0, from /home/sumanta/software/ITensor/itensor/itensor.h:23, from /home/sumanta/software/ITensor/itensor/decomp.h:20, from /home/sumanta/software/ITensor/itensor/all_basic.h:31, from /home/sumanta/software/ITensor/itensor/all_mps.h:33, from /home/sumanta/software/ITensor/itensor/all.h:31, from linear.cc:2: /home/sumanta/software/ITensor/itensor/tensor/mat_impl.h: In function ‘itensor::CMatrix itensor::randnC(CtrArgs&& ...)’: /home/sumanta/software/ITensor/itensor/tensor/mat_impl.h:205:40: error: missing template arguments before ‘(’ token for(auto& el : M) el = std::complex(normal(gen),normal(gen)); ^ In file included from /home/sumanta/software/ITensor/itensor/all_basic.h:31:0, from /home/sumanta/software/ITensor/itensor/all_mps.h:33, from /home/sumanta/software/ITensor/itensor/all.h:31, from linear.cc:2: /home/sumanta/software/ITensor/itensor/decomp.h: In function ‘itensor::Spectrum itensor::denmatDecomp(const itensor::ITensor&, itensor::ITensor&, itensor::ITensor&, itensor::Direction, const BigMatrixT&, itensor::Args)’: /home/sumanta/software/ITensor/itensor/decomp.h:377:10: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z auto [cmb,ci] = combiner(std::move(cinds),args); ^ In file included from /home/sumanta/software/ITensor/itensor/decomp.h:490:0, from /home/sumanta/software/ITensor/itensor/all_basic.h:31, from /home/sumanta/software/ITensor/itensor/all_mps.h:33, from /home/sumanta/software/ITensor/itensor/all.h:31, from linear.cc:2: /home/sumanta/software/ITensor/itensor/decomp_impl.h: In function ‘std::tuple<itensor::ITensor, itensor::ITensor, itensor::ITensor> itensor::svd(const itensor::ITensor&, const itensor::Index&, IndsArgs&& ...)’: /home/sumanta/software/ITensor/itensor/decomp_impl.h:62:8: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z auto [is,args] = detail::makeIndexSetArgs(i1,indsargs...); ^ /home/sumanta/software/ITensor/itensor/decomp_impl.h: In function ‘std::tuple<itensor::ITensor, itensor::ITensor> itensor::qr(const itensor::ITensor&, const itensor::Index&, IndsArgs&& ...)’: /home/sumanta/software/ITensor/itensor/decomp_impl.h:70:8: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z auto [is,args] = detail::makeIndexSetArgs(i1,indsargs...); ^ /home/sumanta/software/ITensor/itensor/decomp_impl.h: In function ‘std::tuple<itensor::ITensor, itensor::ITensor> itensor::factor(const itensor::ITensor&, const itensor::Index&, IndsArgs&& ...)’: /home/sumanta/software/ITensor/itensor/decomp_impl.h:78:8: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z auto [is,args] = detail::makeIndexSetArgs(i1,indsargs...); ^ linear.cc: In function ‘int main(int, char*)’: linear.cc:164:5: error: ‘Print’ was not declared in this scope Print(norm(V)); ^~~~~ linear.cc:164:5: note: suggested alternative: ‘rint’ Print(norm(V)); ^~~~~ rint linear.cc:211:68: error: ‘Link’ was not declared in this scope for(auto j : range(2+N)) links.at(j) = Index(format("l%d",j),M,Link); ^~~~ linear.cc:211:68: note: suggested alternative: ‘link’ for(auto j : range(2+N)) links.at(j) = Index(format("l%d",j),M,Link); ^~~~ link linear.cc: In function ‘itensor::Real cgrad(itensor::Vector&, const std::vector&, const itensor::Args&)’: linear.cc:83:19: warning: ignoring return value of ‘int system(const char)’, declared with attribute warn_unused_result [-Wunused-result] system("rm -f STOP");


Makefile:45: recipe for target 'linear.o' failed
make: *** [linear.o] Error 1
emstoudenmire commented 3 years ago

Hi, so it's hard to be sure but based on this extra information, I would guess that your compiler version is too old to support the C++14 language and libraries. Can you try a newer compiler? Or perhaps try the clang compiler instead of gcc (g++)?

QingXia0177 commented 1 year ago

@sumantaphy , I meet the same question too. how did you slove the question,can you tell me? thank you every much.

emstoudenmire commented 1 year ago

Hi Sumanta and Qing, As I mentioned in my answer here (https://github.com/emstoudenmire/TNML/issues/3), this code is not really maintained anymore as it is about 7 years old, and even when I first posted it was far from an optimal implementation (i.e. it runs really slowly). Currently there are much better codes, but I left this one posted publicly in case people found it useful to study it.

Miles