Co-array Fortran

Co-array Fortran
Coarray Fortran
Paradigmen: prozedural, imperativ, strukturiert, objektorientiert, parallel
Entwickler: Robert Numrich and John Reid
Aktuelle Version: Fortran 2008 (ISO/IEC 1539-1:2010)  ()
wichtige Implementierungen: Cray, g95, gfortran (teilweise), ifort
Einflüsse: Fortran

Co-array Fortran (CAF), ehemals F--, ist eine Erweiterung von Fortran 95/2003 zur parallelen Datenverarbeitung, die von Robert Numrich und John Reid in den 1990ern entwickelt wurde. Der Fortran-Standard unterstützt Coarrays (jetzt ohne Bindestrich) seit Fortran 2008 (ISO/IEC 1539-1:2010), wie es auf dem May-2005-Treffen des ISO Fortran Komitees beschlossen wurde; die Syntax im Fortran 2008 Standard unterscheidet sich leicht vom ursprünglichen CAF-Vorschlag.

Ein Coarray-Fortran-Programm wird so interpretiert, als ob es n-mal repliziert würde und alle Kopien asynchron ausgeführt würden. Jede Kopie hat ihre eigenen Datenobjekte und wird Bild ("image") genannt. Die Feld-Syntax von Fortran wird erweitert um rechteckigen Klammern, die den Bildindex enthalten, mit dem man so auf die Daten eines anderen Bildes (Prozesses) zugreifen kann.

Die Co-array-Fortran-Erweiterung gibt es schon seit den 1990ern und sie wird in einigen Fortrancompilern wie zum Beispiel dem von Cray (seit Version 3.1) unterstützt. Seitdem Coarrays Teil von Fortran 2008 sind, nimmt die Anzahl der Implementation zu; der erste Open Source-Compiler, der Coarrays gemäß dem Fortran-2008-Standard unterstützt ist G95.

Beispiel

program Hallo_Welt
  implicit none
  integer :: i  ! Lokale Variable
  character(len=20) :: name[*] ! skalares Coarray
  ! Hinweis: "name" ist die lokale Variable wohingegen "name[<index>]"
  ! auf die Variable eines anderen Prozesses (Image) zugreift
 
  ! Kommuniziere mit dem Nutzer auf Image 1
  if (this_image() == 1) then
    write(*,'(a)',advance='no') 'Geben Sie Ihren Namen ein: '
    read(*,'(a)') name
 
    ! Verteile die Information an die anderen Prozesse
    do i = 2, num_images()
      name[i] = name
    end do
  end if
 
  sync all ! Barriere damit die Daten wirklich da sind
 
  ! Ein-/Ausgabe von allen Prozessen
  write(*,'(3a,i0)') 'Hallo ',trim(name),' von Image ', this_image()
end program Hallo_Welt

Siehe auch

Referenzen


Wikimedia Foundation.

Игры ⚽ Поможем написать реферат

Schlagen Sie auch in anderen Wörterbüchern nach:

  • Co-array Fortran — Coarray Fortran Paradigm(s) multi paradigm: parallel, message passing, imperative (procedural, object oriented), structured Designed by Robert Numrich and John Reid Developer PL22.3 Fortran Committee Stable release …   Wikipedia

  • Fortran — Infobox programming language name = Fortran caption = The Fortran Automatic Coding System for the IBM 704 (October 15, 1956), the first Programmer s Reference Manual for Fortran paradigm = multi paradigm: procedural, imperative, structured,… …   Wikipedia

  • Fortran language features — This is a comprehensive overview of features of the Fortran 95 language, the version supported by almost all existing Fortran compilers. Old features that have been superseded by new ones are not described few of those historic features are used… …   Wikipedia

  • Array slicing — In computer programming, array slicing is an operation that extracts certain elements from an array and packages them as another array, possibly with different number of indices (or dimensions) and different index ranges. Two common examples are… …   Wikipedia

  • Array data type — Not to be confused with Array data structure. In computer science, an array type is a data type that is meant to describe a collection of elements (values or variables), each selected by one or more indices that can be computed at run time by the …   Wikipedia

  • Array programming — In computer science, array programming languages (also known as vector or multidimensional languages) generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays.Array programming primitives… …   Wikipedia

  • Array — In computer science an array [Paul E. Black, array , in Dictionary of Algorithms and Data Structures , Paul E. Black, ed., U.S. National Institute of Standards and Technology. 26 August 2008 (accessed 10 September 2008).… …   Wikipedia

  • Array Theory — From [ftp://ftp.nial.com/nial.com/Papers/Papers.zip Nial Papers] : Array Theory is primarily a theory about the definition and manipulation of array data objects. Every data object in the theory is an array, even numbers and characters, which are …   Wikipedia

  • Comparison of programming languages (array) — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • ICL Distributed Array Processor — The Distributed Array Processor (DAP) produced by International Computers Limited (ICL) was the world s first commercial massively parallel computer. The original paper study was complete in 1972 and building of the prototype began in 1974. The… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”