I’m using nsight and wanted to use c++11 cpu threads for some host code.
Any reference to threads here is about std::thread just to avoid any confusion. I’ve enable the c++11 option in settings and #include etc. I initially tried this with cuda 7.5 on Fedora 23 and then a fresh install of kubuntu and cuda 8. I’ve tried a clean c++ only project with a single main.cpp file to avoid any potential cuda issues.
I have a very strange problem where nsight gives me errors when I attempt to USE a thread.
I can declare a thread or launch one i.e.
std::thread some_thread(exmpleFunction, arg1, arg2, etc);
and all is good, nsight is ok with that, no errors. However, if I try to use the thread in any way,
for instance, I get an error that says there is no join() method, and I have no code completion either. However, the actual compile works and I can run the program. Whats even stranger, is if I try to create a vector of threads, e.g.
for (int i = 1; i <= some_limit; ++i)
threads.push_back(std::thread(exampleFunction, arg1, arg2, etc));
nsight complains that there is no method push_back() and yet it has no problem resolving this method for a vector of any other objects than threads.
I’ve also tried to update the indexes and all that but it didnt’ change anything.
The specific error messages are:
Method ‘push_back’ could not be resolved … Semantic Error
Method ‘join’ could not be resolved … Semantic Error
Any suggestions as to what magic I need to do to get nsight to NOT give me these errors would be greatly appreciated.
edit: I attached a screenshot of the contents of thread.h under the projects ‘Includes’ entry for /use/include/c++/5. Any idea what the / symbol means? I’m kind of guessing it means those things aren’t available maybe…? still can’t explain why it compiles and runs but nsight reports an error and i have no code completion.