https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86088

            Bug ID: 86088
           Summary: #pragma omp parallel for freezes if other processes
                    are running
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shibatch at users dot sourceforge.net
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

The following small program takes more than 20 seconds to finish.
It quickly finishes if compiled with clang.
It finishes instantly without fork().

OS: Ubuntu 16.04.4 LTS
CPU: Core i7-6700

$ gcc-8.1.0 -fopenmp stall.c
$ time ./a.out

real    0m26.846s
user    1m47.288s
sys     0m0.004s
$ clang-6.0 -fopenmp stall.c
$ time ./a.out

real    0m0.423s
user    0m1.244s
sys     0m0.012s

--

#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define SIZEA 100
#define SIZEB 10000

unsigned char a[SIZEA * SIZEB], b[SIZEA * SIZEB];

int main(int argc, char **argv) {
  fork();

  int i;
  for(i=0;i<1000;i++) {
    int y;
#pragma omp parallel for
    for(y=0;y<SIZEA;y++) memcpy(&a[y*SIZEB], &b[y*SIZEB], SIZEB);
  }
}

Reply via email to