mpicc with no warning when compiling

2019-06-13 16:00发布

I would like to know what flag to use in order to avoid warning messages that appear when compiling a C/C++ parallel using mpicc. More specifically, I prefer not to have my screen of messages referring to unused variables,e.g. warning: unused variable

Thanks

3条回答
祖国的老花朵
2楼-- · 2019-06-13 16:35

depending on your compiler , you can add flags to avoid such warning messages, for instance -w is the GCC-wide option to disable warning messages.

查看更多
欢心
3楼-- · 2019-06-13 16:46

Most (?) MPI compiler wrappers will pass compiler options to the compiler that they wrap. so you should be able to use the same flag, for mpicc, that you would use for your compiler unwrapped.

For a better answer: consult the source of your installation of mpicc which is generally implemented (on Linux systems) as a shell script. Many versions also respond to -help and similar.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-06-13 16:59

As pointed by High Performance Mark, mpicc is simply a wrapper around the real compiler toolchain. There is an almost standard option that (almost) all wrappers understand: -showme. It shows you what flags exactly get passed on to the compiler, e.g.:

$ mpicc -showme
icc <lots of preprocessor flags> -fexceptions -pthread \
    <lots of linker flags> -lmpi -losmcomp -lrdmacm -libverbs -lrt \
    -lnsl -lutil -lpsm_infinipath -lbat -llsf -ldl -lm -lnuma

Examine these options, consult your compiler's manual and find out how to suppress the warnings.

查看更多
登录 后发表回答