alias NTHREADS = 4
fn xyz(A: UnsafePointer[Float32], B: UnsafePointer[Float32], nc:Int):
B.store(nc, A.load(nc))
fn main():
var A = UnsafePointer[Float32].alloc(4)
var B = UnsafePointer[Float32].alloc(4)
for i in range(4):
A[i] = i
B[i] = 1
print("Before:")
print("A:", A.load[width=4](0))
print("B:", B.load[width=4](0))
@parameter
fn parallel_xyz(thread_id: Int):
# print(thread_id)
xyz(A + (thread_id), B + (thread_id), thread_id)
total_items = 4
parallelize[parallel_xyz] (total_items, NTHREADS)
# print("After:")
# print("A:", A.load[width=4](0))
# print("B:", B.load[width=4](0))
我收到以下输出错误:
Before:
A: [0.0, 1.0, 2.0, 3.0]
B: [1.0, 1.0, 1.0, 1.0]
[24010:24010:20241114,152857.053919:ERROR elf_dynamic_array_reader.h:64] tag not found
[24010:24010:20241114,152857.054009:ERROR elf_dynamic_array_reader.h:64] tag not found
[24010:24010:20241114,152857.054422:ERROR elf_dynamic_array_reader.h:64] tag not found
[24010:24010:20241114,152857.054484:ERROR elf_dynamic_array_reader.h:64] tag not found
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
mojo crashed!
Please file a bug report.
但如果我取消注释最后三行代码,它就可以正常工作。有人能帮忙吗