Intel OpenMP Runtime: TASK_ID in __kmp_task_alloc(...) routine call

Intel OpenMP Runtime: TASK_ID in __kmp_task_alloc(...) routine call

Hi ..

I am trying to retrieve task (explicit) identity in runtime. I find the routine call __kmp_task_alloc: Allocate the taskdata and task data structures for a task, Here 

  taskdata->td_task_id      = KMP_GEN_TASK_ID(); and it the struct element definition says td_task_id, is assigned by debugger.

My Questions:

1). there any task_id which is been assigned while a task is formed..? If so, how can I get that ..? My goal is to identify each task and its data environment.      

2). How can I get the KA_TRACE( ... ) for a program run ..? and also please let me know the easy way to debug the runtime happening. 

Thank you very much in advance. 

- Raju

 

  

 

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello Raju,

taskdata->td_task_id is intended to be used under a debugger. You can see from the code that the flag __kmp_debugging is used to determine if the RTL is being debugged. The debugger sets this flag to TRUE that the RTL can make some special settings for the debugger (including task_id).

Initially, this functionality was used with Intel(R) Debugger (IDB) which is now deprecated. Instead, Intel provides GDB-IA (GDB* with enhancements by Intel). Please, see more information at https://software.intel.com/en-us/get-started-with-debugger-extension-for-linux

You can manually set initial value of __kmp_debugging to TRUE to make the runtime generate task_ids.

To get debug messages from the RTL like KA_TRACE() you need first to build debug version of the library (specify "debug" mode if building with Makefile, e.g.). Then you should set environment variable KMP_A_DEBUG=n, where 'n' is necessary level of trace messages. For example, to get "A" messages with level <=20 set KMP_A_DEBUG=20.

Hope it will help.

- Olga

 

Dear Olga,

Thank you very much for your nice reply. I am working on that and will get back you incase of it needs. 

- Raju

 

Hi Olga,

According to the steps, I did apply the following setting to get KA_TRACE() message from RTL, 

1. compile Runtime in debug mode <make --debug compiler=gcc>

2. export KMP_DEBUG=true

3.  export KMP_KA_TRACE_DEBUG=30 

4. source /home/***/opt/intel_xe_2016/bin/compilervars.sh -arch ia32 -platform linux

5. gdb-ia (enter into gdb shell env)

6. exec-file (link executable file)

7. run (the executable)

But I am not getting the KA_TRACE messages should be generated from Runtime. Can you please comment ..?

Thank you in advance.

- Raju

Hi Raju,

Couple of notes:

1.Your setting of the KMP_DEBUG does not help much to display KA_TRACE messages from the library, as for this you should set KMP_A_DEBUG environment variable as Olga suggested you.

2. Setting on the KMP_KA_TRACE_DEBUG tells nothing to the library because this variable is not recognized. Again the KA_TRACE messages are controlled by the KMP_A_DEBUG variable. Try to set it instead.

3. You may want to check the version of the library used in execution. For this set the KMP_VERSION environment variable and see the version of the library printed.  If it is not the library you just built then something may be wrong with your environment settings.

Regards,
Andrey
 

Hi Raju,

I'm afraid when you source the compiler (source /home/***/opt/intel_xe_2016/bin/compilervars.sh -arch ia32 -platform Linux) the OpenMP library from the compiler is used instead of manually built library.

As Andrey suggested, use KMP_VERSION variable to check the version of the OpenMP library you use.

$ export KMP_VERSION=1

Make sure you use correct library. Check "build time".

For debug library the output will look like

Intel(R) OMP Copyright (C) 1997-2016, Intel Corporation. All Rights Reserved.
Intel(R) OMP version: 5.0.00000000
Intel(R) OMP library type: performance
Intel(R) OMP link type: dynamic
Intel(R) OMP build time: 2016-02-24 08:22:52 UTC
Intel(R) OMP build compiler: Intel C++ Compiler 16.0
Intel(R) OMP alternative compiler support: yes
Intel(R) OMP API version: 4.0 (201307)
Intel(R) OMP dynamic error checking: no
Intel(R) OMP plain barrier branch bits: gather=2, release=2
Intel(R) OMP forkjoin barrier branch bits: gather=2, release=2
Intel(R) OMP reduction barrier branch bits: gather=1, release=1
Intel(R) OMP plain barrier pattern: gather=hyper, release=hyper
Intel(R) OMP forkjoin barrier pattern: gather=hyper, release=hyper
Intel(R) OMP reduction barrier pattern: gather=hyper, release=hyper
Intel(R) OMP lock type: run time selectable
Intel(R) OMP thread affinity support: not used
Intel(R) OMP debugger support version: 1.1
 

Use $ export LD_LIBRARY_PATH=<path to manually built libiomp5.so>:$LD_LIBRARY_PATH to specify the path to your library.

P.S. KMP_A_DEBUG=<n> variable can be used without debugger. You can just set it and run your executable linked with the debug library to see debug messages.

Hi Olga and Andrey,

Thank you very much for your supports, it really helps. I got it working fine here. 

- Raju

Leave a Comment

Please sign in to add a comment. Not a member? Join today