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

Move functionality to submodules #338

Closed
simonbyrne opened this issue Jan 19, 2020 · 10 comments
Closed

Move functionality to submodules #338

simonbyrne opened this issue Jan 19, 2020 · 10 comments

Comments

@simonbyrne
Copy link
Member

Should we make submodules match MPI function groupings? I've done this for certain additions (MPI.Types for MPI_Type_XXX functions, MPI.File for MPI_File_XXX functions). Should we do this for others? e.g. MPI_Comm_XXX, MPI_Cart_XXX, MPI_Win_XXX.

This is slightly complicated by the fact that Comm and Win are already used by type names. So in that case we would either need to rename the types (e.g. to Communicator and Window), or use different names for the modules (one convention in Julia is to use the plural name for the module, e.g. Comms, so that the function would be MPI.Comms.rank).

Thoughts?

@lcw
Copy link
Member

lcw commented Jan 21, 2020

I am okay with making submodules match MPI function groupings. The main thing I would like to see is that the interface is consistent. So if we do it in one place we do it everywhere, if possible.

@simonbyrne
Copy link
Member Author

I agree. I chose MPI.Types instead of MPI.Type to avoid conflicts with Type{X} (I thought it was a reserved word, but it isn't, so we could work around it by referring to Base.Type{T} where necessary).

@lcw
Copy link
Member

lcw commented Jan 21, 2020

At first glance MPI.Comms.rank feels weird but if we are consistent everywhere (i.e., use the plural name for every module) then the interface should be fairly discoverable.

@ViralBShah
Copy link
Member

It really should be MPI.Comm.rank. Comms just sounds really wrong.

@PhilipVinc
Copy link
Contributor

PhilipVinc commented Jan 24, 2020

Since we're talking about changing the MPI naming convention, and Julia has dispatch:
Why shouldn't MPI.rank(::MPI.Comm.Communicator) just work? Of course calling MPI.rank on an array makes no sense, so MPI.Comm.rank is ultimately redundant...

I mean, MPI is a package by itself. I believe submodules should be used in this context to:
a) avoid namespace pollution (not relevant in this case, I believe)
b) Make the names more akin standard MPI name (we can still have this, by using MPI.Comm.rank inside of MPI )
c) Separate functionality (can be done, see (b))

@simonbyrne
Copy link
Member Author

If we do name the module Comm, what do people prefer for the type name: Communicator (vote 🎉) or CommHandle (vote 🚀)?

@eschnett
Copy link
Contributor

People will expect the type name to be one of MPI_Comm, MPI.Comm, Comm, etc. Changing this is very invasive.

Changing the function name is more easily possible. I think that object-oriented MPI bindings are not a good pattern to follow because Julia has multiple dispatch. In C++, one would write comm.rank() (where comm is an object of type MPI::Comm). The Julia equivalent is rank(comm), or MPI.rank(comm) (depending on how the module is imported).

@ViralBShah
Copy link
Member

ViralBShah commented Jan 27, 2020

I would be ok with not doing submodules.

@lcw
Copy link
Member

lcw commented Jan 27, 2020

I am okay without submodules as well and like MPI.rank(comm).

@simonbyrne
Copy link
Member Author

I can live with that.

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

5 participants