0 votes
asked by (120 points)

I was wondering if anyone had success getting ITensor running in Jupyter notebooks using Xeus-Cling. [I am new to Xeus-Cling, so I am undoubtedly doing something naive.] If you have any suggestions, please let me know.

What I did so far:
- Installed Xeus-Cling using conda
- Compiled Itensor, using the flag: ITENSORMAKEDYLIB=1

I start up a notebook, and run:

#pragma cling add_include_path("/Users/emueller/Itensor3Clean/itensor")
#pragma cling add_library_path("/Users/emueller/Itensor3Clean/itensor/lib")
#include "itensor/index.h"

Everything works fine, I can create and manipulate index objects.

The problem comes when I try to include some of the other header files. For example:

#include "itensor/itensor.h"

yields an error (quoted below so as not not mess up the flow of the question) -- along with the errors that I get when I try to include a few other headers.

In case it matters, I am using Mac OSX 10.14.6, Cling 0.6, Xeus 0.23.3. ITensor 3.0.

ITensor works great for me when run in the regular way (compiling and linking using Clang). I think that getting it running in a Jupyter notebook would be great for teaching, and also make for a good development workflow (at least for me).


Sample include's, and the error messages:

#include "itensor/itensor.h"


In file included from inputline1:1:
In file included from /Users/emueller/anaconda/envs/cling/include/c++/v1/new:90:
In file included from /Users/emueller/anaconda/envs/cling/include/c++/v1/exception:80:
In file included from /Users/emueller/anaconda/envs/cling/include/c++/v1/cstddef:110:
/Users/emueller/anaconda/envs/cling/include/c++/v1/typetraits:1078:75: error: no member named 'value' in 'std::1::integral_constant<bool, true>'
referenceable_impl::__test<_Tp>(0)), __two>::va...

and so on...

#include "itensor/util/readwrite.h"


In file included from inputline37:1:
In file included from /Users/emueller/Itensor3Clean/itensor/itensor/util/readwrite.h:19:
In file included from /Users/emueller/anaconda/envs/cling/include/c++/v1/fstream:188:
/Users/emueller/anaconda/envs/cling/include/c++/v1/filesystem:852:13: error: no viable overloaded '+='
__pn_ += preferred_separator;

and so on...

 #include "itensor/tensor/lapack_wrap.h"


In file included from inputline39:1:
In file included from /Users/emueller/Itensor3Clean/itensor/itensor/tensor/lapackwrap.h:84:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
base.h:95:27: error: expected unqualified-id
extern struct mach_header __dso_handle;

and so on...

commented by (70.1k points)
Hi Eric, my best guess, based on these specific error messages, is that you (1) may not be compiling with the -std=c++17 flag and (2) aren't linking in all of the necessary libraries, in particular Accelerate (related to VecLib) which you are using as your BLAS/LAPACK implementation.

Are there some settings in Cling or similar where you can provide additional compiler and linker flags?

Glad to hear the index part is working though. But it makes sense you'd get these kinds of errors after that because Index doesn't use any BLAS features.

Please log in or register to answer this question.

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.