Tool/software: TI C/C++ Compiler
Hello,
I devellop an image processing applications and would like to use openmp for offloading some parts of the image processing to the dsp cores of the am5726.
I already have an application that runs on the arm cores only with instrumented code so that I can display test images from the the threads running the image processing functions.
Now this debug feature should also run with openmp on the dsp-cores but so far I did not manage to send back the data to the arm thread from the offloaded thread.
My first question is how to find out what subset of the openmp standard is implemented in the clacc and the other tool in the sdk. Here
downloads.ti.com/.../openmp_accelerator.html
I read that #pragma omp target is supported for example. It seems that the "if" - conditions is also suppported although it is not docuemnted there. So I also tried to use the nowait, but it did not compile.
Is this also implemented? We still use the tools from the am5726 linux sdk version 3.1. Do we need to upgrade?
What i would to implemented with openmp is something like the printf feature, but I would like to hand over image data from the offloaded thread to the linux thread.
Since the image size is big, I would like to alloc the buffer with CMEM on the host and map it to the target. Then image data is copied into the frame buffer on the target and the offloaded thread should be blocked. The buffer then should be synchronised with the host so that a Linux thread can display the image. Then the offloaded thread should continue and copy the next image for debugging into the buffer.
In principle with the nowait I tried the following but It did not even compile. Just to give you an idea what I would like to do:
typedef struct _frameBuf
{
int ready;
char data[800*600];
} FrameBuf;
FrameBuf *frambuffer=NULL;
umsgined char image[]={ ....... };
char imageProcessingResult[...];
void linux_thread_func_1()
{
int useOffloading=1;
int target_thread_running=1;
frambuffer = CMEM_alloc2(sizeof(FrameBuf));
#pragma omp target data map(to: image[0:...]) map(tofrom: frambuffer[0:1]) map(tofrom: imageProcessingResult[0:....) map(tofrom:target_thread_running)
{
#pragma omp target nowait if (useOffloading)
{
imageprocessingStep1OnTarget(...);
copyAnImageToFramebufferAnBlockTheTargetThread(frambuffer,....);
frambuffer->ready = 1;
__cache_l2_wbinv(frambuffer, sizeof(frambuffer));
// then wait on the target until the host hat displayed the image and the buffer is ready for the next, maybe busy waiting like that
while(frambuffer->ready){
__cache_l2_inv(frambuffer, sizeof(frambuffer->ready));
}
// Target thread unblocked after image in framebuffe is displayed on the host
imageprocessingStep2OnTarget(...);
copyAnImageToFramebufferAnBlockTheTargetThread(frambuffer,....);
......
......
target_thread_running = 0;
}
// with nowait there should be no barrier and host thread should continue here
while(target_thread_running)
{
#pragma omp target update from frambuffer[0:1]
//check if framebuffer contains an image
if(framebuffer->image_ready)
{
displayimage();
framebuffer->image_ready = 0;
}
//do i need any CMEM_cache operations here?
#pragma omp target update to frambuffer;
#pragma omp target update from target_thread_running
usleep(1000);
}
}
}
Is it possible to do something like this with the openmp accelerator for the am5726.
Thank you very much.