kmp vs. gomp

Hi all,

is there a way in the runtime to tell whether the runtime was initialized through a call to the kmp or gomp interface? As I understand the initialization, this is currently not possible.

A way to implement this would be to pass a flag through __kmp_get_global_thread_id_reg to __kmp_do_serial_initialize. Would this be acceptable?

The background for this question is the different behavior regarding OMPT callbacks. Specifically, gomp has currently no way to provide a callback for the single-end event.
Following the specification, the runtime should return ompt_set_sometimes instead of ompt_set_always when registering ompt_callback_work knowing that the application uses the gomp interface.

Best
Joachim

In general, it is not possible to know which compiler used to compile the code that caused the initialization of the runtime library.
It could be possible if kmp or gomp interface caused the initialization, but definitely not possible if it was omp_* call.

Note also that we tentatively support case when executable linked from objects compiled by different compilers, so the library can be initialized in code compiled by one compiler and then used in the code compiled by another compiler (we do not cover all the cases of cause, but simple cases should work).

-- Andrey

Hi Andrey,

thanks!
omp_* calls were exactly the kind of issue I was looking for.
I will look to find a better solution for the original issue.

- Joachim

Following Michael Klemms opinion, that an OpenMP implementation consists of a fixed pair of compiler+runtime, I suggest to add a CMake flag, that selects whether the intended use of the runtime is KMP or GOMP.

Based on this flag, we would provide return codes for OMPT callback registration.

What do you think about this proposal?

Best
Joachim

Doesn't sound like a good idea to me.

The whole point why we have GOMP and KMP interfaces in the library is to allow same binary be used with code compiled by different compilers.

You may solve one particular problem of running unit tests for an OpenMP implementation (one combination of compiler+runtime). But what if people use several OpenMP implementations to produce single application (e.g. several OpenMP-parallelized third-party libraries)? These cases may stop working or produce unexpected (or unspecified) results.

I'd rather look for some other solution for the problem. E.g. always return ompt_set_sometimes when registering ompt_callback_work. Or make a tool to cope somehow with the absence of end_single event. Etc.

Regards,
Andrey

I agree with Andrey.

Ok, different proposal:

Many computing centers carefully provide separate tool chains for different compilers used on their clusters based on module system or similar approaches.

I also think, that in the near future several tools will integrate the LLVM/OpenMP runtime into their build to enable their tool to work with applications built with older compilers coming without OMPT interface.
Hopefully this will be solved within the next years :slight_smile: But experience shows that HPC machines tend to run with quite old software stack, so it could take another 5-10 years :frowning:

A configure switch might provide the ability to turn off kmp or gomp interface in these module environments. So, if the sysadmin compiles the runtime for the gcc toolchain, he would only activate the gomp interface. Based on this switch a more detailed support level of OMPT callbacks might be announced to the tool.
Default for this switch would be of cause kmp+gomp.

Best
Joachim

This really seems way over the top as a solution given the size of the underlying problem.

You want to throw away binary compatibility and the ability to link GNU compiled code with (for instance) MKL, because one interface to a tool can be slightly better supported with one compiler than the other?

That seems a huge loss for very marginal gain (how many people use code vs how many write it!?)

Having spent ten years working on a debugger, I have some sympathy with people trying to write tools. You sit there in the middle, and anything around you which gets broken shows up as your problem.

BUT
1) You already have to handle the "ompt_set_sometimes" property for the work callback

2) Although tools folks may not like it, missing some info on "single" seems way lower in importance than having only one binary runtime and being able to call libraries compiled with different compilers.

-- Jim

Jim Cownie <james.h.cownie@intel.com>
CVCG/DPD/TCAR (Technical Computing, Analyzers, and Runtimes)
Tel: +44 117 9071438

Ok, I already expected no one will like that idea, so we will just fix the return values to represent the actual behavior.

Best
Joachim

Ok, different proposal:

Many computing centers carefully provide separate tool chains for
different compilers used on their clusters based on module system or
similar approaches.

I also think, that in the near future several tools will integrate the
LLVM/OpenMP runtime into their build to enable their tool to work with
applications built with older compilers coming without OMPT interface.
Hopefully this will be solved within the next years :slight_smile: But experience
shows that HPC machines tend to run with quite old software stack, so it
could take another 5-10 years :frowning:

I spent 5 years of my life in software support for a major HPC center and I
don't think this is a fair characterization. It is true that some of the
more exotic machines place limits on the software upgrades, but if we
ignore IBM Blue Gene/Q and Fujitsu K, there is no issue installing the
latest everything. The support staff might not do it at the pace you like
because of finite resources, or because the majority of users do not care
about GCC 8.1 or Intel 18.0.2 compilers, but if there is demonstrable need
for new software, it is not a technical problem to get it installed.

If you are struggling with unhelpful HPC center support staff not
installing needed software updates, I can provide advice on how to engage
them in a way that is more likely to lead to positive results.

Jeff