Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] Illegal instruction (core dumped) under Proxmox VM #52

Closed
pythcoiner opened this issue Apr 29, 2024 · 6 comments · Fixed by #53
Closed

[CLI] Illegal instruction (core dumped) under Proxmox VM #52

pythcoiner opened this issue Apr 29, 2024 · 6 comments · Fixed by #53

Comments

@pythcoiner
Copy link

pythcoiner commented Apr 29, 2024

Installed w/ cargo install ocrs-cli
trying to run ocr <filename> on this 2 images (png) return a Illegal instruction (core dumped) output:

cropped

gray_img

@robertknight
Copy link
Owner

Can you provide details of:

  • The CPU you are using
  • The operating system you are running on and its version
  • Whether you are using any kind of virtualization environment (Rosetta, qemu etc.)

Previous reports of this error have involved some kind of CPU virtualization (#49, robertknight/rten#35).

I was able to run Ocrs on the two images you provided and got the correct output, so there isn't an issue with the image itself.

@pythcoiner
Copy link
Author

right, it's happend under ubuntu 22.04 w/ a Proxmox VM, here the config:

image

@robertknight
Copy link
Owner

Can you confirm the CPU model being used by the VM? It doesn't appear in that screenshot. See #49 (comment). For the best performance, you want something that supports AVX-2 / FMA. I'm not familiar with Proxmox, but it sounds like the "host" option is the easiest way to get this. If there is a x86-64-v3 or x86-64-v4 CPU option, that should include it.

There is a bug as Ocrs shouldn't just crash if the capability is not present, but the fallback without these CPU features will be somewhat slower.

@robertknight robertknight changed the title [CLI] Illegal instruction (core dumped) [CLI] Illegal instruction (core dumped) under Proxmox VM Apr 29, 2024
@robertknight
Copy link
Owner

Thanks for the report. I was able to trigger an Illegal Instruction error using an Ubuntu 24.04 VM running under emulation in UTM (qemu), with the CPU set to Intel Nehalem (see https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels), which is a pre-AVX2 CPU.

The issue is fixed upstream by robertknight/rten#131 and should be in the next Ocrs release.

Backtrace:

Thread 2 "ocrs" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7ffff7a006c0 (LWP 2789)]
0x0000555555862320 in rten_vecmath::exp::simd_sigmoid ()
(gdb) bt
#0  0x0000555555862320 in rten_vecmath::exp::simd_sigmoid ()
#1  0x000055555586254b in rten_vecmath::exp::vec_sigmoid_in_place ()
#2  0x00005555558482b3 in rayon::iter::plumbing::bridge_producer_consumer::helper ()
#3  0x00005555557bee26 in rayon_core::join::join_context::{{closure}} ()
#4  0x00005555558483af in rayon::iter::plumbing::bridge_producer_consumer::helper ()
#5  0x00005555557bee26 in rayon_core::join::join_context::{{closure}} ()
#6  0x00005555558483af in rayon::iter::plumbing::bridge_producer_consumer::helper ()
#7  0x0000555555764d29 in rayon_core::join::join_context::{{closure}} ()
#8  0x000055555576e7bc in <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute ()
#9  0x000055555559a82f in rayon_core::registry::WorkerThread::wait_until_cold
    ()
#10 0x0000555555865d62 in rayon_core::registry::ThreadBuilder::run ()
#11 0x00005555558692da in std::sys_common::backtrace::__rust_begin_short_backtrace ()
#12 0x000055555586a44f in core::ops::function::FnOnce::call_once{{vtable.shim}}
    ()

robertknight added a commit that referenced this issue Apr 29, 2024
This fixes a crash on x64 CPUs that don't support AVX2 instructions, and
generally improves performance.

Fixes #52
@robertknight
Copy link
Owner

ocrs-cli v0.6.0 has been released which should fix the issue. I would still recommend configuring your VM to use a newer CPU, as using one that supports AVX2 will be 2-4x faster.

@pythcoiner
Copy link
Author

Just try w/ 0.6.0, works well, thanks for quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants