Nsight compiler error

I have a problem with the pthread_create command in that it won’t compile: see attachments

ParallelTeam.h (894 Bytes)
ParallelTeam.cpp (4.93 KB)

I’m sorry but your screenshot does not show the error message and I cannot compile your source files locally as you did not attach all the headers.

Can you perform a build and paste here the NVCC output?

I believe I actually see the problem on line 68. It is caused by worker_func being non-static member function. This thread on StackOverflow describes what you should do: http://stackoverflow.com/questions/1151582/pthread-function-from-a-class


I’ve rebuilt the code and included the header files but, the function has problems.
ParallelTeam.h (901 Bytes)
ParallelTeam.cpp (4.94 KB)
Memory.h (731 Bytes)
IllegalArgumentException.h (358 Bytes)

Please check http://stackoverflow.com/questions/1151582/pthread-function-from-a-class on how to pass member functions to pthreads library functions.


Now I have another problem; I can’t access “this” in my static member and I can’t write to my allocated memory locations. Is there a workaround?

Note that this is general C++ question and is not specific to CUDA or NVCC compiler.

There is a number of issues that arise from what you are trying to do (e.g. is “this” pointer still valid when new thread is ran? - I see it is in your example, but this may not be true in your complete code) so I suggest you check StackOverflow for comprehensive answers on the subject.

Is there a particular article?

I see there is a number of links in “Linked” and “Related” section on the question page that I gave the link above.

Sorry, made a mistake.

please forget previous post. Here is a more accurate one: see attachments
Memory.h (731 Bytes)
ParallelTeam.h (866 Bytes)
ParallelTeam.cpp (4.56 KB)
IllegalArgumentException.h (358 Bytes)