4

I want to enable runtime tracing and see the output. Something like the output of

KD_TRACE(10, ( buff, gtid, schedule, chunk, lb, ub, st ) );

in kmp_dispatch.cpp

Refer this https://elixir.bootlin.com/llvm/latest/source/openmp/runtime/src/kmp_dispatch.cpp#L624

So, far I have followed the following tutorial: https://passlab.github.io/CSE436536/Assignments/project_dev_setup.html But I am not able to see any output from the tracer.

Is there a particular file or something where the output is logged? Or it is logged in the terminal?

I am compiling the openMP program like this:

clang omp1.c -L/PATH/llvm_work/openmp/BUILD/runtime/src   -o omp1

ldd omp1

This is the output:

linux-vdso.so.1 (0x00007ffdae305000)

libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fca2f3bb000)

/lib64/ld-linux-x86-64.so.2 (0x00007fca2f7ac000)

I hope this is using the OpenMP I have build from source and not libomp.

omp1.c:

#include<stdio.h>
#include "omp.h"

int main()
{
    int i=0;
    #pragma omp parallel for schedule(static)
    for(i=0;i<1000;++i)
    {
        int x = 4+i;
    }
}

But when I am trying to run this program using the same command I am getting an error.

/tmp/omp2-d969a9.o: In function `main':

omp2.c:(.text+0x1c8): undefined reference to omp_set_num_threads

clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

Can anyone help me with correctly compiling the openMP programs with the openMP code I have built from source and also in using tracer?

Thank you.

2 Answers 2

3

You need to compile with -fopenmp flag. Also, you need to have the debug version of the runtime (built with debug info) + set the environment variable export KMP_DEBUG=511.

Sign up to request clarification or add additional context in comments.

Comments

2
+25

I think you have to tell the compiler, that you want to use OpenMP via -fopenmp:

clang -fopenmp omp1.c -L/PATH/llvm_work/openmp/BUILD/runtime/src -o omp1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.