Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_Jones1
Beginner
111 Views

segmentation fault calling mkl function in pthread and stacksize question

I have been getting memory corruption and segmentation faults calling some mkl functions inside separate threads created with pthreads. If I disable mkl's fast memory management, everything seems to work. I have had this problem with dgetrf, specifically. I am setting OMP_NUM_THREADS=1 when I run mkl functions in separate threads.

I believe that the problem is a stack overflow; I have been using the default stack size with pthreads. Assuming my diagnosis is correct (please correct me if I am wrong):

How can I determine the size to set for the stack in each pthread I create?

Thanks
0 Kudos
3 Replies
Gennady_F_Intel
Moderator
111 Views

There are no specifiec MKL's routines to do that.
Try ulimit -s to increase the size in each thread.
--Gennady
TimP
Black Belt
111 Views

If you are using an MKL OpenMP threaded function, the KMP_STACKSIZE environment variable, or the equivalent call to the OpenMP library, would allow you to set the thread stack size limit. As Gennady mentioned, you would still require attention to the overall stack size limit.
Jason_Jones1
Beginner
111 Views

Thank you for the quick response!

My question is not how to increase the stack size of my threads. My question is: how large does the mkl library need the stack for any given thread to be if I am to use the fast memory management feature? I have not found found any specifics in the docs.

BTW, I am passing all of my data to the mkl functions as double pointers on the heap rather than arrays on the stack.

Jason
Reply