ccache

ccache

I'd like to use ccache with icc/icpc 7.0 for Linux (ccache is a wonderful tool for minimizing compile times, e.g., for groups of developers that have a copy each of a common source tree!)

ccache generates an intermediary file using the -E option with a suffix .ii for C++ code. g++ automatically recognizes .ii files as C++ code while icpc does not. As a workaround, I pass -Kc++ to all icpc invocations.

cccache considers stdout output as a problem so that the compiled result should not be cached. With the options I use, the Intel compiler outputs "vectorization" and "automatic cpu dispatch" remarks on stdout. The vectorization message can be suppressed using "-vec_report0", but since the dispatch messages don't have a remark number, I haven't figured out a way to use -wd to suppress the messages.

I guess there is a simple solution but I haven't been able to find one yet! Ideas?

Thanks, Anders

8 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Afuruhed,
Welcome!

>"automatic cpu dispatch"
Unfortunately this message cannot be turned off in the released product. This was not a priority so far. But I think you make a convincing case why we need to prioritize the fix.

Thanks for exploring newer tools to use with the Intel compiler. Meanwhile if you figure out a workaround, please let us know!

Cheers,
Ganesh

I don't suppose you could do:

icc etc. etc. etc. | grep -v "automatic cpu dispatch"

could you?

Just a wild suggestion...

Thanks Ganesh and Scott!

I think the problem with grep is that it will execute after ccache is already done (ccache acts as a proxy for the compiler command), but I could make a temporary modification to our copy of ccache and perform the equivalent of a grep in its code. Thanks for the idea!

Or, you could write a small shell script named 'icc' or something similar that does the same.

Does ccache use the $CC environment variable to discover the compiler?

does ccache have issues when messages are sent to stderr? because a 1>&2 is less expensive than a grep...

imo it's generally nicer to log to stderr anyway (intel?)

Redirecting to stderr might be a good idea, ccache does not have issues with that.

I'm thinking the simplest is to let ccache recognize a CCACHE_IGNORE_STDOUT env var - I got that suggestion from Andrew Tridgell (the author of ccache). I'll make that change locally and push for inclusion if it works well.

Tridge said this in a reply on the ccache mailing list:
"> I'm not sure why writing to stdout forces a cache miss."
"It's because is also very hard to accurately cache both stderr and
stdout because of the timing of lines between them. To really
accurately cache them ccache would need to record not only what came
out of stdout and stderr, but exactly what order the lines came in, so
when it is replayed the output looks the same.

I'd be happy to add a CCACHE_IGNORE_STDOUT option which would help for
the intel compiler. I'm not convinced it is really worth actually
cacheing stdout, as the output will probably look pretty strange if we
just put all the stdout at the start or end."

Hi,

As 'icc' is a script file that calls iccbin, you can edit the script file and add the 1>&2 as alistair_b suggested. Here is the change. Now stdout is redirected to stderr.

exec -a "/opt/intel/compiler70/ia32/bin/icc" /opt/intel/compiler
70/ia32/bin/iccbin "$@" 1>&2 ;

Now stdout is redirected to stderr.
$ ./icc-redirect src/foo-vectorize.cpp -c -axW >
/tmp/junk.txt
src/foo-vectorize.cpp(3) : (col. 3) remark: LOOP WAS VECTORIZED.
src/foo-vectorize.cpp(2) : (col. 1) remark: _Z3fooPfS_S_i has been targeted for
automatic cpu dispatch.

This is the default behavior - comments go to stdout.
$ /opt/intel/compiler70/ia32/bin/icc src/foo-vect
orize.cpp -c -axW > /tmp/junk.txt

Is this an acceptable workaround, or would you like to see these messages output to stderr by default ?

Regards,
John

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui