Hi Andreas, > Le 14 mai 2020 à 00:07, Andreas Kloeckner <li...@informa.tiker.net> a écrit : > > Vincent Favre-Nicolin <fa...@esrf.fr> writes: >> 1) if there is a way to have an element-wise kernel with >> no_extern_c=True - but I don’t know how to resolve the name mangling >> issue to access the kernel function ? >> >> 2) add a ‘cpp_preamble’ option to SourceModule and ElementwiseKernel >> (and others) to add a preamble before the ‘extern “C”’ > > 1) would be the preferred option from my perspective. Simply sticking an > "extern "C" in front of the kernel declaration would likely > suffice. There is a backward compatibility concern here for other > potentially mangled names in the preamble, but ElementwiseKernel doesn't > really expose the SourceModule, so it's IMO unlikely that someone tried > to get those symbols.
OK, so if I understand this would mean calling SourceModule with no_extern_c=True, and inserting the extern "C" as: """ #include <pycuda-complex.hpp> %(preamble)s extern “C" __global__ void %(name)s(%(arguments)s) { (…) %(operation)s; (…) } “”” Ok, That’s indeed much simpler - I see that’s how the reduction kernel works, I had not seen that. I have submitted a PR. Thanks ! Vincent — Vincent Favre-Nicolin Co-editor, J. Synchrotron Radiation http://journals.iucr.org/s/ <http://journals.iucr.org/s/> Director, HERCULES school http://hercules-school.eu <http://hercules-school.eu/> ESRF-The European Synchrotron http://www.esrf.eu <http://www.esrf.eu/> 71, Avenue des Martyrs Grenoble, France X-Ray NanoProbe (XNP) group Tel: +33 4 76 88 28 11 On leave from Univ. Grenoble Alpes
_______________________________________________ PyCUDA mailing list -- pycuda@tiker.net To unsubscribe send an email to pycuda-le...@tiker.net