Closed martin-ueding closed 7 years ago
Hi Martin, This is because the QDPIO::cout is not really a proper stream as such I don’t think. This was a nuisance for me too, sometimes. However for QPhiX tests you ought to be able to use QPhiX::masterPrintf() or QPhiX::localPrintf() which will let you do formatted output… It’s in include/qphix/print_utils.h
Best, B
On May 12, 2017, at 2:36 PM, Martin Ueding notifications@github.com wrote:
The QDPIO::cout looks like a wrapper of std::cout that will check for MPI rank 0 and OpenMP thread 0. However, there are missing overloads for the stuff defined in
: /home/mu/Projekte/qphix/tests/compare_qdp_spinors.h:45:42: Fehler: no match for »operator<<« (operand types are »QDP::StandardOutputStream« and »std::_Setw«) QDPIO::cout << "(x,y,z,t)=(" << x << "," << y << "," << z << "," << t
<< ") site=" << std::setw(5) ind << " spin=" << s ~~~~~~~~~~~~~^~~~~~~~~~~~~~~ It is not possible to use std::setw, which I'd like to use to nicely format the output. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
So QDPIO::cout
does not fulfil the Liskov Substitution Principle? Perhaps we can fix that at some point.
I really don't like printf
for its lack of type safety, but I guess I will just use that for now. Complicated number formatting seems a tad easier with that, or my brain is just more used to this style.
QDPIO::count should be substitutable. Apparently things are missing. It hadn't been really necessary before, but apparently I had not encountered the needs. I do recall that stdio opens up lots of secondary dependencies. One has to decide what is the purpose. Just printing some things is nice. We had wanted to focus more on logging facilities, etc
Robert
On May 12, 2017, at 3:34 PM, Martin Ueding notifications@github.com wrote:
So QDPIO::cout does not fulfil the Liskov Substitution Principle? Perhaps we can fix that at some point.
I really don't like printf for its lack of type safety, but I guess I will just use that for now. Complicated number formatting seems a tad easier with that, or my brain is just more used to this style.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
The
QDPIO::cout
looks like a wrapper ofstd::cout
that will check for MPI rank 0 and OpenMP thread 0. However, there are missing overloads for the stuff defined in<iomanip>
:It is not possible to use
std::setw
, which I'd like to use to nicely format the output.