- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using recent (2026, 2025, & 2024) oneAPI C++ on Windows I found that OpenMP parallel for on iterator-based and range-based for loops isn't working in debug builds, but index-based loops work. For example, this demo:
#include <vector>
#include <iostream>
int
main()
{
std::vector< int > v = {0,1,2,3,4,5,6,7,8,9};
// Works
// #pragma omp parallel for
// for ( std::vector< int >::size_type i = 0; i < v.size(); ++i ) {
// ++v[i];
// }
// Fails in in debug build at runtime
#pragma omp parallel for
for ( std::vector< int >::iterator i = v.begin(); i < v.end(); ++i ) {
++(*i);
}
for ( int i : v ) std::cout << i << std::endl;
}compiled with:
icx /nologo /Qopenmp /Qopenmp-simd- /EHsc /Wall /Od /MDd
builds but terminates at runtime, sometimes popping up a dialog with "ITERATOR LIST CORRUPTED". With /MD or /MT it runs fine.
It doesn't appear to be a VC++ standard library limitation because I see the same problem with my own classes, yet I believe this usage worked some years ago.
Maybe this is a known/documented limitation but I couldn't find any information on it.
Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page