Re: Apparent linkage conflicts with dVAR; dXSARGS; when compiled using nvcc

[email protected] (bulk88)
Newsgroups perl.xs
Message-ID <[email protected]>
David Mertens wrote:
> Sorry for not getting back to this as quickly as I had hoped. My 
> machine with nVidia hardware is at home and I haven't had much time in 
> the las few evenings to play with it. This may be the case through the 
> weekend; we shall see.
>
> bulk88, I was not entirely sure what PERL_NO_GET_CONTEXT did. After 
> some digging, I came across this article that seemed to clarify things 
> quite a bit, at least for me: 
> http://perl.active-venture.com/pod/perlguts-concurreny.html. I also 
> did some reading and discovered that there are ways to have 
> thread-local data in C, which was news to me. (I never learned the 
> intricacies of C.) Suddenly the behavior of dTHX; and the whole api 
> with the _nocontext suffix make so much more sense.
>
> Thanks!
> David
>
>

PERL_NO_GET_CONTEXT removed a bazillion func calls to Perl_get_context 
or in your case (since you are posix os), pthread_getspecific. This 
makes your XS code much faster (20 to 100% faster). Look at the 
preprocessed version of the .c file at 
https://gist.github.com/run4flat/4974702 . Sadly PERL_NO_GET_CONTEXT's 
biggest reason to use it (performance) isn't in perlguts.  Its main 
purpose it to remove the extra get context func calls. The thread local 
data stuff  ( 
http://perldoc.perl.org/perlxs.html#Safely-Storing-Static-Data-in-XS ) 
few modules use (they normally get_sv a package SV), but there is no 
reason why you can't use it.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.