- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
i am trying to use openmp.
i have a loop the goes over a vector of objects and does an operation on each of them.
i have reduced the code to this;
i am trying to use openmp.
i have a loop the goes over a vector of objects and does an operation on each of them.
i have reduced the code to this;
#pragma omp parallel for
for (int i=0;isize();i++)
{
std::cout << "Thread id:" << omp_get_thread_num() << " num " << omp_get_num_threads() << std::endl;
}
for this i get the 2 following warnings
.ClassifierKNN.cpp(122): warning #1433: OpenMP for-test may not conform
for (i=0;isize();i++)
^
.ClassifierKNN.cpp(122) : (col. 7) remark: OpenMP: Loop's header stmt (STMT_LABEL) not found or it is a dead loop.
when i run this i can see i have only a single thread.
if i replace m_TrainData->size() with a number i get only the second warning and still a single thread when run.
Thanks in advance.
Eli.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll probably want to assign m_TrainData->size() to a variable before the loop. I don't think OpenMP can deal with a loop that can potentially change its termination condition while it is executing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That did it.
Thanks.
Thanks.

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