I am using the pthread library to implement multithreading.
I am in the process of moving my functions that use detectNet to threads so I can handle network communication tasks in the background. The threads do not need to share memory allocated by cudaMalloc().
In the process of doing so, I am receiving a segmentation fault on cudaMalloc().
I’ve read a bit online and found that cudaMalloc() is thread safe.
Below, is a snippet of cudaMalloc(). Sorry if this is a naive question, but should I be doing something different so that I do not get a segmentation fault? The function works just fine when I do not use threads.
In this snippet, I am allocating the memory during initialization so that I can get performance benefits.
I think this is a stack issue but I’ve checked the stack size and it’s 8 megabytes. I have a bunch of other variables being initialized so it may be possible I’m going over the limit but I would be surprised.