Speaking only to the last patch, I think it would make the tests 
Cython-compatible too.  I experienced that same issue where 'import 
py.test.cmdline' failed, maybe because cmdline was not a module?


-syam


________________________________
From: PyCUDA <pycuda-boun...@tiker.net> on behalf of Emanuel Rietveld 
<e.j.rietv...@gmail.com>
Sent: Monday, February 26, 2018 8:53:03 AM
To: pycuda@tiker.net
Subject: [PyCUDA] PyCUDA PyPy compatibility

Hi,

I'm trying to use PyCUDA with PyPy. With these two patches it seems to work...

(Taken from 
https://urldefense.proofpoint.com/v2/url?u=https-3A__svn.boost.org_trac10_ticket_4125&d=DwIGaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=7KaCwpE161eTIbiGDtQmV05me-P1kWzL4it5juttbsU&m=zoDOm5UkifrQcV08Q7ZQHFo_jzaD4G9QslsmLye0_5o&s=IcUBIeZnIwo5wZu4fMy-joe302pOIfPOw6qMlxd8Xy4&e=
 )

diff --git a/bpl_subset/libs/python/src/wrapper.cpp
b/bpl_subset/libs/python/src/wrapper.cpp
index f8feaef..8b1b884 100644
--- a/bpl_subset/libs/python/src/wrapper.cpp
+++ b/bpl_subset/libs/python/src/wrapper.cpp
@@ -25,7 +25,7 @@ namespace detail

               if (
                   PyMethod_Check(m.get())
-                  && ((PyMethodObject*)m.get())->im_self == this->m_self
+                  && PyMethod_GET_SELF(m.get()) == this->m_self
                   && class_object->tp_dict != 0
               )
               {
@@ -34,7 +34,7 @@ namespace detail


               }
-              if (borrowed_f != ((PyMethodObject*)m.get())->im_func)
+              if (borrowed_f != PyMethod_GET_FUNCTION(m.get()))
                   return override(m);
           }
       }

(Taken from 
https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.python.org_3_library_platform.html&d=DwIGaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=7KaCwpE161eTIbiGDtQmV05me-P1kWzL4it5juttbsU&m=zoDOm5UkifrQcV08Q7ZQHFo_jzaD4G9QslsmLye0_5o&s=cJFOYPktyfgMvWQOsLmCWwzTqaX3t-SfOJOzKW9LXNU&e=
 )

diff --git a/pycuda/characterize.py b/pycuda/characterize.py
index 1c54af7..c66c448 100644
--- a/pycuda/characterize.py
+++ b/pycuda/characterize.py
@@ -1,13 +1,14 @@
 from __future__ import division
 from __future__ import absolute_import

+import sys
 from pycuda.tools import context_dependent_memoize
 import numpy as np


 def platform_bits():
-    return tuple.__itemsize__ * 8
-
+    if sys.maxsize > 2**32: return 64
+    else: return 32

Is there anything else I'd need to be mindful of? On this PyPy page
https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_pypy_compatibility_wiki_Home&d=DwIGaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=7KaCwpE161eTIbiGDtQmV05me-P1kWzL4it5juttbsU&m=zoDOm5UkifrQcV08Q7ZQHFo_jzaD4G9QslsmLye0_5o&s=hX7k0aZG5mga09_fZpGKMPEq2TMiFbypSJsUpdTkwwQ&e=
  PyCUDA is
explicitly listed as incompatible... However with the following patch
to the tests, I can run those too and they all pass.

diff --git a/test/test_cumath.py b/test/test_cumath.py
index 874ccb6..272ab5a 100644
--- a/test/test_cumath.py
+++ b/test/test_cumath.py
@@ -242,5 +242,5 @@ if __name__ == "__main__":
     if len(sys.argv) > 1:
         exec (sys.argv[1])
     else:
-        from py.test.cmdline import main
+        from pytest import main
         main([__file__])
diff --git a/test/test_driver.py b/test/test_driver.py
index f88a1d6..038cf64 100644
--- a/test/test_driver.py
+++ b/test/test_driver.py
@@ -961,5 +961,5 @@ if __name__ == "__main__":
     if len(sys.argv) > 1:
         exec (sys.argv[1])
     else:
-        from py.test.cmdline import main
+        from pytest import main
         main([__file__])
diff --git a/test/test_gpuarray.py b/test/test_gpuarray.py
index 93cc954..e38e2fd 100644
--- a/test/test_gpuarray.py
+++ b/test/test_gpuarray.py
@@ -1153,5 +1153,5 @@ if __name__ == "__main__":
     if len(sys.argv) > 1:
         exec (sys.argv[1])
     else:
-        from py.test.cmdline import main
+        from pytest import main
         main([__file__])

Thanks,

Emanuel

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.tiker.net_listinfo_pycuda&d=DwIGaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=7KaCwpE161eTIbiGDtQmV05me-P1kWzL4it5juttbsU&m=zoDOm5UkifrQcV08Q7ZQHFo_jzaD4G9QslsmLye0_5o&s=zyqQSqV58TvcseTDrbdjuigvaCXsGP2dvD35HuHmW2g&e=
_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
https://lists.tiker.net/listinfo/pycuda

Reply via email to