Search code examples
gccparallel-processingg++openmpscheduling

How is OpenMP "auto" schedule implemented in gcc?


The OpenMP documentation for schedule clause says that, when schedule(auto) is specified, then the decision regarding the scheduling is delegated to compiler or runtime system.

How does the compiler (E.g, gcc) decide the scheduling? Does it choose from one of the static, dynamic, guided or will it have its own algorithm for choosing a schedule?


Solution

  • In libgomp, the default OpenMP runtime library shipped with gcc, auto simply maps to static. There is no magic.

    This is commented in the code as:

    /* For now map to schedule(static), later on we could play with feedback
     driven choice.  */
    

    That comment has been there for 10 years. You can look for GFS_AUTO in loop.c and loop_ull.c