Compiler option for OpenMP parallelization

Kengo Miyamoto

New member

When a source program file A includes OpenMP directives, would it be difficult for all source program files that refer to objects in A to be compiled using OpenMP options?

Specifically, if test1.f90 and test.f90 are compiled with OpenMP options because they include OpenMP directives, it follows that test2.f90 should be compiled with an OpenMP option if it is called by a subroutine in test.f90 that is parallelized with OpenMP.

We don’t anticipate any issues if test2.f90 is also to be compiled with an OpenMP option, even if it is called by a non-parallelized subroutine in test.f90.

< $FC $OMP -c test1.f90
< $FC -c test2.f90
< $FC $OMP test1.o test2.o test.f90 -o test.out
> $FC $OMP -c test1.f90
> $FC $OMP -c test2.f90
> $FC $OMP test1.o test2.o test.f90 -o test.out

However, WRF 4.4.2 specifies some files to be compiled without OpenMP options in arch/noopt_eception_f file, which causes issues for Fujitsu Fortran when building WRF 4.4.2 load module files.

Would it be possible to compile all source program files that refer to the objects with OpenMP directives using OpenMP options in the future versions of WRF? This would be very helpful for us.



Staff member
I want to let you know we haven't forgotten about you. Neither of the primary admins of the WRF questions are software engineers, so we've reached out to a software engineer that may have a better idea about this. Either they will respond, or I'll respond if I hear from them. Thank you for your patience!


Staff member
Apologies for the delayed reply! Having taken a quick look, I don't think it would be problematic if we added the OpenMP flags to the compilation of all files if an 'smpar' or 'sm+dm' configuration option were selected.

@Kengo Miyamoto Would you or someone from your group be interested in submitting a GitHub Pull Request (PR) to make the necessary changes for this? I don't believe anyone in our group has regular access to the Fujitsu compilers, so although we could make the changes, it would be difficult for us to verify that they work for anything besides the GNU, Intel, NVHPC, and Cray compilers.