Changes between Version 32 and Version 33 of Public/ParaStationMPI


Ignore:
Timestamp:
May 31, 2021, 12:05:17 PM (3 years ago)
Author:
Carsten Clauß
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Public/ParaStationMPI

    v32 v33  
    441441The `psnam_structure` key specifies the memory layout as formed by the multiple regions of an MPI window.
    442442Currently, the following three different memory layouts are supported:
    443  * `psnam_structure_raw_and_flat`}
    444  * `psnam_structure_managed_contiguous`}
    445  * `psnam_structure_managed_distributed`}
     443 * `psnam_structure_raw_and_flat`
     444 * `psnam_structure_managed_contiguous`
     445 * `psnam_structure_managed_distributed`
    446446
    447447The chosen memory layout also decides whether and how the PSNAM layer stores further meta data in the NAM regions to allow a later recreation of the structure while reconnecting to a persistent RMA window by another MPI session.
     
    465465
    466466
     467==== Examples ====
     468
     469{{{
     470MPI_Info_create(&info);       
     471MPI_Info_set(info, "psnam_manifestation", "psnam_manifestation_libnam");
     472MPI_Info_set(info, "psnam_consistency", "psnam_consistency_volatile");
     473
     474// Allocate a "raw_and_flat" window:
     475MPI_Info_set(win, "psnam_structure", "psnam_structure_raw_and_flat");
     476MPI_Win_allocate(rank ? 0 : win_size, 1, info, comm, NULL, &win_flat);
     477
     478// Put some data into the "raw_and_flat" window:
     479MPI_Win_fence(0, win_flat);
     480if (rank == 0)
     481        MPI_Put(data_ptr, win_size, MPI_BYTE, 0 /*=target*/, 0 /*=offset*/, win_size, MPI_BYTE, win_flat);
     482MPI_Win_fence(0, win_flat);
     483
     484
     485// Allocate a "managed_distributed" window:
     486MPI_Info_set(win, "psnam_structure", "psnam_structure_ managed_distributed");
     487MPI_Win_allocate(my_region_size * sizeof(int), sizeof(int) , info, comm, NULL, &win_dist);
     488
     489// Put some data into the "managed_distributed" window:
     490MPI_Win_fence(0, win_dist);
     491MPI_Put(data_ptr, my_region_size, MPI_INT, my_rank, 0 /*=offset*/, my_region_size, MPI_INT, win_dist);
     492MPI_Win_fence(0, win_dist);
     493
     494}}}
     495
     496
     497=== Persistent MPI Windows ===
     498
     499==== General Semantics ====
     500
     501A central use-case for the NAM in DEEP-EST is the idea of facilitating workflows between different applications and/or application steps.
     502For doing so, the data once put into NAM memory shall later be re-usable by other MPI applications and/or sessions.
     503Of course, this requires that NAM regions--and hence also their related MPI windows--can somehow be denoted as "persistent" so that their content gets not be wiped when the window is freed.
     504In fact, this can be achieved by setting the above mentioned `psnam_consistency_persistent` MPI info key when calling `MPI_Win_allocate()`.
     505
     506==== Window Names ====
     507
     508If the creation of the persistent NAM window was successful, the related NAM regions become addressable as a joint entity by means of a logical name that is system-wide unique.
     509This window name can then in turn be retrieved by querying the info object attached to that window afterwards via the info key `psnam_window_name`.
     510If an MPI application wants to pass data via such a persistent window to a subsequent MPI application, it merely has to pass this window name somehow to its successor so that this other MPI session can then re-attach to the respective window.
     511The passing of this window name could, for example, be done via standard I/O, via command line arguments, or even via MPI-based name publishing.
     512As the knowledge about this string allows other MPI sessions to attach and to modify the data within the persistent window, it is the responsibility of the application programmer to ensure that data races are avoided—for example, by locally releasing the window via `MPI_Win_free()` before publishing the window name.
     513
     514
     515==== Example ====
     516
     517{{{
     518MPI_Info_create(&info);       
     519MPI_Info_set(info, "psnam_consistency", "psnam_consistency_persistent");
     520MPI_Win_allocate(sizeof(int) * ELEMENTS_PER_PROC, sizeof(int), info, comm, NULL, &win);
     521MPI_Info_free(&info);
     522
     523MPI_Win_get_info(win, &info);
     524MPI_Info_get(info, "psnam_window_name", INFO_VALUE_LEN, info_value, &flag);
     525if(flag) {              strcpy(window_name, info_value);
     526                printf("The window's name is: %s\n", window_name);
     527} else {                printf("No psnam window name found!\n");
     528                MPI_Abort(MPI_COMM_WORLD, -1);
     529}
     530
     531// Work on window...
     532
     533
     534MPI_Win_free(&win);
     535if(comm_rank == 0) {
     536                sprintf(service_name, "%s:my-peristent-psnam-window", argv[0]);
     537                MPI_Publish_name(service_name, MPI_INFO_NULL, window_name);
     538}
     539}}}