[Openmp-commits] [PATCH] D55148: [OpenMP] Implement OpenMP 5.0 Affinity Format Functionality

Kiran Chandramohan via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 1 10:09:45 PDT 2023

kiranchandramohan added inline comments.

Comment at: runtime/src/include/50/omp_lib.h.var:427-446
+        subroutine omp_set_affinity_format(format)
+          character (len=*) :: format
+        end subroutine omp_set_affinity_format
+        function omp_get_affinity_format(buffer)
+          import
+          character (len=*) :: buffer
jlpeyton wrote:
> kiranchandramohan wrote:
> > @jlpeyton @AndreyChurbanov Is there any particular reason that these functions are not `bind(c)`?
> @kiranchandramohan , The reason stems from Fortran and C/C++ having different ways of representing strings. In Fortran, the strings don't have to be '\0' byte terminated and there is an implied string size argument for each string argument in the Fortran API. So for these API additions, there is a separate "truly Fortran" entry point (hence, the lack of bind(c)) and C/C++ entry point which eventually converge to a C/C++ oriented implementation i.e., all methods internally assume null-byte termination since the runtime library itself is written in C/C++.
> I think we can almost always use bind(c) and only have one entry point in the library for both C/C++/Fortran, but in this case we needed to separate the Fortran API from the C/C++ API because it was the first OpenMP API that dealt with strings.
Thanks @jlpeyton for the explanation.

  rOMP OpenMP



More information about the Openmp-commits mailing list