|
DIY
3.0
data-parallel out-of-core C++ library
|
The following is an example of the steps needed to initialize DIY.
The block is the basic unit of everything (data, decomposition, communication) in DIY. Use it to define your data model and any state associated with the data that will be needed to accompany the data throughout its lifetime. In addition to the data in the block, it should define functions to create and destroy the block that DIY can call. If the blocks are intended to be moved in and out of core, then the block must also define save and load functions.
diy::Master owns and manages the blocks. To set up a Master object, first define the MPI communicator and the file storage object (if blocks will be moved in and out of core), which you pass to the Master constructor. The Master manages loading/saving blocks, executing their callback functions, and exchanging data between them.
Some of the arguments to the constructor are optional. If all blocks are to remain in memory, there is a shorter form of the Master constructor that can be used, since there is no need to specify most of the arguments because they relate to block loading/unloading.
diy::Assigner is an auxiliary object that determines what blocks lives on what MPI process. Blocks can be assigned to processes contiguously or in round-robin fashion:
Any custom decomposition can be formed by assigning links (communication neighborhoods of blocks) manually. However, for a regular grid of blocks, DIY provides a regular decomposition of blocks with either continuous (floating-point extents that share common boundaries) or discrete (integer extents that may or may not overlap) bounds.
RegularDecomposer helps decompose a domain into a regular grid of blocks. It's initialized with the dimension of the domain, its extents, and the number of blocks used in the decomposition.
Its member function decompose performs the actual decomposition. Besides the local MPI rank and an instance of Assigner, it takes a callback responsible for creating the block and adding it to a Master. In C++11, it's convenient to use a lambda function for this purpose.
A shorter form is provided, if you only want to add the blocks to Master, without any additional processing.
Here is one version of each of the above options combined into a complete program. This example uses the short form of blocks:
Below is one more complete example, using a lambda function to initialize the block:
diy::Master API has a separate documentation page. The RegularDecomposer is documented in the Decomposition page.
1.8.6