[MacPorts] #69350: pyopencl does not work with Catalina

MacPorts noreply at macports.org
Fri Feb 16 17:25:35 UTC 2024


#69350: pyopencl does not work with Catalina
--------------------------------+--------------------
  Reporter:  lpagani91          |      Owner:  (none)
      Type:  defect             |     Status:  new
  Priority:  Normal             |  Milestone:
 Component:  ports              |    Version:  2.9.1
Resolution:                     |   Keywords:
      Port:  pyopencl 2023.1.4  |
--------------------------------+--------------------

Comment (by lpagani91):

 I have the same problem with my real program or with a simple program such
 as this one :


 {{{
 import pyopencl as cl
 import numpy as np
 import os
 os.environ['PYOPENCL_NO_CACHE'] = '1'
 os.environ['PYOPENCL_COMPILER_OUTPUT'] = '1'

 def InitCL(GPU=0, platforms=[0,1,2,3]):
     platform, device, context, queue = None, None, None, None
     for iplatform in platforms:
         print("TRYING PLATFORM %d" % iplatform)
         try:
             platform = cl.get_platforms()[iplatform]
             if (GPU>0):
                 device   = [platform.get_devices(cl.device_type.GPU)[1]]
             else:
                 device   = platform.get_devices(cl.device_type.CPU)
             context   =  cl.Context(device)
             queue     =  cl.CommandQueue(context)
             break
         except:
             pass
     print(platform, device)
     return platform, device, context, queue,  cl.mem_flags


 platform, device, context, queue, mf = InitCL()

 source = """
 void __kernel test(__global float *A) {
      int id = get_global_id(0) ;
      if (id>=Nx) return ;
      A[id] = A[id]*A[id] ;
 }
 """

 N       =  128
 args    =  "-D Nx=%d" % N
 program =  cl.Program(context, source).build(args)
 test    =  program.test
 X       =  np.asarray(np.arange(N), np.float32)
 X_buf   =  cl.Buffer(context, mf.READ_WRITE, 4*N)
 cl.enqueue_copy(queue, X_buf, X)
 test(queue, [N,], [1,], X_buf)
 cl.enqueue_copy(queue, X, X_buf)
 print(X)
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/69350#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list