Professional Documents
Culture Documents
penMP Programs
12/08/2021
OSLab.
1
Probe Points
• #pragma omp parallel for Link
– Entry:
• GOMP_parallel_loop_static(,,, start, end, step, );
Cannot Catch!! Link
• GOMP_parallel_start()
– insert PIN_Notify_For_Loop(start, end, step)
– Exit
• GOMP_parallel_end();
Catch irregular
– insert PIN_Notify_For_End()
2
– Inside of a For Loop
• insert a pintool helper function
– PIN_Notify_For_Index(i)
3
• #pragma omp ciritical Link
– Entry
• GOMP_critical_start(); without lock name
• GOMP_critical_name_start(); with lock name
– Exit
• GOMP_critical_end(); without lock name
• GOMP_critical_name_end(); with lock name
4
Probe with Pintool
1. Searching a specific function in the OpenMP libra
ry
2. Registering callback function at Entry/Exit point
of the target function
3. Collecting data from arguments, return value, inst
ruction address, etc.
5
Searching function
6
• Getting the line number & the source file name
INT32 line;
string file;
string s; Instruction Address
PIN_LockClient();
PIN_UnlockClient();
ReleaseLock(&lock);
7
Selection of a Shared Variable
• insert a pintool helper function
– PIN_Notify_Shared_Variable(addressOfVariable)
8
Insertion of Pintool helpers
main() {
...
int sharedVariable;
...
PIN_Notify_Shared_Variable(&sharedVariable);
...
PIN_Notify_For_Loop(0, loopcnt, 1);
#pragma omp parallel for
for(i = 0; i < loopcnt; i++)
{
PIN_Notify_For_Index(i);
...
}
PIN_Notify_For_End();
...
}
9
Reference
• GNU libgomp
– http://gcc.gnu.org/onlinedocs/gcc-4.4.4/libgomp/
• GNU GCC source
– http://gcc.gnu.org/viewcvs/tags/gcc_4_4_4_release/libg
omp/
10