Fortran 2018 with Parallel Programming
eBook - ePub

Fortran 2018 with Parallel Programming

  1. 654 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Fortran 2018 with Parallel Programming

About this book

The programming language Fortran dates back to 1957 when a team of IBM engineers released the first Fortran Compiler. During the past 60 years, the language had been revised and updated several times to incorporate more features to enable writing clean and structured computer programs. The present version is Fortran 2018. Since the dawn of the computer era, there had been a constant demand for a "larger" and "faster" machine. To increase the speed there are three hurdles. The density of the active components on a VLSI chip cannot be increased indefinitely and with the increase of the density heat dissipation becomes a major problem. Finally, the speed of any signal cannot exceed the velocity of the light. However, by using several inexpensive processors in parallel coupled with specialized software and hardware, programmers can achieve computing speed similar to a supercomputer.

This book can be used to learn the modern Fortran from the beginning and the technique of developing parallel programs using Fortran. It is for anyone who wants to learn Fortran. Knowledge beyond high school mathematics is not required. There is not another book on the market yet which deals with Fortran 2018 as well as parallel programming.

FEATURES

  • Descriptions of majority of Fortran 2018 instructions
  • Numerical Model
  • String with Variable Length
  • IEEE Arithmetic and Exceptions
  • Dynamic Memory Management
  • Pointers
  • Bit handling
  • C-Fortran Interoperability
  • Object Oriented Programming
  • Parallel Programming using Coarray
  • Parallel Programming using OpenMP
  • Parallel Programming using Message Passing Interface (MPI)

THE AUTHOR

Dr Subrata Ray, is a retired Professor, Indian Association for the Cultivation of Science, Kolkata.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Fortran 2018 with Parallel Programming by Subrata Ray in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Engineering. We have over one million books available in our catalogue for you to explore.
1
Preliminaries
A computer is a machine that can perform basic arithmetic operations at a very high speed. It can take logical decisions and select alternative paths depending upon the program logic. It can communicate with the external world via its input/output devices. To get a job done, the computer needs to be instructed through a computer program. A computer program is a set of instructions through which one instructs a computer to perform a specific job. The computer’s processor understands only one language, called the machine language. The machine language is machine dependent and is difficult for humans to learn. To circumvent this difficulty, several artificial languages (sometimes called high-level languages) have been developed. These artificial languages are very easy to learn and are practically machine independent. However, this requires translation to the machine language of the particular machine. The translation is done by the computer itself through a system program called a compiler. The compiler, while translating, checks the grammar of the language; if the source program is free from grammatical errors, it generates the machine language version of the source program, called the object program for the machine, which is subsequently linked (using a system program called the linker) to various libraries of the system. The resultant code, called the executable code, is executed by the machine. As different machines use different machine languages, the compilers are naturally machine dependent. Therefore, that a particular machine can execute a program written in a high-level language implies that the compiler for that high-level language is available to the computer system.
Fortran—one such programming language—is the abbreviation of Formula translation. It is widely used in solving scientific and engineering problems that require a lot of numerical computation. In this book, Fortran stands for Fortran 2018, the current version of Fortran.
It must be mentioned at this point that no computer can directly execute any program written in Fortran or any other, so-called high-level, language like Fortran. The compiler for the corresponding language must be available to the computer so that the translated version of the program written in a high-level language may be executed by the computer. As this translation—Fortran to machine language of a particular machine—is transparent to the programmer, one may assume that the computer is executing the Fortran program.
The compiler generates an object program only when the source is free from grammatical errors. In case of any grammatical error being flagged by the compiler, the programmer has to go back to the source, make the necessary correction(s) to the source and recompile the source to get the object program. The object program will not be generated until all grammatical errors are removed from the source program.
A program, free from grammatical errors, may not give a correct result. The program must be free from logical errors. A logical error is an error in the program logic at the source level. For example, a particular program requires addition of two numbers, but the programmer, by mistake, has performed multiplication instead of addition. A runtime error may occur during the execution of the program. Suppose a program has to divide two numbers. The division process is valid so long as the second number (denominator) is not zero. Division by zero is not a valid arithmetic operation. This error will show up during the execution of the program should the denominator become zero. The program behaves normally so long as the denominator remains nonzero.
Therefore, to obtain a correct result from a program, the following three conditions must be satisfied:
• The program must be free from grammatical errors.
• The program must be free from logical errors.
• There should not be any runtime error.
In this book, we frequently use the term processor. According to the Fortran report, a processor is a combined object, consisting of software (compiler, operating system, etc.) and hardware, that converts a Fortran program into its machine language equivalent and executes the same.
1.1 Character Set
The programming language and its syntax are described by a set of characters. The character set that is available to a Fortran programmer consists of (a) all letters of the English alphabet, both uppercase (A–Z) and lowercase (a–z); (b) underscore character (_); (c) all digits (0–9); (d) several special characters, such as brackets, colon and full stop; and (e) several unprintable characters, such as tab, linefeed and newline characters.
Some characters may appear only within comments, character constants, input/output records and edit descriptors. The English letters, numerals and the underscore character are collectively called alphanumeric characters.
Normally, Fortran is case insensitive; that is, it does not distinguish between the uppercase and lowercase letters. There are, however, exceptions (character strings and input/output). In addition, specifiers like file names in open and inquire statements (Chapter 9) may make it necessary to distinguish between lowercase and uppercase letters. This is processor dependent and will be discussed at appropriate places in the text. Table 1.1 shows the list of special characters.
In this book, we consider only ASCII set of characters. ASCII, abbreviation of American Standard Code for Information Interchange, is an industry standard for electronic communication. The processor may also support other types of character sets.
TABLE...

Table of contents

  1. Cover
  2. Half Title
  3. Title Page
  4. Copyright Page
  5. Dedication
  6. Table of Contents
  7. Preface
  8. Acknowledgments
  9. Author
  10. 1. Preliminaries
  11. 2. Arithmetic, Relational and Logical Operators and Expressions
  12. 3. Branch and Loop Statements
  13. 4. Handling of Characters
  14. 5. Precision and Range
  15. 6. Array and Array-Handling Intrinsics
  16. 7. User Defined Data Type
  17. 8. Format Statement
  18. 9. Auxiliary Storage
  19. 10. Numerical Model
  20. 11. Library Functions
  21. 12. Subprograms
  22. 13. String with Variable Length
  23. 14. IEEE Floating Point Arithmetic and Exceptions
  24. 15. Dynamic Memory Management
  25. 16. Pointers
  26. 17. Bit Handling
  27. 18. C–Fortran Interoperability
  28. 19. Object-Oriented Programming
  29. 20. Parallel Programming Using Coarray
  30. 21. Parallel Programming Using OpenMP
  31. 22. Parallel Programming Using Message Passing Interface (MPI)
  32. Appendix A
  33. Appendix B
  34. Appendix C
  35. Appendix D
  36. Appendix E
  37. Appendix F
  38. Appendix G
  39. Appendix H
  40. Appendix I
  41. References
  42. Index