spcl / dace

DaCe - Data Centric Parallel Programming
http://dace.is/fast
BSD 3-Clause "New" or "Revised" License
497 stars 129 forks source link

MPI nodes don't handle scalar args correctly #1348

Open kylosus opened 1 year ago

kylosus commented 1 year ago

Describe the bug The dace program fails to compile if the integer args of MPI nodes (dst and tag) are anything other than symbols, symbol expressions and numbers.

To Reproduce

rank = dc.symbol('rank', dtype=dc.int64)

@dc.program
def func(A: dc.int32[N]):
    # dace.comm.Send(A[0], rank - 1, 0) # Works
    dace.comm.Send(A[0], abs(rank - 1), 0)

The program fails to compile with the following error:

ValueError: Node type "Send" not supported for promotion

Same behavior in other scenarios:

# ...
a = 0
a = rank
a = A[0]
dace.comm.Send(A[0], a, 0)

Desktop (please complete the following information):

Possible fix: The code below should check if the sdfg.arrays entry for the corresponding arg is a Scalar when given an str and fall to the last branch.

https://github.com/spcl/dace/blob/f4b4d01f67cb089b3ef821673e0a12405c94f9b1/dace/frontend/common/distr.py#L424-L436

tbennun commented 1 week ago

@kylosus did you end up resolving this? In which PR?