baldand / py-metal-compute

A python library to run metal compute kernels on macOS
MIT License
68 stars 11 forks source link

v0.2.0: Passing numpy arrays to kernel functions does not work correctly #13

Closed baldand closed 2 years ago

baldand commented 2 years ago

Version: v0.2.0:

This kind of code does not work correctly:

import metalcompute as mc
import numpy as np

dev = Device()
fn = dev.kernel(code).function(name)
np_buf = np.zeros(1,dtype='f')
np_buf[0] = 42
fn(count, np_buf, output_buf)

The kernel function does not see the value.

If a builtin array.array('f',[42]) is used instead, it works. Also if the np object is backed by a device.buffer, it works.

baldand commented 2 years ago

Resolved by PR #14 / v0.2.1