mojo icon indicating copy to clipboard operation
mojo copied to clipboard

[BUG] `parallelize` function with python modules results to `seg fault`

Open toiletsandpaper opened this issue 11 months ago • 2 comments

Bug description

I'm trying to parallelize my classify function over a DynamicVector of custom structs. But without parallelization code is very slow, even slower than python's approach, but this is probably because of my skill issue with sorting.

Firstly, I've got a problem that without try-catching function that raises - I can't use any of parallelize function at all. Secondly, when I wrote somewhat a workaround - I got very short seg fault

Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
[5581:16081077:20240318,154326.598003:WARNING crash_report_exception_handler.cc:257] UniversalExceptionRaise: (os/kern) failure (5)
zsh: segmentation fault  mojo run main.mojo

Steps to reproduce

  1. error raises here - https://github.com/toiletsandpaper/mojo_zlib_classification/blob/f463f042bee8287da1b646cabe19460872831e75/classifiers/classifier.mojo#L42C1-L60C23
  2. Just follow a readme of seg_fault_parallelized branch and it should install all with make locally https://github.com/toiletsandpaper/mojo_zlib_classification/blob/seg_fault_parallelized/README.md

System information

❯ uname -moprsv
Darwin 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:27 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T8103 arm64 arm
❯ modular -v
modular 0.5.2 (6b3a04fd)
❯ mojo -v
mojo 24.1.0 (55ec12d6)

  Host Information
  ================

  Target Triple: aarch64-unknown-macosx
  CPU: apple-m1
  CPU Features: aes, complxnum, crc, dotprod, fp-armv8, fp16fml, fullfp16, jsconv, lse, neon, pauth, ras, rcpc, rdm, sha2, sha3

toiletsandpaper avatar Mar 18 '24 12:03 toiletsandpaper