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.

PROCESSOR-SDK-TDAX: Convert PC based C code to Embbeded code for SoC

Part Number: PROCESSOR-SDK-TDAX

Hi all,

I have a PC based C code for my application. I need to convert it to a format that can be run on target hardware.

Also, I referred about the PyTIOVX tool, but it generates OpenVX C code when given .py file with TIOVX module as input.

Please tell me if my understanding on PyTIOVX is correct and also suggest me a solution to convert C code to OpenVX C code to be run on target device.

Thanks in Advance!

Regards,

Padmasree N.

  • Hi Padmasree,

    Have you already gone over these tutorials? If not, i highly recommend it before you begin. Do check all the videos from 5.1 to 5.8

     

  • Hi Shyam,

    Thanks for your reply.

    I watched the videos mentioned and explored the user guides too.

    But the User Guide does not have clear cut explanation on how to implement a custom application in OpenVX format.

    Please tell me a way to write a OpenVX code for my application.

    I tried generating user kernel and user nodes using Pytiovx tool but I did not get a clear explanation in the user guide for modifying the generated folders for my custom application.

    I have the following queries.

    1) Should I manually re-write my entire application (in C language) into OpenVX? If so, please provide me a clear guidance.

    2) If Pytiovx tool generates all the necessary kernel and node API calls, how to modify it for my use case?

    Please do provide me some solutions and any insight regarding this would be helpful.

    Thanks in advance...

    Regards,

    Padmasree N.

  • Padmasree,

    I want to make a point of clarification.  OpenVX is not a programming language.  It is simply a C-API interface to a library in order to offload processing to remote cores.  It is an open standard, and therefore you can read about the standard online and take tutorials from the "references" page of the tiovx user guide.

    In terms of running your application on the target, to start with, you can simply compile and run your PC application as is on the A72, and assuming you have all the dependencies there, it should run.

    Next, you need to decide on the breakdown of your application.  Are there any parts you want to run on different cores, like the C66 DSP.  You can decide the logical division of the algorithm, and then create functions that have clear interfaces with inputs and outputs in a processing chain (if they don't already exist).  Once you have that, you can call pytiovx to create the files needed for each of these user kernels.  Then you need to fill in the processing details of these kernels.  For this you can refer to existing kernels in vision_apps.  Perhaps to help you understand the flow beyond the high level of the training videos, you can run the SDK demos, and connect CCS to the target side code and step through the various callbacks.This should give you a better idea of the flow of the kernel generation, so you can make your own and call into them from the A72-side OpenVX graph. 

    Regards,

    Jesse

  • Hi Jesse,

    Thanks for your clear explanation!

    I have created a .py file for one sample function of my own application on referring to psdk_rtos_auto_j7_07_00_00_11/vision_apps/kernels/park_assist/scripts/kernel_park_assist.py and I ran PyTIOVX tool to generate the directory structure in  psdk/tiovx path/tutorials/ch03_graph as mentioned in the following link.

    https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/06_02_00_21/exports/docs/tiovx/docs/user_guide/PYTIOVX.html#KERNEL_SCRIPT

    and I have added the kernel processing code (inserted C code directly from my application) in the respective generated file.

    Please advice me on how to verify my graph and is there any step I missed out?

    Also, I have gone through tutorials in vision apps and tiovx folders and found that PyTIOVX samples(.py file) in psdk_rtos_auto_j7_07_00_00_11/tiovx/tutorial/ch03_graph/ vx_tutorial_graph_user_kernel_pytiovx_uc.py  and  psdk_rtos_auto_j7_07_00_00_11/vision_apps/kernels/park_assist/scripts/kernel_park_assist.py are different and generate different folder structure.

    i.e., vx_tutorial_graph_user_kernel_pytiovx_uc.py----> generates only one .c and .h file

    whereas kernel_park_assist.py ---->  generates a folder having host,target,test and include folders.

    Please do throw some light on this.

    Also, Please specify which is to be used for successful creation of OpenVX graph for my application - TIOVX or vision apps?

    Any insight on this would be helpful.

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hi Jesse,

    Let me put my question in a more clear way.

    Once the user kernel is created, it can be used like any other node in an OpenVX graph.

    And in order to use it in a graph, should I include the generated user kernel directory files in TIOVX path/kernels/openvx-core along with existing kernel directory or is there any other way I can follow up ?

    Please do correct my understanding and tell me a way where I can place my user generated kernel to be used as any other node in a graph.

    Any insight on this would be helpful.

    Thanks in Advance!

    Regards,

    Padmasree N

  • I recommend you read the following document if you haven't already :

    When you ran the kernel generation script, I presume that the CUSTOM_APPLICATION_PATH was set to where the files were created.  It so happens that this macro is what TIOVX looks at when building, and it looks for the makefiles that were generated.  I suggest that you put your kernels in the vision_apps kernels path so that you can use it along with all the other kernels in vision apps (you just added your own).  When we built tiovx, we did it in such a way using this path so that you would NOT need to add your kernels within the tiovx folder structure.

    Jesse

  • Hi Jesse,

    Thanks for your reply!

    I have generated the custom kernel using PYTIOVX tool and made the necessary developer changes.

    I have also compiled and build my C source code and the .a file is also generated. I have modified the concerto.mak file of my user kernel and included the .a file. 


    Now,I am stuck up with two queries.

    1) Once the modified user kernel is ready and linked with the .a file of my C code, how do I use this in my application graph? i.e., How is this user kernel linked to my application graph ?

    2) Once the application graph is ready, we use PyTIOVX tool to generate a  .c and .h file along with an image representing each node of the graph. How and Where to provide my sample input to test the generated graph?

    Should I provide the sample input in the usecase.py (application graph) or in the generated files from usecase.py?

    Please do correct me if my understanding is right and suggest the possible solutions for my query.

    P.S: I have referred the tutorials and videos but I am not getting clarity on this point.

    Any insight on this would be very helpful!

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hi Jesse,

    Please tell me a way to link my generated user kernel to my application.

    i am not able to understand the linking process going inside.

    It would be really helpful if you could throw some light on this.

    Also,provide me some insight on passing sample input to my application graph.

    Regards,

    Padmasree N.

  • Hi all,

    I am facing the following error when i build vision apps.

    Please help me in solving this.

    /psdk_rtos_auto_j7_07_00_00_11/vision_apps/utils/opengl/include/app_gl_egl_utils.h:70:21: fatal error: EGL/egl.h: No such file or directory
    compilation terminated.
    concerto/finale.mak:306: recipe for target

    '/psdk_rtos_auto_j7_07_00_00_11/vision_apps/out/PC/x86_64/LINUX/release/module/applibs.test/test_srv_app.o' failed
    make[2]: 

    /psdk_rtos_auto_j7_07_00_00_11/vision_apps/out/PC/x86_64/LINUX/release/module/applibs.test/test_srv_app.o] Error 1
    make[2]: Leaving directory /psdk_rtos_auto_j7_07_00_00_11/vision_apps'
    Makefile:155: recipe for target 'vision_apps' failed
    make[1]: *** [vision_apps] Error 2
    make[1]: Leaving directory '/psdk_rtos_auto_j7_07_00_00_11/vision_apps'
    Makefile:163: recipe for target 'sdk' failed
    make: *** [sdk] Error 2

    Regards,

    Padmasree N

  • Hello,

    Could you please confirm that you have run the below script as referenced here?

    ./psdk_rtos/scripts/setup_psdk_rtos.sh
    Regards,
    Lucas

  • Hello Lucas,

    Yes.I tried the same and the error got resolved.

    Thank you!

    However, I have the following queries..

    1) The core.py does not have the core name to run the application on PC mode. Please suggest me a solution to run only in PC mode.

    2) When I run vision apps demos,I face the following error

    psdk_rtos_auto_j7_07_00_00_11/vision_apps/apps/basic_demos/app_c7x_kernel/c7x/app_c7x_target_kernel_img_add.cpp:91:19: fatal error: TI/j7.h: No such file or directory

    And when I comment out the line, I face this error. 

    psdk_rtos_auto_j7_07_00_00_11/vision_apps/apps/basic_demos/app_c7x_kernel/c7x/app_c7x_target_kernel_img_add.cpp:245:22: error: ‘TIVX_CPU_ID_DSP_C7_1’ was not declared in this scope

    Could you please throw some light on this?

    Any insight will really be helpful!

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hello Padmasree,

    Below are my responses to each question:

    1) PC emulation mode will emulate each of these targets as separate PC threads.  Therefore, you can provide as a target the target that the given algorithm should run on the EVM rather than explicitly specifying PC emulation.

    2) Are you saying this is an error when compiling? 

    If so, are you using CUSTOM_KERNEL_PATH when generating the PyTIOVX sample kernels?  If so, you will need to use a different path, either CUSTOM_APPLICATION_PATH or VISION_APPS_PATH when generating your kernels since CUSTOM_KERNEL_PATH is used by the build system for tiovx/vision_apps already.

    Regards,

    Lucas

  • Hello Lucas,

    Thanks for your reply!

    The error got resolved after using CUSTOM APPPLICATION PATH but now I am facing the following issue when compiling my application graph which uses custom kernel.

    psdk_rtos_auto_j7_07_00_00_11/vision_apps/out/PC/x86_64/LINUX/release/libvx_target_kernels_a72.a(vx_median_target.o): In function `tivxMedianProcess':
    vx_median_target.c:(.text+0x87): undefined reference to `getmedian'
    collect2: error: ld returned 1 exit status

    P.S: Median is the name of the node in my application graph and getmedian is the function compiled and added as a static library to the graph.

    Please help me in solving this issue.

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hi Lucas,

    Please reply to my above query and also explain me how to pass an input in the main() of my application graph.

    Regards,

    Padmasree N.

  • Hello Padmasree,

    From the first question, it looks like the library containing getmedian is not getting linked.  Can you tell me where you are including this library?  This should be included in vision_apps/apps/concerto_x86_64_inc.mak.

    And can you clarify the second question?  Are you trying to pass an OpenVX data object into an OpenVX graph?  This is done via the node parameters of a given node API which is declared as an input.

    Regards,

    Lucas

  • Hello Lucas,

    Thanks for your reply!

    Yes.I have linked it to the concerto and its working fine now. 

    For passing input to my graph, please do confirm me is this the right documentation I am referring to ?

    Also Please confirm me if OpenCv and Json file reading is supported and Can it be compiled as a static library to my application graph?

    If so, please tell me all the dependencies required.

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hello Padmasree,

    Yes, that is the correct documentation to use.

    Regarding OpenCV and Json file reading, we do not have native support for this in our SDK.

    Regards,

    Lucas

  • Hello Lucas,

    Thanks for your reply.

    I'm closing the thread for now. Will reopen if any issue comes further in my application.

    Regards,

    Padmasree N

  • Hello Lucas,

    The documentation here justifies that OpenCV can be linked with OpenVX graphs in TIOVX.

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Examples_and_Demos/Application_Demos/Optical_Flow_with_OpenVX.html

    Could you please tell me how to pass image as input and also for json file reading?

    Regards,

    Padmasree N.

  • Hello Padmasree,

    The documentation you are referring to is specific to the J6 platforms.  This is not available on J7.

    Regarding your question about passing images as input, could you specify what you are passing images to?  If this involves reading images from a json file, we do not have native support for this.  However, OpenVX has several image API's for populating image objects listed below.  TI has also provided an API for passing general references from non-OpenVX contexts to use in OpenVX graphs.  This documentation is provided below as well.

    www.khronos.org/.../group__group__image.html

    software-dl.ti.com/.../group__group__tivx__ext__host.html

    Regards,

    Lucas

  • Hello Lucas,

    Thanks for the clarification!

    Please help me in solving the below issue when I am trying to read the output, its showing NULL

    0.1979s: VX_ZONE_ERROR:[vxAddArrayItems:310] Array object descriptor is NULL
    0.1990s: VX_ZONE_ERROR:[vxCopyArrayRange:461] Invalid array range
    output is

    Below is my code.

    float input[5]={0,1,2,3,4};
    vxAddArrayItems(uc.values_in, 5, &input, sizeof(float));
    vxCopyArrayRange(uc.values_in,0,5,sizeof(float),input,VX_WRITE_ONLY,VX_MEMORY_TYPE_HOST);

    status = vx_two_nodes_uc_run(&uc);

    float output[1]={0};
    vxAddArrayItems(output, 1, &uc.median_out, sizeof(float));
    vxCopyArrayRange(uc.median_out,0,1,sizeof(float),&output,VX_READ_ONLY,VX_MEMORY_TYPE_HOST);
    printf("output is\n",output);

    The input is getting passed to my code successfully and I am able to print the output directly from the C code but I am unable to read the output from my application graph.

    Please advice me on where I am going wrong.

    Thanks and Regards,

    Padmasree N.

  • Hello,

    Have you called vxCreateArray to create each of the OpenVX array objects?  If not, these subsequent calls will fail.

    Regards,

    Lucas

  • Hi Lucas,

    I have called vxCreateArray() to all the objects mentioned above.

    Please advice me if this is the correct format for getting the output from user kernel through the graph.

    vxAddArrayItems(output, 1, &uc.median_out, sizeof(float));
    vxCopyArrayRange(uc.median_out,0,1,sizeof(float),&output,VX_READ_ONLY,VX_MEMORY_TYPE_HOST)

    Regards,

    Padmasree N

  • Hi Padmasree,

    The vxAddArrayItems is used to populate the array.  So if you have already run the graph and are trying to get the output from the array, this would not be used to get the output.  It would be used add items to the array, presumably before you run the graph.

    The vxCopyArrayRange is used with the VX_READ_ONLY flag to retrieve items from the array and to populate the output pointer.

    The first argument of each of these functions should be the vx_array itself, but the first argument of each of these is different.  I'm not sure which one is the vx_array, so you may need to check the API docs.

    There are test cases using each of these functions located at tiovx/conformance_tests/tset_conformance/test_array.c

    Regards,

    Lucas

  • Hello Lucas,

    Thanks for your reply.

    I have tried the approach u mentioned. Yet, I face the error. Below is a part of my code generated using PyTIOVX tool.


    usecase->node_1 = usecase_node_create_node_1 (
    graph ,
    usecase->values_in ,
    usecase->median_out

    main()

    {

    if (status == (vx_status)VX_SUCCESS)
    {
    printf("Running Graph...\n");
    float input[10]={0,1,2,3,4,5,6,7,8,9};
    vxAddArrayItems(uc.values_in, 10, &input, sizeof(float));
    vxCopyArrayRange(uc.values_in,0,10,sizeof(float),input,VX_WRITE_ONLY,VX_MEMORY_TYPE_HOST);
    status = vx_median_uc_run(&uc);
    float output[1]={0};
    vxCopyArrayRange(uc.median_out,0,1,sizeof(float),&output,VX_READ_ONLY,VX_MEMORY_TYPE_HOST);
    printf("output is %f\n ",output);

    }

    }

    Please advice me on where I am going wrong..and is the argument of vxCopyArrayRange is correct? 

    Where will the output of my kernel get stored in my case? in uc.median_out?

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hello Padmasree,

    The "output" parameter needs to be a pointer.  Therefore, these few lines should be:

    float *output = (float*)malloc(sizeof(float*1);
    vxCopyArrayRange(uc.median_out,0,1,sizeof(float),(void*)output,VX_READ_ONLY,VX_MEMORY_TYPE_HOST);

    And the output is stored in the "output" array.

    Regards,

    Lucas

  • Hi Lucas,

    Thanks for your reply!

    Sorry..I have made the OUTPUT parameter as a pointer only but shared wrong code here.

    Now that I modified the code to 

    float *output =(float*)malloc(1*sizeof(float));
    vxCopyArrayRange(uc.median_out,0,1,sizeof(float),(void*)output,VX_READ_ONLY,VX_MEMORY_TYPE_HOST);
    printf("output is %f\n",output);

    But still I face the same error.

    0.2546s: VX_ZONE_ERROR:[vxCopyArrayRange:461] Invalid array range
    output is 0.000000

    Any insights on this would be helpful.

    Regards,

    Padmasree N

  • Hi Padmasree,

    Is your full source code listed above?  Because I don't see where you are calling vxCreateArray.  If you are not calling this already, please do so.  If you are, then please provide your full source code so I can see if you are doing something incorrectly.

    Regards,

    Lucas

  • Hello Lucas,

    Please find my code below.

    {
    float input[10]={0,1,2,3,4,5,6,7,8,9};
    vxAddArrayItems(uc.values_in, 10, &input, sizeof(float));
    vxCopyArrayRange(uc.values_in,0,10,sizeof(float),input,VX_WRITE_ONLY,VX_MEMORY_TYPE_HOST);

    status = vx_median_uc_run(&uc);

    float *output =(float*)malloc(1*sizeof(float));
    vxCopyArrayRange(uc.median_out,0,1,sizeof(float),(void*)output,VX_READ_ONLY,VX_MEMORY_TYPE_HOST);
    printf("output is %f\n",output);

    }

    Still I face the following error:

    0.2546s: VX_ZONE_ERROR:[vxCopyArrayRange:461] Invalid array range
    output is 0.000000

    Any solution for this would really be helpful!

    Regards,
    Padmasree N.

  • Hi Padmasree,

    I replicated essentially the same thing on my end and am not seeing any errors.  Are there any other error logs that you see?

    If not, please add some additional logging in the location tiovx/source/framework/vx_array.c on line 461 where this error is occurring.  If you can print out the range_end, range_start, and obj_desc->num_items, this will help narrow down the issue.  Note: you will need to rebuild tiovx by running "make tiovx".

    Regards,

    Lucas

  • Hello Lucas,

    I tried the approach which you have told and please find the output below.

    0.0s: VX_ZONE_INIT:Enabled
    0.53s: VX_ZONE_ERROR:Enabled
    0.58s: VX_ZONE_WARNING:Enabled

    range_start is 0
    range_end is 1
    num_items is 0
    0.1972s: VX_ZONE_ERROR:[vxCopyArrayRange:464] Invalid array range
    output is 0.000000

    Regards,

    Padmasree N.

  • Hello Lucas,

    Please update me with the solution to above problem.

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hi Lucas,

    Any updates on the above query?

    Please provide me with solution as early as possible.

    Hoping to get the reply soon Slight smile

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hello Padmasree,

    Sorry for the delay in reply.  I thought I had posted the below, but it didn't come through.

    I think I see what the issue is.  You are using a custom kernel that outputs this vx_array, correct?

    If so, you will need to update the "num_items" field after processing the kernel.  It may be helpful to clarify that num_items is different than "capacity" which is specified when creating the array.  The num_items gets set in the kernel.  Since this array had not had any items added to it in the application, it is relying on the kernel for this num_items setting to occur.

    For an example on how this is done, please reference the kernel located at tiovx/kernels/openvx-core/c66x/vx_minmaxloc_target.c.

    Regards,

    Lucas

  • Hello Lucas,

    Thanks for the reply!

    Yes.You are right. I am using custom kernel generated using PyTIOVX tool.

    I have gone through the code you mentioned. But Please tell me a way to add this num_items feature in the .py file itself as I am using custom kernel generated using PyTIOVX tool.

    My custom kernel generated using PyTIOVX tool  just takes "values" [array of size 10] as an input and outputs "median" [array of size1]

    Regards,

    Padmasree N

  • Hi Lucas,

    I edited the kernel processing code as below.

    float* temp=(float*)median_target_ptr;
    *temp = getmedian((float*)values_target_ptr,10);
    printf("median_target_ptr is %f \n",median_target_ptr);
    if (NULL != median_desc)
    {
    if (max_cnt > max_cap)
    {
    median_desc->num_items = max_cap;
    }
    else
    {
    median_desc->num_items = max_cnt;
    }
    }

    And when I am trying to output the "median_target_ptr" from custom kernel, it still gives "0.0000".

    0.0s: VX_ZONE_INIT:Enabled
    0.40s: VX_ZONE_ERROR:Enabled
    0.45s: VX_ZONE_WARNING:Enabled
    Running Graph...
    The output is 4.500000 //output directly from C source
    median_target_ptr is 0.000000 //output from kernel
    range_start is 0
    range_end is 1
    num_items is 0
    0.2032s: VX_ZONE_ERROR:[vxCopyArrayRange:464] Invalid array range
    output is 0.000000

    But my C source is successfully compiled and built and linked to the custom kernel and I am able to output the median value directly from my C source but this fails in application.

    Please provide me with the solution.

    Thanks in Advance!

    Regards,

    Padmasree N.

  • Hello,

    You will need to add this in to the C code itself.  I believe the line should just be:

    median_desc->num_items = 1;

    Regards,

    Lucas

  • Hi Lucas,

    Thanks for your reply.

    I modified as you mentioned and now the error: Copyarrayrange is resolved.

    Yet Im unable to get the output.

    0.0s: VX_ZONE_INIT:Enabled
    0.47s: VX_ZONE_ERROR:Enabled
    0.52s: VX_ZONE_WARNING:Enabled
    Running Graph...
    The output is 4.500000 //output directly from C source
    median_target_ptr is 0.000000 //output from custom kernel
    output is 0.000000  //output from application graph

    Please help me in solving this.

    Regads,

    Padmasree N.

  • Hello Padmasree,

    Could you send me the updated source code where these prints are occurring?

    Regards,

    Lucas

  • Hi Lucas,

    Please find my updated code  of application graph below.

    if (status == (vx_status)VX_SUCCESS)
    {
    printf("Running Graph...\n");
    float input[10]={0,1,2,3,4,5,6,7,8,9};
    vxAddArrayItems(uc.values_in, 10, &input, sizeof(float));
    vxCopyArrayRange(uc.values_in,0,10,sizeof(float),input,VX_WRITE_ONLY,VX_MEMORY_TYPE_HOST);
    status = vx_median_uc_run(&uc);
    float *output =(float*)malloc(1*sizeof(float));
    vxCopyArrayRange(uc.median_out,0,1,sizeof(float),(void*)output,VX_READ_ONLY,VX_MEMORY_TYPE_HOST);
    printf("output is %f\n",output);

    }

    Regards,

    Padmasree N.

  • Hello Padmasree,

    I think you also have prints in the sample kernel code.  Could you provide the full source of this as well?

    Regards,

    Lucas

  • Hello Lucas,

    Please find the print statements of kernel below.

    median_desc->num_items = 1;
    float* temp=(float*)median_target_ptr;
    *temp = getmedian((float*)values_target_ptr,10);
    printf("median_target_ptr is %f \n",median_target_ptr);

    Regards,

    Padmasree N.

  • Hi Padmasree,

    Does the "temp" variable get set properly from getmedian?  And where is the below getting printed from?

    The output is 4.500000 //output directly from C source

    Regards,

    Lucas

  • Hello Lucas,

    "temp" is just a temporary variable to typecast to"float"

    The below line is getting executed successfully from the C source code [which has function definition] which is compiled and added as a static library and linked with the application graph.

    The output is 4.500000 //output directly from C source

    Note: The application graph calls my custom kernel which inturn goes to my C source code [function definition] and returns the median to the calling custom kernel and inturn the application graph finally.

    In the above process, the input is getting succesfully passed from graph->kernel->C source

    and the output is computed successfully only in the C source code, But the output is not successful from  C source->kernel->graph

    Please do correct me if I am wrong.

    Regards,

    Padmasree N.,

  • Hello Padmasree,

    Your understanding here is correct.  My question was to see how the "output" value was returned from getmedian because it evidently is returning "0" in the kernel.  Since I don't have the source of getmedian, it is hard to say why it would be returning "0".  I see that there is a print statement showing "4.5" but I'm not sure where this is coming without the source.  The kernel code looks correct, so my suspicion is that there is an issue with returning the value from getmedian.

    Regards,

    Lucas

  • Hello Lucas,

    Thanks for verifying my understanding!

    Herewith I am attaching the median C source code.

    static inline float32_t getmedian(std::vector<float32_t> & values)
    {
    float32_t median = std::numeric_limits<float32_t>::quiet_NaN();

    //compute median

    return median;
    }

    // just a wrapper below

    float getmedian(float* arr, int n)
    { std::vector<float> data;
    float32_t output = std::numeric_limits<float32_t>::quiet_NaN();
    data.reserve(n);
    for(int i=0;i<n;++i)

    data.push_back(arr[i]);
    }
    output=getmedian(data);
    printf("The output is %f\n",output);
    return output;
    }

    Regards,

    Padmasree N.

  • Hello Padmasree,

    This looks ok to me.  I am wondering if it is having some issue linking the C++ code with C code.  Could you possibly try a simple test of setting the temp value in the kernel wrapper to "4.5" and seeing if this gets propagated to the application?

    If this is working, we may need to explore how your code is getting integrated.

    Regards,

    Lucas

  • Hi Lucas,

    I have tried setting 'temp' to 4.5. But still I get 0 as the output from my graph.

    float* temp=(float*)median_target_ptr;
    *temp = 4.5000;

    output:

    0.0s: VX_ZONE_INIT:Enabled
    0.142s: VX_ZONE_ERROR:Enabled
    0.153s: VX_ZONE_WARNING:Enabled
    Running Graph...
    output is 0.000000

    For linking C++ with C, I have declared the function with extern "C"

    Regards,

    Padmasree N.

  • Hi Padmasree,

    Thanks, I am not sure what this issue could be.

    Could you please provide your latest application code so that I can review, especially where you call vxCreateArray?

    Regards,

    Lucas

  • Hi Lucas,

    Below is a part of my application graph python file which has generated the usecase file using PyTIOVX tool.


    myarray = Array(Type.FLOAT32, 10, name="values_in")
    myscalar = Array(Type.FLOAT32, 1, name="median_out")

    Regards,

    Padmasree N.