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

@batch loops freeze completely on Apple M2 Pro with Julia x86 (Rosetta) #126

Open
efaulhaber opened this issue Nov 9, 2023 · 4 comments

Comments

@efaulhaber
Copy link

Because of the problems with ARM (#88 and #89) I wanted to give Julia x86 with Rosetta a shot.
Unfortunately, @batch doesn't really work at all for me there:

julia> @btime @batch for _ in 1:1000 end
  1.258 μs (0 allocations: 0 bytes)

julia> @btime @batch for _ in 1:1000 end

It just freezes there forever and doesn't react to Ctrl + C. CPU load goes down to a constant 100%.

I can't reproduce this by just putting @batch for _ in 1:1000 end into a plain for loop, so there must be something that BenchmarkTools is doing to trigger this bug. But it's not just BenchmarkTools. I can't run any multithreaded simulations with our simulation code: trixi-framework/Trixi.jl#1724

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (x86_64-apple-darwin22.4.0)
  CPU: 10 × Apple M2 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, westmere)
  Threads: 10 on 10 virtual cores
Environment:
  JULIA_EDITOR = code
@chriselrod
Copy link
Member

I suspect there is a bug in ThreadingUtilities' or Polyester's atomics, and they're exposed on apple silicon because it has much better out of order capabilities than anything else.

@efaulhaber
Copy link
Author

It seems to work with v1.10 (rc1) 👍

@chriselrod
Copy link
Member

I think it is a lot more likely to be a bug in Polyester than Julia or LLVM, so I wouldn't be surprised if it shows up again on 1.10.

@efaulhaber
Copy link
Author

You're right. Still happening in 1.10.

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

No branches or pull requests

2 participants