jipolanco / PencilArrays.jl

Distributed Julia arrays using the MPI protocol
https://jipolanco.github.io/PencilArrays.jl/dev/
MIT License
60 stars 8 forks source link

Add support for broadcasting PencilArrays #3

Closed jipolanco closed 3 years ago

jipolanco commented 4 years ago

Right now broadcasting with PencilArrays doesn't work as expected.

Minimal example:

using MPI
using PencilArrays

MPI.Init()

topo = MPITopology(MPI.COMM_WORLD, (1, 1))
pen = Pencil(topo, (12, 23, 42), (1, 2))

A = PencilArray{Float64}(undef, pen)

The following operations return an Array{Float64,3} instead of a PencilArray{Float64,3}:

A .+ A
2 .* A

This should probably also return a PencilArray, effectively promoting a regular Array into a distributed array:

A .+ Array(A)

Note that when the arrays include dimension permutations, there are a few things to consider: