SlideShare a Scribd company logo
1 of 18
Fortran
Jordan Martin
Steven Devine
Background
•Developed by IBM in the 1950s
•Designed for use in scientific and engineering
fields
•Originally written as FORTRAN
–Convention is caps up to FORTRAN77
–Title caps for Fortran 90 forward
Background
•Brainchild of John Backus as a more friendly
and useable alternative to assembly language
•Fortran’s compiler, released in 1957, was the
first optimizing compiler.
Hello World
program hello
print *, "Hello World!"
end program hello
Current Usage
•Scientific Community
•Engineers
•Super Computing
Readability
•Pros
–Formulas and functions are easily recognizable
–Strongly typed.
–Looping and control statements work in familiar
ways in later versions of Fortran, using do as the
primary key word.
Readability
•Cons
–Case Insensitive
–Whitespace insensitive
–Many built-in functions and types, lacks high
orthogonality
–GOTO
–Column major order for 2D arrays
Writeability
•Pros
–Case insensitive
–Whitespace insensitive
–Powerful functions and algebraic evaluation
Writeability
•Cons
–GOTO is the basis for control structure in older
versions
–Names restricted to 6 characters
–Variables are in scope only for subroutines
Reliability
- The FORTRAN language has not specified evaluation order for expressions
- Compilers are free to evaluate each line as they please
PROGRAM ARGORD
INTEGER I, F1, F2, F3, F4
EXTERNAL F1, F2, F3, F4
WRITE (*,*) 'Evaluation order: '
I = F1(I) + F2(I) + F3(I) + F4(I)
END
Short Circuit Evaluation
-The compiler is free to evaluate boolean expressions in any order,
making short-circuit evaluation unreliable
-This code will either work as intended or crash, depending on the
compiler that was used
INTEGER I
REAL ARRAY(100)
...........................
IF ((I .GE. 1) .AND. (I .LE. 100) .AND. ARRAY(I) .GT. 0) THEN
WRITE (*,*) 'Array element is positive '
ENDIF
Strong Type Checking
- FORTRAN uses static (compile time) type checking
-At run time all variables in memory are bit strings without
data type information
-No type checking is done at run time, variables are just
accessed by the starting address of variable
Portability
-FORTRAN revisions are almost completely backwards-compatible and
have only removed obsolete instructions
-FORTRAN 90 introduced KIND type parameters, which are
variables can be declared with arbitrarily specified ranges and
precisions, eliminating platform-based data type issues
-An example of the KIND type:
real (kind=kind(0.0)) r
-kind(0.0) defaults to the processor's built in size for a real,
or the programmer can specify the number of digits
FORTRAN Exception Handling
- In FORTRAN, pointers cannot overlap in memory
- This is done to allow optimization for greater speed in numerical calculations
- All arrays passed to subroutines are guaranteed not to be aliased, so array
elements can be stored in registers for the duration of the subroutine
void transform (float *output, float * input, float * matrix, int n)
{
int i;
for (i=0; i<n; i++)
{
float x = input[i*2+0];
float y = input[i*2+1];
output[i*2+0] = matrix[0] * x + matrix[1] * y;
output[i*2+1] = matrix[2] * x + matrix[3] * y;
}
}
Cost
- Time spent learning a dying niche language
-There are free compilers available that vary in quality and output.
The expensive compilers offer tools and integration into modern programs
like .NET
-Legacy FORTRAN code can be difficult to read and refactor due to age.
Older FORTRAN programs may not have obeyed any recognizable
methodology. Also, GOTO statements.
Modern Uses
- A majority of supercomputers run programs written in FORTRAN
-Monster.com lists about fifty jobs that require FORTRAN experience.
Twenty of those fifty also require security clearance.
-FORTRAN is still the fastest when it comes to computationally-
intensive mathematical models, such as weather prediction,
computational science, air and fluid modeling, etc.
Parting Thoughts
-FORTRAN isn't unique. Everything FORTRAN does can also be done
by more powerful languages, starting with C
- FORTRAN is fast with mathematics, but Moore's Law is faster
-FORTRAN was an important step in programming languages,
but it now only caters to the niche market of High Performance Computing.
Sources
http://www.ibiblio.org/pub/languages/fortran/ch1-8.html
http://www.lahey.com/lookat90.htm
http://chronicle.com/blogs/wiredcampus/supercomputers-often-run-outdated-software/818
http://en.wikipedia.org/wiki/Row-major_order
http://fortran.com/

More Related Content

What's hot

File Management in C
File Management in CFile Management in C
File Management in CPaurav Shah
 
Huffman Tree And Its Application
Huffman Tree And Its ApplicationHuffman Tree And Its Application
Huffman Tree And Its ApplicationPapu Kumar
 
MIPS Assembly Language I
MIPS Assembly Language IMIPS Assembly Language I
MIPS Assembly Language ILiEdo
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++Neeru Mittal
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language Mohamed Loey
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operationsSanjeev Patel
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operationsNitesh Bichwani
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfixSenthil Kumar
 
Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Tayeen Ahmed
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer languageSanjeev Patel
 
