Questions on parallel processing and multi-threading support in GCC's profiling collection

Qing Zhao qing.zhao@oracle.com
Mon Jul 17 15:01:51 GMT 2023


Hi, Jan,

I did a little search online and also into GCC’s documentation, and found the following 
several options to support parallel processing  and multi-threading during profiling collection:

https://gcc.gnu.org/onlinedocs/gcc-10.5.0/gcc/Instrumentation-Options.html

-fprofile-dir=path and -fprofile-reproducible=[multithreaded|parallel-runs|serial]

=======
-fprofile-dir=path
…..
When an executable is run in a massive parallel environment, it is recommended to save profile to different folders. That can be done with variables in path that are exported during run-time:

%p
process ID.

%q{VAR}
value of environment variable VAR

-fprofile-reproducible=[multithreaded|parallel-runs|serial]
….

With -fprofile-reproducible=parallel-runs collected profile stays reproducible regardless the order of streaming of the data into gcda files. This setting makes it possible to run multiple instances of instrumented program in parallel (such as with make -j). This reduces quality of gathered data, in particular of indirect call profiling.

======

I have the following questions on GCC’s  profiling collection with parallel processing or multi-threading environment: 

1. In addition to the above two options, are there any other changes in GCC to support parallel processing or multi-threading?
2. Is there any documentation on how to collect and use profiling feedback for a parallel processing or multi-threading environment safely and accurately?
3. I noted that -fprofile-dir=path was added in GCC9, and -fprofile-reproducible was added in GCC10, is it doable to add these two options back to GCC8 to 
    Support parallel processing and multi-threading profiling collection? 

Thanks a lot for your help.

Qing


More information about the Gcc mailing list