modular icon indicating copy to clipboard operation
modular copied to clipboard

[BUG] parallelize crashes on WSL2

Open antonl321 opened this issue 1 year ago • 0 comments

Bug description

the attached code crashes on WSL2. By trial and error I think that the call to parallelize is runs into issues. The command mojo t1.mojo generates these error messages: $ mojo t1.mojo [1181138:1181138:20240929,130011.971766:ERROR elf_dynamic_array_reader.h:64] tag not found [1181138:1181138:20240929,130011.971881:ERROR elf_dynamic_array_reader.h:64] tag not found [1181138:1181138:20240929,130011.972088:ERROR elf_dynamic_array_reader.h:64] tag not found [1181138:1181138:20240929,130011.972132:ERROR elf_dynamic_array_reader.h:64] tag not found [1181138:1181138:20240929,130011.973591:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2) [1181138:1181138:20240929,130011.973629:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2) Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes. Stack dump: 0. Program arguments: mojo t1.mojo [1181138:1181139:20240929,130011.975567:ERROR directory_reader_posix.cc:42] opendir /home/syla/Apps/mojo/test-240925/.magic/envs/default/share/max/crashdb/attachments/99a143a0-90e3-494c-9a3d-003bcc257fc8: No such file or directory (2) Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it): 0 mojo 0x000055fa1f0bf47b 1 mojo 0x000055fa1f0bd3d9 2 mojo 0x000055fa1f0bfb1d 3 libc.so.6 0x00007f966757f520 4 libc.so.6 0x00007f95e80010d0 mojo crashed! Please file a bug report. Segmentation fault

Steps to reproduce

  • Include relevant code snippet or link to code that did not work as expected.

from memory import UnsafePointer from algorithm import parallelize

alias BPP = 4 alias NUM_THREADS = 4

fn main():

var width = 512
var height = 512
var stride = width*BPP
var src = UnsafePointer[UInt8].alloc(height*stride)

@parameter
fn process_line1(y : Int):
    var idx = y*stride
    var x = SIMD[DType.uint8,4](42)
    for _ in range(width):
        src.store[width=4](idx, x)
        idx += BPP

var y = 22
process_line1(y)

print(src[y*stride])

parallelize[process_line1](height, NUM_THREADS)
print(src[0])

src.free()

System information

- What OS did you do install Mojo on ?
Ubuntu 22.04.3 LTS via WSL2
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.5.0 (e8aacb95)
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.9.1 (3460d12e)
magic 0.3.0

antonl321 avatar Sep 29 '24 19:09 antonl321