Skip to content

MPI_Win_lock lock_type not clarified enough in documentation #694

Open
@zerothi

Description

@zerothi

Problem

The MPI specification is, to me, not clear enough on the implications on using lock_type in combination with assert values.

For instance a code like the following

  MPI_Win win;
  if (rank == 0) {
    MPI_Win_create(buffer, BUF_SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
  } else {
    // on all other processes we expose nothing
    MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);
  }

  if (rank != 0) {
    int target = 0;
    MPI_Win_lock(MPI_LOCK_SHARED,target,MPI_MODE_NOCHECK,win);
    MPI_Accumulate(buffer, BUF_SIZE, MPI_INT, target, 0, BUF_SIZE, MPI_INT, MPI_SUM, win);
    MPI_Win_unlock(target,win);
  }

From the description in mpi40-report.pdf Sec. 12.5.3 I only have:

Starts an RMA access epoch. The window at the process with rank rank can be accessed
by RMA operations on win during that epoch. Multiple RMA access epochs (with calls
to MPI_WIN_LOCK) can occur simultaneously; however, each access epoch must target a
different process
.

(I have bolded the problematic sentence)

To me this looks like my above code would be faulty since all rank!=0 access the same target without checking for coherence (NOCHECK). But it isn't clear from the specification whether the MPI implementor should ensure this, or I should.

Later in the same section I read

Advice to users. There may be additional overheads associated with using
MPI_WIN_LOCK and MPI_WIN_LOCK_ALL concurrently on the same window. These
overheads could be avoided by specifying the assertion MPI_MODE_NOCHECK when
possible (see Section 12.5.5). (End of advice to users.)

This to me sounds like I should ensure coherence. Since the NOCHECK will put coherence on the shoulders of the code-writer, and not on the MPI-implementor.

All-in-all I think the clarity of the lock_type is unclear in conjunction with the assert statements.

Proposal

In Sec 12.5.3 it would be ideal if we could clear out the lock_type definitions.

Changes to the Text

In Sec 12.5.3 it would be ideal if we could clear out the lock_type definitions:

lock_type defines whether other processors may access the window at the same time.

  • MPI_LOCK_EXCLUSIVE ensures window can only be accessed by a single process at a time
  • MPI_LOCK_SHARED allows all processors to access the window at the same time

Impact on Implementations

None.

Impact on Users

Users would be able to read the MPI specification and fully grasp what lock_type variables and assert variables do to a Win_lock call.

References and Pull Requests

Metadata

Metadata

Assignees

Labels

chap-rmaRMA Chapter Committeempi-6For inclusion in the MPI 5.1 or 6.0 standardwg-rmaRMA Working Group

Type

No type

Projects

Status

To Do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions