BLACS

De Wiki de Calcul Québec
Aller à : Navigation, rechercher
Cette page est une traduction de la page BLACS et la traduction est complétée à 100 % et à jour.

Autres langues :anglais 100% • ‎français 100%

Sommaire

Description

BLACS (Basic Linear Algebra Communication Subprograms) is a library used to distribute dense matrices and communicate their elements between processes. Distributing is done with a 2D grid. BLACS is built using MPI, and can therefore be used on distributed memory systems with InfiniBand or Ethernet.

Very few direct calls to BLACS are usually required. This library is however used by ScaLAPACK and may be required by PARPACK depending on how it was installed.

Documentation and a reference version of this library are available online on the Netlib web site.

Available Implementations

Intel Math Kernel Library (MKL)

The Math Kernel Library contains a complete version of BLACS.

Example

Here is an example written in the Fortran 90 programming language illustrating the communication of a part of a matrix distributed on two cores using BLACS.

File : ex_blacs.f90
! communicate: general matrix
program ex_blacs
  ! creat 2 grids: 2x1: (0,1), (1,2)
  implicit none
  include "mpif.h"
 
	INTEGER		:: iproc, nprocs, info
 
	INTEGER		:: nprow, npcol
	INTEGER		:: icntxt
	INTEGER		:: myrow, mycol
 
	integer	:: i, rdest, cdest
!--------------------------------------
	call blacs_pinfo(iproc, nprocs)
		NPCOL = INT( sqrt( float(nprocs) ) )
		NPROW = nprocs / NPCOL
 
	call blacs_get(0, 0, icntxt)
 
	CALL blacs_gridinit( icntxt, 'COL', NPROW, NPCOL )
 
	call blacs_gridinfo(icntxt, nprow, npcol, myrow, mycol)  
	write(6,'(A,3I3)') 'iproc,myrow,mycol===',iproc,myrow,mycol
 
	do i = 0, nprocs-1
		CALL blacs_pcoord( icntxt, i, RDEST, CDEST )
		if( iproc==0 ) print*,'iproc(',i,')==',RDEST, CDEST
	enddo
 
end program


To compile this example using the Math Kernel Library, you need to use a command like this:

[nom@serveur $] mpif90 ex_blacs.f90 -lmkl_blacs_openmpi_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm


Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Ressources de Calcul Québec
Outils
Partager