Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

blacs_gridmap

Maps available processes into BLACS process grid.

Syntax

call blacs_gridmap( icontxt, usermap, ldumap, nprow, npcol )

Input Parameters

icontxt

INTEGER. Integer handle indicating the system context to be used in creating the BLACS context. Call blacs_get to obtain a default system context.

usermap

INTEGER. Array, dimension (ldumap, npcol), indicating the process-to-grid mapping.

ldumap

INTEGER. Leading dimension of the 2D array usermap. ldumapnprow.

nprow

INTEGER. Indicates how many process rows the process grid should contain.

npcol

INTEGER. Indicates how many process columns the process grid should contain.

Output Parameters

icontxt

INTEGER. Integer handle to the created BLACS context.

Description

All BLACS codes must call this routine, or its sister routine blacs_gridinit. These routines take the available processes, and assign, or map, them into a BLACS process grid. In other words, they establish how the BLACS coordinate system maps into the native machine process numbering system. Each BLACS grid is contained in a context, so that it does not interfere with distributed operations that occur within other grids/contexts. These grid creation routines may be called repeatedly to define additional contexts/grids.

The creation of a grid requires input from all processes that are defined to be in this grid. Processes belonging to more than one grid have to agree on which grid formation will be serviced first, much like the globally blocking sum or broadcast.

These grid creation routines set up various internals for the BLACS, and one of them must be called before any calls are made to the non-initialization BLACS.

Note that these routines map already existing processes to a grid: the processes are not created dynamically. On most parallel machines, the processes are actual processors (hardware), and they are "created" when you run your executable. When using the PVM BLACS, if the virtual machine has not been set up yet, the routine blacs_setup should be used to create the virtual machine.

This routine allows the user to map processes to the process grid in an arbitrary manner. usermap(i,j) holds the process number of the process to be placed in {i, j} of the process grid. On most distributed systems, this process number is a machine defined number between 0 ... nprow-1. For PVM, these node numbers are the PVM TIDS (Task IDs). The blacs_gridmap routine is intended for an experienced user. The blacs_gridinit routine is much simpler. blacs_gridinit simply performs a gridmap where the first nprow * npcol processes are mapped into the current grid in a row-major natural ordering. If you are an experienced user, blacs_gridmap allows you to take advantage of your system's actual layout. That is, you can map nodes that are physically connected to be neighbors in the BLACS grid, etc. The blacs_gridmap routine also opens the way for multigridding: you can separate your nodes into arbitrary grids, join them together at some later date, and then re-split them into new grids. blacs_gridmap also provides the ability to make arbitrary grids or subgrids (for example, a "nearest neighbor" grid), which can greatly facilitate operations among processes that do not fall on a row or column of the main process grid.