virtual function
virtual functionvirtual function
virtual functionVENNILAV6
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes Seshu Chakravarthy
 
Problem Solving and Python Programming
Problem Solving and Python ProgrammingProblem Solving and Python Programming
Problem Solving and Python ProgrammingMahaJeya
 

What's hot (20)

Built in function
Built in functionBuilt in function
Built in function
 
File Management in C
File Management in CFile Management in C
File Management in C
 
Huffman Tree And Its Application
Huffman Tree And Its ApplicationHuffman Tree And Its Application
Huffman Tree And Its Application
 
MIPS Assembly Language I
MIPS Assembly Language IMIPS Assembly Language I
MIPS Assembly Language I
 
Microprogrammed Control Unit
Microprogrammed Control UnitMicroprogrammed Control Unit
Microprogrammed Control Unit
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
 
Advanced C
Advanced C Advanced C
Advanced C
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operations
 
C++ How to program
C++ How to programC++ How to program
C++ How to program
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operations
 
CPU Non-Preemptive Scheduling
CPU Non-Preemptive Scheduling CPU Non-Preemptive Scheduling
CPU Non-Preemptive Scheduling
 
My lecture infix-to-postfix
My lecture infix-to-postfixMy lecture infix-to-postfix
My lecture infix-to-postfix
 
Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
 
virtual function
virtual functionvirtual function
virtual function
 
File handling in c
File handling in cFile handling in c
File handling in c
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes
 
Problem Solving and Python Programming
Problem Solving and Python ProgrammingProblem Solving and Python Programming
Problem Solving and Python Programming
 

Similar to Fortran: A Legacy Language for Scientific Computing

Lecture1_introduction to python.pptx
Lecture1_introduction to python.pptxLecture1_introduction to python.pptx
Lecture1_introduction to python.pptxMohammedAlYemeni1
 
Uni texus austin
Uni texus austinUni texus austin
Uni texus austinN/A
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++Manzoor ALam
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial javaTpoint s
 
JVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, WixJVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, WixCodemotion Tel Aviv
 
First compailer written
First compailer writtenFirst compailer written
First compailer writtenmicrowoorkers
 
Fortran introduction
Fortran introductionFortran introduction
Fortran introductionsanthosh833
 
Python programming
Python programmingPython programming
Python programmingsaroja20
 
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON
 
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...Marjuk Ahmed Siddiki
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming languageKumar Gaurav
 
Recursion & Erlang, FunctionalConf 14, Bangalore
Recursion & Erlang, FunctionalConf 14, BangaloreRecursion & Erlang, FunctionalConf 14, Bangalore
Recursion & Erlang, FunctionalConf 14, BangaloreBhasker Kode
 

Similar to Fortran: A Legacy Language for Scientific Computing (20)

intro2fortran.pptx
intro2fortran.pptxintro2fortran.pptx
intro2fortran.pptx
 
Lecture1_introduction to python.pptx
Lecture1_introduction to python.pptxLecture1_introduction to python.pptx
Lecture1_introduction to python.pptx
 
Uni texus austin
Uni texus austinUni texus austin
Uni texus austin
 
Intr fortran90
Intr fortran90Intr fortran90
Intr fortran90
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
A Peek into TFRT
A Peek into TFRTA Peek into TFRT
A Peek into TFRT
 
Fortran 95
Fortran 95Fortran 95
Fortran 95
 
JVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, WixJVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, Wix
 
Usp notes
Usp notesUsp notes
Usp notes
 
First compailer written
First compailer writtenFirst compailer written
First compailer written
 
Fortran introduction
Fortran introductionFortran introduction
Fortran introduction
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
 
Python programming
Python programmingPython programming
Python programming
 
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
 
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming language
 
gayathri.p.pptx
gayathri.p.pptxgayathri.p.pptx
gayathri.p.pptx
 
Recursion & Erlang, FunctionalConf 14, Bangalore
Recursion & Erlang, FunctionalConf 14, BangaloreRecursion & Erlang, FunctionalConf 14, Bangalore
Recursion & Erlang, FunctionalConf 14, Bangalore
 

More from Hans Zimermann

Campo eletrico lei_de_gauss-fsc1075
Campo eletrico lei_de_gauss-fsc1075Campo eletrico lei_de_gauss-fsc1075
Campo eletrico lei_de_gauss-fsc1075Hans Zimermann
 
Fortran apresentacao-2018-01
Fortran apresentacao-2018-01Fortran apresentacao-2018-01
Fortran apresentacao-2018-01Hans Zimermann
 
Galvanometro e multimetro
Galvanometro e multimetroGalvanometro e multimetro
Galvanometro e multimetroHans Zimermann
 
Apresentação1 2016-01
Apresentação1 2016-01Apresentação1 2016-01
Apresentação1 2016-01Hans Zimermann
 
ZIMERMANN, HANS ROGERIO
ZIMERMANN, HANS ROGERIOZIMERMANN, HANS ROGERIO
ZIMERMANN, HANS ROGERIOHans Zimermann
 

