Skip to content

Thread safety of the Fortran and C++ wrappers. #9

@JacekHoleczek

Description

@JacekHoleczek

I played with the current QCDLoop git master (2.0.4 as of 2020.01.07 20:27 UTC), making sure that I have "-DENABLE_FORTRAN_WRAPPER=ON".

While trying the "examples/fortran_test.f", I get a runtime warning saying that the Fortran "wrapper is not thread-safe".

Could you, please, be more specific why?

According to the GNU Fortran Compiler "Thread-safety of the runtime library" docs chapter, there should be no big problems (well, one might want to add "-frecursive" when compiling Fortran code).

At the same time, there appears also another runtime message saying that one should "consider developing object-oriented code", which seems to suggest that the provided C++ wrapper is thread-safe.

However, in this case I would expect that all C / C++ source code files are compiled and linked (i.e. object files, shared libraries and executables) with use of the gcc / g++ "-pthread" flag (at least on Linux). This does not seem to be the case (i.e. you do not use this flag at all).

The https://arxiv.org/pdf/1605.03181.pdf paper says (on page 9):

The native c++ interface of the QCDLoop library is thread-safe only when the caching algorithms are switched off. It is particularly important to highlight that the fortran wrapper is not thread-safe by construction.

Could you, please, be more specific how do you achieve the thread safety of the C++ wrapper (and then why the Fortran wrapper, which is also written in C, is not thread-safe)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions