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.

Linux/AM5716: OpenCL compile for static library

Part Number: AM5716

Tool/software: Linux

Dear TI experts,

We have one problem to use opencl to compile a third static library, during our test , it seems not allowed to call a third library.

According to RT linux and RTOS for AM5716 SDK, we can compile the opencl kernel by Calling TI BIOS APIs 

http://downloads.ti.com/mctools/esd/docs/opencl/extensions/bios-apis.html

Is it possible to compile the opencl kernel to call a third static library functions ?  For example, we want to use a third static library functions, how could we compile the wrapping opencl kernel to use the functions. 

Looking forward for your feedback!

Many Thanks!

Nemo

  • Hi, Nemo,

    Which third static library functions are you trying to call? Is it one of the APIs listed in the OpenCL documentation? Did you call the API from standard C code that is called from OpenCL C code?

    Rex
  • Dear Rex,

    Our compiler enviroment: 

    Ti RT linux SDK:  version (05.02.00.10) ti-processor-sdk-linux-rt-am57xx-evm-05.02.00.10

    TI RTOS SDK: version(05.02.00.10) processor-sdk-rtos-am57xx-5-02-00-10

    We are using our own static library which is based only for standard C code.

    I give a simple example as bellow:

    add_test.h

    #ifndef _ADD_TEST_H_
    #define _ADD_TEST_H_
    
    extern int add_test(int a, int b);
    #endif
    

    add_test.c

    #include <stdio.h>
    #include "add_test.h"
    
    int add_test(int a, int b)
    {
      int res = a + b;
      printf("add test\n");
      return res;
    }
    

    Then I using the tool cl

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

    int add_test(int a, int b)
    {
    int res = a + b;
    printf("add test\n");
    return res;
    }

    We can use cgt-c6x/bin/cl6x -mv6600 --abi=eabi  to get the object file add_test.obj.

    next  step,  we use cgt-c6x/bin/ar6x r DspLibTest.lib ./add_test.obj to generate the static library DspLibTest.lib. 

    We try to test this library with opencl examples :  opencl-examples-1.1.17.01/persistent_clock_concurrent, we add the dsp.c as bellow:

    #include "ti/sysbios/knl/Clock.h"
    #include "ti/sysbios/knl/Task.h"
    #include "shared.h"
    #include "add_test.h"
    ... // skip code
    void start_clock(uint32_t *completion_code)
    {
        ... // skip code
        printf("The clock ticked %u times in 1 sec\n", counter);
        int result = add_test(3,4);
        *completion_code = APP_OK;
    }

    In the Makefile we add the library link flag with -lDsPLibTest.lib for the 

    EXE        = persistent_clock_concurrent
    CXXFLAGS   = -O3 -I../persistent_common
    CL6XFLAGS  = -o2 -I./ -I../persistent_common --mem_model:data=far --mem_model:const=data
    CLOCLFLAGS = -I./ -lDSBLibTest.lib
    USE_RTOS   = 1
    
    
    VPATH = ../persistent_common
    
    include ../make.inc
    
    $(EXE): host.o host_assist.o
    	@echo Linking $@
    	$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
    
    host.o: kernel.dsp_h
    
    kernel.dsp_h: dsp.o 

    During the compile, it shown the error:

    undefined first referenced

    symbol          in file

    ---------       -------------------------

    add_test    dsp.obj

    error #10234-D: unresolved symbols remain

    error #10010: errors encountered during linking; "kernelout" not built 

    ....

    With clocl help , we find that it can use -l option, -l, --lib : Do not link. Stop after compilation, Is this not available for the static library link?

    Thanks a lot! 

  • Hi, Xinping,

    The way I understand the document is that it only supports the call to TI BIOS APIs, and not all BIOS APIs are supported. Only those BIOS and IPC APIs listed are supported. Other than those, I don't think it can be done.

    Rex