Exceptions in openMP

Exceptions in openMP

Hi All,

I am facing issue with openMP in C++. I have one process in Linux server, am setting 1GB virtual memory for that process using setrlimit() function and openmp is used in the code base. During execution, process got crashed, core file is generated. I have debugged the core file and found that crash is happening in the "#pragma omp parallel for" line. I think virtual memory is exceeded in openmp statement and bad_alloc exception is raised and not it handled or openmp is not raising bad_alloc exception . I have tried to add this "#pragma omp parallel for" line in inside try block and added catch block with bad_alloc exception but it is not catching. Even I tired with catch(...) but no luck.

Can all share your view on whether openMP will raise the exceptions in this scenario and also share your suggestion to resolve this issue.

Thanks in advance.

Thread Topic: 

Help Me
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Srinu B.

This forum is dedicated for discussions of the open source runtime library, not for general OpenMP questions. So you would better post your question on the forum of the compiler you are using.

Nevertheless, I will try to answer.  The OpenMP specification says that exception raised by one of threads in parallel region must be caught by the same thread inside the same parallel region. So you may want to put your try block inside the parallel region in order to catch the exception.


Leave a Comment

Please sign in to add a comment. Not a member? Join today