MPI.jl icon indicating copy to clipboard operation
MPI.jl copied to clipboard

Avoid closures for custom operators

Open simonbyrne opened this issue 4 years ago • 4 comments

To support custom operators for PowerPC and ARM, we will need to avoid using closures as these are not supported (https://github.com/JuliaLang/julia/pull/34326 and https://github.com/JuliaLang/julia/issues/32154). There might be performance advantages on other platforms as well.

We currently skip the relevant tests on these platforms (#353)

Some options:

  • convert Op(f, T=Any) to a generated function
  • write a macro that allows us to "declare" custom operator/type combinations, i.e.
    @Op f T
    
    would define a non-closure cfunction for Op(::typeof(f),::Type{T})

simonbyrne avatar Jun 30 '20 17:06 simonbyrne

Is there any progress on this issue? I just ran into it on my ARM/M1 laptop and would like to help getting it fixed. Unfortunately, I do not have the necessary chops to go about this alone, but I would be willing to lend a hand, run tests on an M1 etc. if that would be useful.

sloede avatar Apr 02 '22 04:04 sloede

May be relevant: https://discourse.julialang.org/t/ann-cclosure-jl-c-closures-like-what-c-does/81234

giordano avatar May 18 '22 08:05 giordano

For non-closures, we could use the same approach used by @yuyichao here https://github.com/JuliaMath/GSL.jl/pull/132/files#diff-ed5863a4bdd6189a79314f8c6cb0d3acefa0fe9235e7df221e6686fedb9efc08R40-R48 There is a bit of an explanation on how it works here: https://github.com/JuliaMath/GSL.jl/pull/130#issuecomment-1875799180

simonbyrne avatar Feb 02 '24 04:02 simonbyrne

Ah, I don't think that will work.

simonbyrne avatar Feb 02 '24 06:02 simonbyrne