代码拉取完成,页面将自动刷新
import numpy as np
from mindspore import ops
import mindspore as ms
from mindspore.ops import kernel
# 算子实现,Hybrid DSL
@kernel
def add(a, b):
c = output_tensor(a.shape, a.dtype)
for i0 in range(a.shape[0]):
for i1 in range(a.shape[1]):
c[i0, i1] = a[i0, i1] + b[i0, i1]
return c
if __name__ == "__main__":
# 定义hybrid类型的自定义算子(Custom的默认模式)
op = ops.Custom(add)
x0 = np.array([[0.0, 0.0], [1.0, 1.0]]).astype(np.float32)
x1 = np.array([[2.0, 2.0], [3.0, 3.0]]).astype(np.float32)
output = op(ms.Tensor(x0), ms.Tensor(x1))
print(output)
npu下单独运行产生多个报错BrokenPipeError: [Errno 32] Broken pipe
Please assign maintainer to check this issue.
请为此issue分配处理人。
@fangwenyi @chengxiaoli @Shawny
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
感谢您的提问,您可以评论//mindspore-assistant更快获取帮助:
你好,我看这边装饰器用的是@sample,这里应该用@kernel,如果还是有问题,麻烦贴出完整的报错信息和代码,谢谢
import numpy as np
from mindspore import ops
import mindspore as ms
from mindspore.ops import kernel
# 算子实现,Hybrid DSL
@kernel
def add(a, b):
c = output_tensor(a.shape, a.dtype)
for i0 in range(a.shape[0]):
for i1 in range(a.shape[1]):
c[i0, i1] = a[i0, i1] + b[i0, i1]
return c
if __name__ == "__main__":
# 定义hybrid类型的自定义算子(Custom的默认模式)
op = ops.Custom(add)
x0 = np.array([[0.0, 0.0], [1.0, 1.0]]).astype(np.float32)
x1 = np.array([[2.0, 2.0], [3.0, 3.0]]).astype(np.float32)
output = op(ms.Tensor(x0), ms.Tensor(x1))
print(output)
报错信息
(venv) [服务器]$ python test_hybrid.py
[WARNING] ME(93027:281473670082800,MainProcess):2024-03-29-06:35:15.717.13 [mindspore/run_check/_check_version.py:348] Using custom Ascend AI software package (Ascend Data Center Solution) path, package version checking is skipped. Please make sure Ascend AI software package (Ascend Data Center Solution) version is supported. For details, refer to the installation guidelines https://www.mindspore.cn/install
[WARNING] ME(93027:281473670082800,MainProcess):2024-03-29-06:35:15.719.59 [mindspore/run_check/_check_version.py:468] Can not find driver so(need by mindspore-ascend). Please check whether the Environment Variable LD_LIBRARY_PATH is set. For details, refer to the installation guidelines: https://www.mindspore.cn/install
[WARNING] ME(93027:281473670082800,MainProcess):2024-03-29-06:35:18.761.194 [mindspore/ops/operations/custom_ops.py:544] For 'Custom', 'func_type': hybrid, 'func': <function add at 0xffff0a1d8e50>, 'out_shape' or 'out_dtype' is None, infer the output shape and output dtype automatically. There might be some Python RuntimeWarning but it wouldn't influence the result.
[WARNING] GE_ADPT(93027,ffffb21e70f0,python):2024-03-29-06:35:33.367.784 [mindspore/ccsrc/transform/graph_ir/utils.cc:77] FindAdapter] Can't find OpAdapter for Custom_add_8cd0dbca4c3a95114ad742596ec86291719a964dd46d8a85ac40000e1173937a
Segmentation fault
(venv) [服务器]$ Process ForkServerPoolWorker-4:
Process ForkServerPoolWorker-7:
Process ForkServerPoolWorker-3:
Traceback (most recent call last):
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
Traceback (most recent call last):
Process ForkServerPoolWorker-6:
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
Process ForkServerPoolWorker-8:
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError: [Errno 32] Broken pipe
Process ForkServerPoolWorker-2:
Process ForkServerPoolWorker-9:
Process ForkServerPoolWorker-5:
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
Traceback (most recent call last):
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
BrokenPipeError: [Errno 32] Broken pipe
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
During handling of the above exception, another exception occurred:
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 131, in worker
put((job, i, result))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
BrokenPipeError: [Errno 32] Broken pipe
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
During handling of the above exception, another exception occurred:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
During handling of the above exception, another exception occurred:
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
BrokenPipeError: [Errno 32] Broken pipe
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/pool.py", line 136, in worker
put((job, i, (False, wrapped)))
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/queues.py", line 368, in put
self._writer.send_bytes(obj)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
self._send(header + buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
File "/home/Python-3.8.18/lib/python3.8/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError: [Errno 32] Broken pipe
BrokenPipeError: [Errno 32] Broken pipe
/home/Python-3.8.18/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 97 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
您好,由于问题单没有回复,我们后续会关闭,如您仍有疑问,可以反馈下具体信息,并将ISSUE状态修改为WIP,我们这边会进一步跟踪,谢谢
登录 后才可以发表评论