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.

Rebuild OpeMP 3x for Keystone II

Hello,

I'm running an EVMK2H device and I just managed to compile and run the basic VECADD example using OpenMP runtime in OpenCL Mode. My question is:. How Can I rebuild OpenMP in order to run applications in OpenCL mode?

Additional information:

EVMK2H

mcsdk-3.00.04

mcsdk-hpc 3.00.01.12

Thanks

  • Carlos,

    If you want to dispatch code from the A15s running Linux to the C66x DSPs on K2H, there are 2 approaches:

    The OpenMP-DSP runtime lets you run code across the C66x DSPs. The OpenMP DSP runtime is integrated into the two approaches listed above and enables you to use either OpenCL or OpenMP offload to dispatch OpenMP regions to the DSPs.

    Refer example vecadd_openmp in /usr/share/ti/examples/opencl/vecadd_openmp and vecadd in /usr/share/ti/examples/openmpacc/vecadd

    I don't quite understand your question about rebuilding OpenMP to run applications in OpenCL mode. To run OpenCL examples, you need the OpenCL runtime.

    If possible, I'd recommend that you update to Processor SDK Linux for K2H, available here: .

    Ajay

  • Hello Ajay,

    Thanks for your quick replay. Let me first put you in context:

    - We have a EVMK2H evaluation board, upon which we run experiments with the OpenMP Offload model, as used in the vecadd example in "/usr/share/ti/examples/openmpacc/vecadd” it runs correctly. Our understanding is that the openmp-dsp library used in this example is “/lib/libgomp.so.1.0.0”.

    - Our objective is to enhance the openmp-dsp library to include support of the “depend” claused as defined in OpenMP 4.0 specification.

    - To do so, we modified the source code of the openmp-dsp library (located "mcsdk-hpc_03_00_01_12/openmp_dsp_2_01_16_03/packages/ti/runtime/openmp/src”); mainly tomp_task.c.

    - In other to rebuild the library, we invoked the Makefile included in "mcsdk-hpc_03_00_01_12/openmp_dsp_2_01_16_03/utils”, defining C6636 are the target device. Here is where our doubts start:

    Our understanding is that this library can only be compiled using the RTSC tools. To the best of our knowledge, we have included all tools required for the compilation process (XDC, BIOS, IPC) as well as defined all enviornment variables (OMP_TARGET, C6636_PDK_DIR, XDC_DIR, XDCCGROOT, BIOS_DIR, IPC_DIR, BUILD_K2H_LIBS, CPATH, ULM_DIR).
    The compilation seems to finish correctly (no error is given) when using the OpenMP_hawking makefile rule (which seems the be the nickname of the platform we use evmk2h), although we don’t know which is the outcome of the compilation. The compilation fails when trying to compile the rest of makefile rules.
    Our guess is that this compilation can only be used with CCS, and not in OpenMP Offload model as we would like to.

    Overall, we would like to have a rebuild libgomp.so.1.0.0 library to compile with the OpenMP Offload model. Any suggestions?
  • Hi Carlos,

    The DSP libgomp library is statically linked into the monitor that is running on the DSPs. The libgomp.so library in the linux filesystem is the ARM libgomp library. You will need to build the OpenMP library and then rebuild the DSP monitor setting OMP_DIR to point at your new openmp library.

    The DSP C-compiler front-end does not know how to lower an OpenMP depend clause. Are you using the TI compiler or your own source-to-source compiler?

    Eric
  • Carlos,

    As Eric mentioned, after you make changes to the OpenMP-DSP runtime to add support for task depend, you need to build the OpenMP DSP runtime. You then also need to rebuild the OpenCL runtime - the OpenCL DSP monitor links against the OpenMP-DSP runtime. You need to rebuild OpenCL because our OpenMP offload runtime uses OpenCL under the hood.

    The recommended way to build OpenCL and all its dependencies is to use the Yocto build system. The build process is documented here: 

    Ajay

  • Hello Eric and Ajay,

    Thanks a lot for your quick responses.

    As you suggested, we proceeded as follows:

    1. We setup the OMP_DIR to the new location ((openmp_dsp_2_01_16_03/packages) and successfully rebuild the OpenMP run-time (located in openmp_dsp_2_01_16_03/packages/ti/runtime/openmp/src/) using the “openmp_hawking” and “device_hawking” Makefile rules (our evaluation board is the EVMK2H).

    2. However, we failed when rebuilding the OpenCL library (as instructed in the link processors.wiki.ti.com/.../Processor_SDK_Building_The_SDK), because we don't know how to link it with the rebuilt OpenMP runtime. Our understanding is that, once we manage to do it, a new package (with extension .ipk) will be created, which will be later installed in the EVM file system and then we could execute applications in OpenMP offload mode.

    Regarding Eric’s question about the lowering of the OpenMP depend clause, we are following the strategy presented in the paper: “A Lightweight OpenMP4 Run-time for Embedded Systems”, presented in ASP-DAC 2016. The main idea behind it, is to statically generate the TDG, and store within application's address space. By doing so, the run-time knows the order in which tasks must be executed as defined in the TDG. We will be very happy to provide you further information.

    Thank you very much one Again for your support.
  • Carlos Varela said:
    2. However, we failed when rebuilding the OpenCL library (as instructed in the link processors.wiki.ti.com/.../Processor_SDK_Building_The_SDK), because we don't know how to link it with the rebuilt OpenMP runtime. Our understanding is that, once we manage to do it, a new package (with extension .ipk) will be created, which will be later installed in the EVM file system and then we could execute applications in OpenMP offload mode.

    An option is to override OMP_DIR in the Yocto recipe used to build the OpenCL monitor, located at: tisdk/sources/meta-arago/meta-arago-extras/recipes-ti/ocl/opencl-monitor_git.bb. You would point OMP_DIR to your rebuilt OpenMP runtime for K2H.

    Ajay

  • Hello,

    We managed to follow successfully the rebuild process as you and Eric have suggested us:
    1) Applied changes to OpenMP-DSP runtime and rebuild it.
    2) Rebuilt OpenCL-runtime, OpenCL DSP monitor and OpenCL itself (linked with the previous rebuilt OpenMP)

    From the final rebuilt we obtained a bunch of .ipk packages (around 800) and proceeded to install the followings on the evmk2h file system:
    opkg install .....
    openmp-rtos_2_04_00_01-r0.tisdk0_k2hk_evm.ipk
    opencl-monitor_1.1.10.3-r0.0_k2hk_evm.ipk
    libopencl-runtime_1.1.10.3-r0.0_k2hk_evm.ipk
    libopencl1_1.1.10.3-r0.0_k2hk_evm.ipk

    Then we tried an example, it compiled, ran but didn't show the changes we had already done to OpenMP.
    So I think we are missing or doing something wrong! do you have any ideas about what might be happening?

    We are using:
    processor-sdk-linux-rt-k2hk-evm-03.01.00.06

    We appreciate your help

    Thanks