More from Hans Zimermann (7)

Campo eletrico lei_de_gauss-fsc1075
Campo eletrico lei_de_gauss-fsc1075Campo eletrico lei_de_gauss-fsc1075
Campo eletrico lei_de_gauss-fsc1075
 
Fortran apresentacao-2018-01
Fortran apresentacao-2018-01Fortran apresentacao-2018-01
Fortran apresentacao-2018-01
 
Galvanometro e multimetro
Galvanometro e multimetroGalvanometro e multimetro
Galvanometro e multimetro
 
NBR-IEC-60479-1
NBR-IEC-60479-1NBR-IEC-60479-1
NBR-IEC-60479-1
 
Apresentação1 2016-01
Apresentação1 2016-01Apresentação1 2016-01
Apresentação1 2016-01
 
Dissertacao-Hans
Dissertacao-HansDissertacao-Hans
Dissertacao-Hans
 
ZIMERMANN, HANS ROGERIO
ZIMERMANN, HANS ROGERIOZIMERMANN, HANS ROGERIO
ZIMERMANN, HANS ROGERIO
 

Recently uploaded

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 

Recently uploaded (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 

Fortran: A Legacy Language for Scientific Computing

  • 2. Background •Developed by IBM in the 1950s •Designed for use in scientific and engineering fields •Originally written as FORTRAN –Convention is caps up to FORTRAN77 –Title caps for Fortran 90 forward
  • 3. Background •Brainchild of John Backus as a more friendly and useable alternative to assembly language •Fortran’s compiler, released in 1957, was the first optimizing compiler.
  • 4. Hello World program hello print *, "Hello World!" end program hello
  • 6. Readability •Pros –Formulas and functions are easily recognizable –Strongly typed. –Looping and control statements work in familiar ways in later versions of Fortran, using do as the primary key word.
  • 7. Readability •Cons –Case Insensitive –Whitespace insensitive –Many built-in functions and types, lacks high orthogonality –GOTO –Column major order for 2D arrays
  • 9. Writeability •Cons –GOTO is the basis for control structure in older versions –Names restricted to 6 characters –Variables are in scope only for subroutines
  • 10. Reliability - The FORTRAN language has not specified evaluation order for expressions - Compilers are free to evaluate each line as they please PROGRAM ARGORD INTEGER I, F1, F2, F3, F4 EXTERNAL F1, F2, F3, F4 WRITE (*,*) 'Evaluation order: ' I = F1(I) + F2(I) + F3(I) + F4(I) END
  • 11. Short Circuit Evaluation -The compiler is free to evaluate boolean expressions in any order, making short-circuit evaluation unreliable -This code will either work as intended or crash, depending on the compiler that was used INTEGER I REAL ARRAY(100) ........................... IF ((I .GE. 1) .AND. (I .LE. 100) .AND. ARRAY(I) .GT. 0) THEN WRITE (*,*) 'Array element is positive ' ENDIF
  • 12. Strong Type Checking - FORTRAN uses static (compile time) type checking -At run time all variables in memory are bit strings without data type information -No type checking is done at run time, variables are just accessed by the starting address of variable
  • 13. Portability -FORTRAN revisions are almost completely backwards-compatible and have only removed obsolete instructions -FORTRAN 90 introduced KIND type parameters, which are variables can be declared with arbitrarily specified ranges and precisions, eliminating platform-based data type issues -An example of the KIND type: real (kind=kind(0.0)) r -kind(0.0) defaults to the processor's built in size for a real, or the programmer can specify the number of digits
  • 14. FORTRAN Exception Handling - In FORTRAN, pointers cannot overlap in memory - This is done to allow optimization for greater speed in numerical calculations - All arrays passed to subroutines are guaranteed not to be aliased, so array elements can be stored in registers for the duration of the subroutine void transform (float *output, float * input, float * matrix, int n) { int i; for (i=0; i<n; i++) { float x = input[i*2+0]; float y = input[i*2+1]; output[i*2+0] = matrix[0] * x + matrix[1] * y; output[i*2+1] = matrix[2] * x + matrix[3] * y; } }
  • 15. Cost - Time spent learning a dying niche language -There are free compilers available that vary in quality and output. The expensive compilers offer tools and integration into modern programs like .NET -Legacy FORTRAN code can be difficult to read and refactor due to age. Older FORTRAN programs may not have obeyed any recognizable methodology. Also, GOTO statements.
  • 16. Modern Uses - A majority of supercomputers run programs written in FORTRAN -Monster.com lists about fifty jobs that require FORTRAN experience. Twenty of those fifty also require security clearance. -FORTRAN is still the fastest when it comes to computationally- intensive mathematical models, such as weather prediction, computational science, air and fluid modeling, etc.
  • 17. Parting Thoughts -FORTRAN isn't unique. Everything FORTRAN does can also be done by more powerful languages, starting with C - FORTRAN is fast with mathematics, but Moore's Law is faster -FORTRAN was an important step in programming languages, but it now only caters to the niche market of High Performance Computing.