Giter VIP home page Giter VIP logo

Comments (5)

mtfishman avatar mtfishman commented on June 25, 2024

Does it throw an error if you run in debug mode?

from itensor.

emstoudenmire avatar emstoudenmire commented on June 25, 2024

I had the same question – more information on compiling and running in debug mode here:
http://itensor.org/docs.cgi?vers=cppv3&page=formulas/debug_mode

from itensor.

tanlin2013 avatar tanlin2013 commented on June 25, 2024

Hi, so I gave a try in debug mode, and looks like it's still working fine?? 🤔

Here is one simple example, a 2 by 2 random tensor, and I ask for T(10, 10), which obviously is nonsense

auto i = Index(2);
auto j = Index(2);
auto T = randomITensor(i, j);
std::cout << "Here is the output: " << elt(T, 10, 10) << std::endl;

and still, I got a zero with no error messages.

Here is what gbd returned to me

root@2d7b272ef1f7:/home/tests# gdb -ex 'run' ./build/test.exe             
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/test.exe...
Starting program: /home/tests/build/test.exe 
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: File "/usr/local/lib64/libstdc++.so.6.0.30-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /usr/local/lib64/libstdc++.so.6.0.30-gdb.py
--Type <RET> for more, q to quit, c to continue without paging--c
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
[New Thread 0x7fd605e56700 (LWP 135)]
[New Thread 0x7fd605655700 (LWP 136)]
[New Thread 0x7fd5fce54700 (LWP 137)]
Here is the output: 0
===============================================================================
test cases: 1 | 1 passed
assertions: - none -

[Thread 0x7fd605655700 (LWP 136) exited]
[Thread 0x7fd5fce54700 (LWP 137) exited]
[Thread 0x7fd605e56700 (LWP 135) exited]
[Inferior 1 (process 131) exited normally]

p.s. I ran this in Catch2 test case, but that shouldn’t be a problem I think.

from itensor.

tanlin2013 avatar tanlin2013 commented on June 25, 2024

Hi there,

I did a more detailed check, and I think this is actually kind of overflow issue?

It seems like elt(T) can return either zero or infinity to me (yes, not just zero).

#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include "itensor/all.h"
using namespace itensor;

TEST_CASE("Test behaviour of elt(T) func", "[TestFuncElt]") {
  auto i = Index(2);
  auto j = Index(2);
  auto T = randomITensor(i, j);
  for (int k = 3; k < 20; ++k) {
    // always gives zero or infinity for out-of-range index?
    CHECK(((elt(T, k, k) < std::numeric_limits<float>::min()) ||
           (elt(T, k, k) > std::numeric_limits<float>::max())));
  }
}

outputs:

root@2d7b272ef1f7:/home/tests# ./build/test.exe [TestFuncElt]
Filters: [TestFuncElt]
===============================================================================
All tests passed (17 assertions in 1 test case)

Outputs are about the same in the debug mode, with just some information about the threads. No errors.

from itensor.

tanlin2013 avatar tanlin2013 commented on June 25, 2024

Hi, I guess this is forgotten after the new year 😆

from itensor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.