Giter VIP home page Giter VIP logo

Comments (9)

mtfishman avatar mtfishman commented on June 25, 2024

Not sure why that would be, those are just wrappers around a call to the h5 library:

h5::file inline
h5_open(std::string const& name, char mode)
{
return h5::file(name.c_str(),mode);
}
(which I think is just some version of https://github.com/TRIQS/h5, so maybe helpful to test the latest version of that library directly).

@emstoudenmire (or @Wentzell), any idea?

from itensor.

Wentzell avatar Wentzell commented on June 25, 2024

That's very strange. I have adjusted the example to use https://github.com/TRIQS/h5 directly

#include <h5/h5.hpp>

int main(int argc, char *argv[]) {
    auto ofHandle0 = h5::file("test_0.h5",'w');
    ofHandle0.close();

    std::cout << "cout 0" << std::endl;
    std::cerr << "cerr 0" << std::endl;

    auto ofHandle1 = h5::file("test_1.h5",'w');
    ofHandle1.close();

    std::cout << "cout 1" << std::endl;
    std::cerr << "cerr 1" << std::endl;

    auto ofHandle2 = h5::file("test_2.h5",'w');
    ofHandle2.close();

    std::cout << "cout 2" << std::endl;
    std::cerr << "cerr 2" << std::endl;

    return 0;
}

Both for the release branch 1.0.x and the development branch unstable do I get the expected output

cout 0
cerr 0
cout 1
cerr 1
cout 2
cerr 2

@brendenroberts Could you try the example above in your build environment?
The steps would be

  • clone https://github.com/TRIQS/h5 to e.g. h5_src
  • Add the example above in h5_src/test/c++/stream_issue.cpp
  • Build and run the example with
mkdir h5_src/build && cd h5_src/build
cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install && make stream_issue
./test/c++/stream_issue

from itensor.

brendenroberts avatar brendenroberts commented on June 25, 2024

Your direct example works as expected for me also.

from itensor.

Wentzell avatar Wentzell commented on June 25, 2024

Your direct example works as expected for me also.

Ok. In that case the issue should be related to either the TRIQS/h5 version
that is currently part of ITensor, or to how ITensor wraps the TRIQS/h5 functionality.

I would suggest to first update the version within ITensor and see if the problem persists.

from itensor.

Wentzell avatar Wentzell commented on June 25, 2024

@mtfishman @emstoudenmire Would you agree? If so, could either of you look into that?

from itensor.

brendenroberts avatar brendenroberts commented on June 25, 2024

Thanks @Wentzell. The issue seems to be with the calls to close(). It solves the problem if instead I use the member function h5_object.close() (or whatever class it is). I think I got this io pattern from the unit test?

from itensor.

Wentzell avatar Wentzell commented on June 25, 2024

Ok. h5::object.close() should properly close the file handle. In the end it simply invokes the desctructor of the h5::object which internally will do the H5Idec_ref. I am not sure about what the close(..) in ITensor does.

from itensor.

mtfishman avatar mtfishman commented on June 25, 2024

Yeah, I'm trying to search the source code for the free function close(...) and I can't even find it. @emstoudenmire do you know its origin?

from itensor.

mtfishman avatar mtfishman commented on June 25, 2024

I guess we should remove it from the unit tests and docs in favor of h5::object.close() until we track down the issue with the free version.

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.