On Wed, May 29, 2024 at 08:41:04AM +0200, Tobias Burnus wrote: > Jakub Jelinek wrote: > > How is that option different from > > echo '#pragma omp requires unified_shared_memory' > omp-usm.h > > gcc -include omp-usm.h > > ? > > I mean with -include you can add anything you want, not just one particular > > directive, and adding a separate option for each is just weird. > > For C/C++, -include seems to be indeed sufficient (albeit not widely known). > For Fortran, there at two issues: One placement/semantic issue: it has to be > added per "compilation unit", i.e. to the specification part of a module, > subprogram or main program. And a practical issue, gfortran shows: > > error: command-line option '-include !$omp requires' is valid for > C/C++/ObjC/ObjC++ but not for Fortran > > Thus, for Fortran it is still intrinsically useful – even if one can argue > whether that feature is needed at all / whether it should be added as > command-line argument.
But then shouldn't we have an option that adds something at the start of the declaration part of each <whatever is needed>? I mean, option to add 'implicit none' everywhere, or this '!$omp requires unified_shared_memory' etc.? I could live with an one off option for clang compatibility, I just fear that in 2 years we'll need another one etc. and that solving it in some more versatile way would be better. Jakub