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

MPI nodes don't handle scalar args correctly #1348

Open
kylosus opened this issue Aug 7, 2023 · 0 comments
Open

MPI nodes don't handle scalar args correctly #1348

kylosus opened this issue Aug 7, 2023 · 0 comments

Comments

@kylosus
Copy link
Contributor

kylosus commented Aug 7, 2023

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):

  • Latest DaCe master branch

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.

dst_range = None
if isinstance(dst, tuple):
dst_name, dst_range = dst
dst_node = state.add_read(dst_name)
elif isinstance(dst, str) and dst in sdfg.arrays.keys():
dst_name = dst
dst_node = state.add_read(dst_name)
else:
storage = desc.storage
dst_name = _define_local_scalar(pv, sdfg, state, dace.int32, storage)
dst_node = state.add_access(dst_name)
dst_tasklet = state.add_tasklet('_set_dst_', {}, {'__out'}, '__out = {}'.format(dst))
state.add_edge(dst_tasklet, '__out', dst_node, None, Memlet.simple(dst_name, '0'))

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

1 participant