Parallelize Issue
This is my code:
I get the following output error:
But if I un-comment the last three lines of code, it works fine. Can anyone please help!
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))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))I get the following output error:
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.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.But if I un-comment the last three lines of code, it works fine. Can anyone please help!
