AnsweredAssumed Answered

i.MX6Q and  OpenMP not work

Question asked by Ask2000 Core on Apr 17, 2019
Latest reply on Apr 17, 2019 by igorpadykov

I try to run OpenMp on i.MX6Q, but on the test task I see that only one core works at a time, while the monitor shows the load of all cores.
Here is an example that shows that the program is executed sequentially and not in parallel.

From the debug output, it can be seen that the threads are created and launched at about the same time, but then they work sequentially.
What and how to do to run the threads simultaneously ???

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <sys/time.h>

int omp(const uint8_t * restrict a, uint8_t * restrict n, int len) {
uint32_t i;
struct timeval tv;

#pragma omp parallel for num_threads(4)

for (i=1; i<len; i++) {
printf("Time:%d Thread %d, y=%d\n",tv.tv_usec,omp_get_thread_num(),i);
n[i] = (a[i] + a[i-1]) / 2.0;

return 0;

int main(int argc, char *argv[]) {
uint8_t * a;
uint8_t * n;
int32_t i;
a = malloc( 24*24);
n = malloc( 24*24);
//for (i=0;i<100;i++)
return 0;

Here is the sorted output:

Time:676345 Thread 0, y=1
Time:676345 Thread 1, y=7
Time:676346 Thread 2, y=13
Time:676352 Thread 3, y=19

Time:676420 Thread 1, y=8
Time:676477 Thread 1, y=9
Time:676509 Thread 1, y=10
Time:676542 Thread 1, y=11
Time:676566 Thread 1, y=12
Time:676618 Thread 3, y=20
Time:676658 Thread 3, y=21
Time:676691 Thread 3, y=22
Time:676715 Thread 3, y=23
Time:676805 Thread 0, y=2
Time:676842 Thread 0, y=3
Time:676874 Thread 0, y=4
Time:676968 Thread 0, y=5
Time:677004 Thread 0, y=6
Time:677087 Thread 2, y=14
Time:677113 Thread 2, y=15
Time:677136 Thread 2, y=16
Time:677157 Thread 2, y=17
Time:677177 Thread 2, y=18