This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, Compiling and running the attached gomp test code crashes (or sometimes locks up) on a dual core PC. I.e. gcc -fopenmp -lgomp gomp-test.c ./a.exe crashes. If invoked as ./a.exe 1 however, the program is run single-threaded and completes correctly. Does the test code appear to be correct usage of gomp? Note that the problem seems to be highly dependent on the heap usage pattern prior to the multi-threaded part of the code (the pattern used in the test code was extracted from a run of a real application). Cheers, Rob
Attachment:
cygcheck.out
Description: Text document
#include <omp.h> #include <stdio.h> #include <stdlib.h> void * xmalloc(size_t n) { void * result = malloc(n); if (!result) abort(); return result; } void use_some_heap(void) { void * p, * q; xmalloc(560); xmalloc(5); xmalloc(1); xmalloc(560); xmalloc(5); xmalloc(1); xmalloc(108); xmalloc(1397); xmalloc(559); xmalloc(136); xmalloc(4); p = xmalloc(4); xmalloc(136); free(p); xmalloc(136); xmalloc(104); p = xmalloc(104); xmalloc(272); xmalloc(104); free(p); xmalloc(136); xmalloc(128); q = xmalloc(128); xmalloc(320); p = xmalloc(17912); xmalloc(17920); free(p); p = xmalloc(3272); xmalloc(32768); free(p); xmalloc(136); xmalloc(16384); xmalloc(272); xmalloc(128); xmalloc(320); p = xmalloc(3272); xmalloc(32768); free(p); free(q); xmalloc(136); xmalloc(704); p = xmalloc(704); xmalloc(272); xmalloc(704); free(p); xmalloc(136); xmalloc(4); p = xmalloc(4); xmalloc(136); free(p); xmalloc(32768); xmalloc(32768); xmalloc(32768); xmalloc(32768); xmalloc(32768); xmalloc(8); xmalloc(8); xmalloc(16384); xmalloc(16384); xmalloc(16384); xmalloc(16384); } int function1(int n) { return n + 1; } int main(int argc, char * argv[]) { int i, f; if (argc > 1) omp_set_num_threads(1); use_some_heap(); for (i = 0; i < 20000; ++i) { #pragma omp parallel for for (f = 0; f < 2; ++f) function1(argc); if ((i & 255) == 255) putc('*', stderr); } return 0; }
-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |