This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OpenMP 4.0 accelerator model compilation procedure



Hello,

I am trying to compile the OpenMP 4.0 example programs located in openmpacc-66ak2h-0.2.1/examples. The compilation process goes very well, and no issues on executing on the KeyStone II board.

But I am trying to understand how the code is compiled.  According to the wiki: http://processors.wiki.ti.com/index.php/MCSDK_HPC_3.x_OpenMP#OpenMP_Demos

What my understanding is the host code (File with main() function are named <example_name>_main.cpp) is compiled by arm-linux-gnueabihf-g++, the GNU compiler for ARM processors, while the target code (Files with #pragma omp target and #pragma omp declare target regions are named <example_name>_target.c ) is compiled by the TI cl6x compiler (wrapped by clacc wrapper). 

So, does this mean when I compile my own OpenMP 4.0 programs, I have to put the target code (inside of OpenMP target directive) into another file, compiled by clacc, while leave the rest of host code compiled by arm-gcc. I couldn't wrap it into a single file, like we write OpenACC code, right?

Thanks

Cheng

  • Cheng,

    Yes, your understanding is correct for the current release.  You need to put the target code in separate files.

    Xiaohui

  • Hi Xiaohui,

    Thanks for your reply! Just for a follow-up question:

    When I compile the vecadd program in openmpacc-66ak2h-0.2.1/examples/vecadd, instead of running the make and executing the clacc wrapper compiler, I tried to compile the code step by step:

    1. arm-linux-gnueabihf-g++ -O3 -I/opt/ti_hawking/openmpacc-66ak2h-0.2.1/include -c vecadd_t_main.cpp

    2. cl6x --openmp:device --abi=elfabi -mv6600 -I/opt/ti/C6000CGT7.6.0B1/include -O3 vecadd_t_target.c

    3. cl6x --abi=elfabi --openmp --cbe -I/opt/ti/C6000CGT7.6.0B1/include vecadd_t_target.c

    4. clocl -t -v __TI_CLACC_KERNEL.cl vecadd_t_target.obj

    cl6x --f -q --abi=eabi --use_g3 -mv6600 -mt -mo --disable:sploop -o3 -I/opt/ti/C6000CGT7.6.0B1/include -I/opt/ti/C6000CGT7.6.0B1/lib -I/opt/ti_hawking/opencl-66ak2h-0.8.1/lib --bc_file=__TI_CLACC_KERNEL.bc __TI_CLACC_KERNEL_bc.asm -z -ldsp_link.cmd -o __TI_CLACC_KERNEL.out vecadd_t_target.obj -lmonitor_evmk2h.syms
    strip6x __TI_CLACC_KERNEL.out
    arm-linux-gnueabihf-g++ -O3 -Wall -Wextra -fopenmp -c __TI_CLACC_KERNEL.c
    arm-linux-gnueabihf-gcc -O3 -Wall -Wextra -fopenmp -c vecadd_t_target.int.c
    arm-linux-gnueabihf-g++ -O3 -Wall -Wextra -fopenmp vecadd_t_main.o __TI_CLACC_KERNEL.o vecadd_t_target.int.o -L/opt/ti_hawking/openmpacc-66ak2h-0.2.1/lib -lOpenMPAcc -L/opt/ti_hawking/opencl-66ak2h-0.8.1/lib -lOpenCL -locl_util -Wl,-rpath-link,/evmk2h_nfs/usr/lib -o vecadd_t

    But the compilation process breaks on step 4, because step 3 did not generate __TI_CLACC_KERNEL.cl.

    So do I miss something?

    Thanks

    Cheng

  • Hi Cheng,

    1. Step 2 generates vecadd_t_target.cl.
    2. clacc takes vecadd_t_target.cl and copies to _TI_CLACC_KERNEL.cl.
    3. Step 4 takes __TI_CLACC_KERNEL.cl and generates __TI_CLACC_KERNEL.dsp_h.
    4. clacc takes __TI_CLACC_KERNEL.dsp_h, adds some required meta-data, creates __TI_CLACC_KERNEL.c which is later compiled with arm-linux-gnueabihf-g++

    Using clacc ensures all steps are executed correctly. Since we have some meta-data additions happening in the process, doing the steps manually one-by-one may not ensure correct results. 

    Gaurav

  • Cheng,

    To emphasize, you must use clacc to build OpenMP Accelerator Model applications. The steps are listed in the wiki to provide the user some insight into happens under the hood with clacc.

    Ajay