[Openmp-dev] Support for the OpenMP Tools Interface in upstream

Jonas Hahnfeld via Openmp-dev openmp-dev at lists.llvm.org
Sat Aug 3 23:55:02 PDT 2019


Hi,

to the best of my knowledge, OMPT works on the Power architecture.

first, the error:
> /p/home/jusers/kitayama1/juron/openmp_has_ompt.c:27:10: error:
> returning 'ompt_start_tool_result_t' (aka 'struct
> ompt_start_tool_result_t') from a function with incompatible result
> type 'ompt_start_tool_result_t *' (aka 'struct
> ompt_start_tool_result_t *'); take the address with &
>   return ompt_start_tool_result;
>          ^~~~~~~~~~~~~~~~~~~~~~
>          &
So why not do what the compiler asks you? ompt_start_tool is supposed to 
return a pointer to ompt_start_tool_result_t (aka 
"ompt_start_tool_result_t *"), not the struct itself.

For the warning:
> /p/home/jusers/kitayama1/juron/openmp_has_ompt.c:24:62: warning:
> incompatible function pointer types initializing 'ompt_initialize_t'
> (aka 'int (*)(void (*(*)(const char *))(void), int, union ompt_data_t
> *)') with an expression of type 'int (*)(ompt_function_lookup_t,
> ompt_data_t *)' (aka 'int (*)(void (*(*)(const char *))(void), union
> ompt_data_t *)') [-Wincompatible-function-pointer-types]
>   static ompt_start_tool_result_t ompt_start_tool_result = {
> &ompt_initialize,
> 
> ^~~~~~~~~~~~~~~~
Clang is completely right, your declaration of ompt_initialize has the 
wrong type. According to the final 5.0 spec, the second argument is the 
"initial_device_num" and you cannot cast a function pointer that takes 
"ompt_data_t *" as its second argument to "ompt_initialize_t *".

In general, you can take a look at the upstream tests for OMPT: 
https://github.com/llvm/llvm-project/blob/master/openmp/runtime/test/ompt/callback.h 
This should always have a working initialization.

Hope this helps,
Jonas

On 2019-08-04 06:08, Itaru Kitayama via Openmp-dev wrote:
> Here's the error messages thrown by Clan trunk as of today:
> 
> [kitayama1 at juron1-adm ~]$ clang -fopenmp -fopenmp-targets=nvptx64
> ~/openmp_has_ompt.c
> /p/home/jusers/kitayama1/juron/openmp_has_ompt.c:24:62: warning:
> incompatible function pointer types initializing 'ompt_initialize_t'
> (aka 'int (*)(void (*(*)(const char *))(void), int, union ompt_data_t
> *)') with an expression of type 'int (*)(ompt_function_lookup_t,
> ompt_data_t *)' (aka 'int (*)(void (*(*)(const char *))(void), union
> ompt_data_t *)') [-Wincompatible-function-pointer-types]
>   static ompt_start_tool_result_t ompt_start_tool_result = {
> &ompt_initialize,
> 
> ^~~~~~~~~~~~~~~~
> /p/home/jusers/kitayama1/juron/openmp_has_ompt.c:27:10: error:
> returning 'ompt_start_tool_result_t' (aka 'struct
> ompt_start_tool_result_t') from a function with incompatible result
> type 'ompt_start_tool_result_t *' (aka 'struct
> ompt_start_tool_result_t *'); take the address with &
>   return ompt_start_tool_result;
>          ^~~~~~~~~~~~~~~~~~~~~~
>          &
> 1 warning and 1 error generated.
> 
> On Sun, Aug 4, 2019 at 1:01 PM Itaru Kitayama
> <itaru.kitayama at gmail.com> wrote:
> 
>> Hi,
>> According to Clang 10 documents, OMPT is supported on major
>> architectures, but
>> this piece of code attached does not build on POWER8.
>> 
>> Can I take it it is fully supported?
>> 
>> Itaru.
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list