Skip to content

Conversation

@romanc
Copy link
Contributor

@romanc romanc commented Feb 7, 2026

Get the number of warnings in tests down by avoiding usage of state.add_* functions like state.add_array(...). Also fixes deprecation warnings in mpi tests by passing argnames to distributed compile.

Based on top of #2299.

@tbennun tbennun changed the title WIP: avoid usage of deprecated state.add_array() and `state.add_stream() WIP: avoid usage of deprecated state.add_array() and state.add_stream() Feb 8, 2026
@romanc romanc force-pushed the romanc/avoid-state-add_array branch from e043cd4 to 9808e84 Compare February 9, 2026 08:56
@romanc romanc marked this pull request as ready for review February 9, 2026 14:06
@tbennun tbennun changed the title WIP: avoid usage of deprecated state.add_array() and state.add_stream() Avoid usage of deprecated state.add_array() and state.add_stream() Feb 9, 2026
Copy link
Collaborator

@tbennun tbennun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change but otherwise LGTM!

# Loads compiled SDFG.
if rank > 0:
func = load_precompiled_sdfg(folder)
func = load_precompiled_sdfg(folder, argnames=argnames)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this. Shouldn't sdfg.argnames exist if argnames was not provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that exists. My reading of

if self.argnames is None and len(sdfg.arg_names) != 0:
warnings.warn('You passed `None` as `argnames` to `CompiledSDFG`, but the SDFG you passed has positional'
' arguments. This is allowed but deprecated.')

is that relying on this information is deprecated. I guess I don't understand correctly. Of course, I could provide argnames from sdfg.argnames inside load_precompiled_sdfg and then non of these changes are necessary, but that feels kind of like defeating the purpose, no? Unless, that was the plan all along and PR https://github.com/spcl/dace/pull/2291/changes shouldn't have added argnames as optional argument to load_precompiled_sdfg in the first place.

Copy link
Collaborator

@tbennun tbennun Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see in the initial commit that triggered this warning, the correct way to deal with this argument is to pass in the arg_names value if no one else overrode it: 5248dad

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh, so there's arg_names and argnames. Now I see. I'll fix it up tomorrow. Thanks for the pointer!

if rank == 0:
sdfg = comm_world_bcast.to_sdfg()
func = utils.distributed_compile(sdfg, commworld)
func = utils.distributed_compile(sdfg, commworld, argnames=["A"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe all changes here will not be necessary if my previous comment is addressed

if rank == 0:
sdfg = mpi4py_isend_irecv.to_sdfg(simplify=True)
func = utils.distributed_compile(sdfg, commworld)
func = utils.distributed_compile(sdfg, commworld, argnames=["rank", "size"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

# Disable OpenMP section to allow blocking
sdfg.openmp_sections = False
mpi_sdfg = utils.distributed_compile(sdfg, comm)
mpi_sdfg = utils.distributed_compile(sdfg, comm, argnames=["rank", "size"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

raise ValueError("Please run this test with at least two processes.")

func = utils.distributed_compile(sdfg, commworld)
func = utils.distributed_compile(sdfg, commworld, argnames=["dims", "periods", "coords", "valid", "P"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

if rank == 0:
sdfg = matrix_2d_2d.to_sdfg()
func = utils.distributed_compile(sdfg, commworld)
func = utils.distributed_compile(sdfg, commworld, argnames=["A"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 32 to 33
func = utils.distributed_compile(sdfg, commworld, argnames=["A"])

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 24 to 25
A_ = state.add_access("A")
B_ = state.add_access("B")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A_ = state.add_access("A")
B_ = state.add_access("B")
A_ = state.add_access('A')
B_ = state.add_access('B')

@romanc romanc force-pushed the romanc/avoid-state-add_array branch from f308da8 to 9f4dfaa Compare February 11, 2026 19:07
@romanc romanc force-pushed the romanc/avoid-state-add_array branch from 3135e9a to 592ffc1 Compare February 12, 2026 07:18
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

Successfully merging this pull request may close these issues.

2 participants