cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

emuller
Journeyman III

Asynchronous stream write seg fault

I'm passing a memory pointer created by Python (numpy array) to a asynchronous stream write ( stream.write(python_ptr, "async") ) and it is causing segfault, while the same write in synchronous mode is not causing a seg fault.  Therefore, I assume there are restrictions on destination memory pointers for asynchronous writes.  Anybody know what they are?

 

 

 

 

0 Likes
6 Replies
gaurav_garg
Adept I

There are no restrictions on the ptr? Do ypu see this problem only with numpy array or also with C allocated arrays?

0 Likes

Thanks for you reply.  On digging deeper, I uncovered a curiousity:

(I'm working in Python, so forgive the pseudo code)

s1 = Stream(dimensions)

s2 = Stream(dimensions)

s1.read(buf)

s2.read(buf)

s1.finish(); s2.finish()

s1.write(buf1,async=True)

s2.write(buf2,async=True)

The second call to s2.write in async mode reveals the dimensions of s2 are rank=0.  If I call s1.finish() before the s2.write call, everything is fine. 

The cause of my previous segfault was that I was not checking matching dimensions.  Perhaps I was reading the dimensions array which should have no elements if rank=0.

But still, there is something problematic here.

The same happens for:

s1.write(buf1,async=True)

s2.read(buf)

again, the dimensions of s2. are revealed to be rank=0.  If I call s1.finish() before the s2.read call, everything is fine.

This contradicts the documentation in 2.13.2 in the Stream User's guide, where an example is given of the same flavor as what I am doing above.  From what I observe, that example should not work.

 

 

 

0 Likes

Using rank=0 is definitely invalid. You can not have a stream that has no size.

0 Likes

Originally posted by: gaurav.garg Using rank=0 is definitely invalid. You can not have a stream that has no size.


Indeed.  So my question is: Is it intended behaviour that an asynchronous stream write causes other streams to have rank=0 until it finishes?  That is the behaviour I am observing.

 

 

0 Likes

What is the maximum number of simulataneous asynchronous writes?  In my application, I observe >1 to intermittantly segfault.

0 Likes

I observed the same behavior: seg fault with 2 succesive asynchronous stream.write; or a kernel call directly following an async stream.write (obviously on independent streams) 

To me the stream.write(x, "async") only allows concurrent work on the cpu side, not on the gpu.

0 Likes