Atjaunināt sīkdatņu piekrišanu

E-grāmata: Modern Fortran: Building efficient parallel applications

4.36/5 (22 ratings by Goodreads)
  • Formāts: 416 pages
  • Izdošanas datums: 07-Oct-2020
  • Izdevniecība: Manning Publications
  • Valoda: eng
  • ISBN-13: 9781638350057
Citas grāmatas par šo tēmu:
  • Formāts - EPUB+DRM
  • Cena: 49,74 €*
  • * ši ir gala cena, t.i., netiek piemērotas nekādas papildus atlaides
  • Ielikt grozā
  • Pievienot vēlmju sarakstam
  • Šī e-grāmata paredzēta tikai personīgai lietošanai. E-grāmatas nav iespējams atgriezt un nauda par iegādātajām e-grāmatām netiek atmaksāta.
  • Formāts: 416 pages
  • Izdošanas datums: 07-Oct-2020
  • Izdevniecība: Manning Publications
  • Valoda: eng
  • ISBN-13: 9781638350057
Citas grāmatas par šo tēmu:

DRM restrictions

  • Kopēšana (kopēt/ievietot):

    nav atļauts

  • Drukāšana:

    nav atļauts

  • Lietošana:

    Digitālo tiesību pārvaldība (Digital Rights Management (DRM))
    Izdevējs ir piegādājis šo grāmatu šifrētā veidā, kas nozīmē, ka jums ir jāinstalē bezmaksas programmatūra, lai to atbloķētu un lasītu. Lai lasītu šo e-grāmatu, jums ir jāizveido Adobe ID. Vairāk informācijas šeit. E-grāmatu var lasīt un lejupielādēt līdz 6 ierīcēm (vienam lietotājam ar vienu un to pašu Adobe ID).

    Nepieciešamā programmatūra
    Lai lasītu šo e-grāmatu mobilajā ierīcē (tālrunī vai planšetdatorā), jums būs jāinstalē šī bezmaksas lietotne: PocketBook Reader (iOS / Android)

    Lai lejupielādētu un lasītu šo e-grāmatu datorā vai Mac datorā, jums ir nepieciešamid Adobe Digital Editions (šī ir bezmaksas lietotne, kas īpaši izstrādāta e-grāmatām. Tā nav tas pats, kas Adobe Reader, kas, iespējams, jau ir jūsu datorā.)

    Jūs nevarat lasīt šo e-grāmatu, izmantojot Amazon Kindle.

Modern Fortran is natively parallel, so it's uniquely suited for efficiently handling problems like complex simulations, long-range predictions, and ultra-precise designs. If you're working on tasks where speed, accuracy, and efficiency matter, it's time to discover&;or re-discover&;Fortran.

Modern Fortran: Building Efficient Parallel Applications teaches you how to develop fast, efficient parallel applications with Fortran, an amazingly powerful and flexible programming language that forms the foundation of high performance computing for research, science and industry.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.



Modern Fortran teaches you to develop fast, efficient parallel applications using twenty-first-century Fortran. In this guide, you&;ll dive into Fortran by creating fun apps, including a tsunami simulator and a stock price analyzer. Filled with real-world use cases, insightful illustrations, and hands-on exercises, Modern Fortran helps you see this classic language in a whole new light.

Summary
Using Fortran, early and accurate forecasts for hurricanes and other major storms have saved thousands of lives. Better designs for ships, planes, and automobiles have made travel safer, more efficient, and less expensive than ever before. Using Fortran, low-level machine learning and deep learning libraries provide incredibly easy, fast, and insightful analysis of massive data. Fortran is an amazingly powerful and flexible programming language that forms the foundation of high performance computing for research, science, and industry. And it's come a long, long way since starting life on IBM mainframes in 1956. Modern Fortran is natively parallel, so it's uniquely suited for efficiently handling problems like complex simulations, long-range predictions, and ultra-precise designs. If you're working on tasks where speed, accuracy, and efficiency matter, it's time to discover&;or re-discover&;Fortran..

About the technology
For over 60 years Fortran has been powering mission-critical scientific applications, and it isn't slowing down yet! Rock-solid reliability and new support for parallel programming make Fortran an essential language for next-generation high-performance computing. Simply put, the future is in parallel, and Fortran is already there.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the book
Modern Fortran teaches you to develop fast, efficient parallel applications using twenty-first-century Fortran. In this guide, you'll dive into Fortran by creating fun apps, including a tsunami simulator and a stock price analyzer. Filled with real-world use cases, insightful illustrations, and hands-on exercises, Modern Fortran helps you see this classic language in a whole new light.

What's inside

    Fortran's place in the modern world
    Working with variables, arrays, and functions
    Module development
    Parallelism with coarrays, teams, and events
    Interoperating Fortran with C

About the reader
For developers and computational scientists. No experience with Fortran required.

About the author
Milan Curcic is a meteorologist, oceanographer, and author of several general-purpose Fortran libraries and applications.

Table of Contents

PART 1 - GETTING STARTED WITH MODERN FORTRAN

1 Introducing Fortran

2 Getting started: Minimal working app

PART 2 - CORE ELEMENTS OF FORTRAN

3 Writing reusable code with functions and subroutines

4 Organizing your Fortran code using modules

5 Analyzing time series data with arrays

6 Reading, writing, and formatting your data

PART 3 - ADVANCED FORTRAN USE

7 Going parallel with Fortan coarrays

8 Working with abstract data using derived types

9 Generic procedures and operators for any data type

10 User-defined operators for derived types

PART 4 - THE FINAL STRETCH

11 Interoperability with C: Exposing your app to the web

12 Advanced parallelism with teams, events, and collectives
Foreword xi
Preface xiii
Acknowledgments xiv
About this book xvi
About the author xxii
About the cover illustration xxiii
Part 1 Getting started with Modern Fortran
1(54)
1 Introducing Fortran
3(23)
1.1 What is Fortran?
4(2)
1.2 Fortran features
6(2)
1.3 Why learn Fortran?
8(2)
1.4 Advantages and disadvantages
10(2)
Side-by-side comparison with Python
10(2)
1.5 Parallel Fortran, illustrated
12(1)
1.6 What will you learn in this book?
13(1)
1.7 Think parallel!
14(8)
Copying an array from one processor to another
17(5)
1.8 Running example: A parallel tsunami simulator
22(3)
Why tsunami simulator?
22(1)
Shallow water equations
23(1)
What we want our app to do
24(1)
1.9 Further reading
25(1)
2 Getting started: Minimal working app
26(29)
2.1 Compiling and running your first program
27(1)
2.2 Simulating the motion of an object
28(3)
What should our app do?
29(1)
What is advection?
30(1)
2.3 Implementing the minimal working app
31(20)
Implementation strategy
32(1)
Defining the main program
33(1)
Declaring and initializing variables
34(1)
Numeric data types
35(2)
Declaring the data to use in our app
37(3)
Branching with an if block
40(2)
Using a do loop to iterate
42(2)
Setting the initial water height values
44(1)
Predicting the movement of the object
45(2)
Printing results to the screen
47(1)
Putting it all together
47(4)
2.4 Going forward with the tsunami simulator
51(1)
2.5 Answer key
52(1)
Exercise: Cold front propagation
52(1)
2.6 New Fortran elements, at a glance
52(1)
2.7 Further reading
52(3)
Part 2 Core elements of Fortran
55(116)
3 Writing reusable code with junctions and subroutines
57(28)
3.1 Toward higher app complexity
58(7)
Refactoring the tsunami simulator
58(3)
Revisiting the cold front problem
61(2)
An overview of Fortran program units
63(2)
3.2 Don't repeat yourself, use procedures
65(7)
Your first function
65(5)
Expressing finite difference as a function in the tsunami simulator
70(2)
3.3 Modifying program state with subroutines
72(4)
Defining and calling a subroutine
72(2)
When do you use a subroutine over a function?
74(1)
Initializing water height in the tsunami simulator
75(1)
3.4 Writing pure procedures to avoid side effects
76(1)
What is a pure procedure?
76(1)
Some restrictions on pure procedures
77(1)
Why are pure functions important'?
77(1)
3.5 Writing procedures that operate on both scalars and arrays
77(2)
3.6 Procedures with optional arguments
79(2)
3.7 Tsunami simulator: Putting it all together
81(1)
3.8 Answer key
82(1)
Exercise 1 Modifying state with a subroutine
82(1)
Exercise 2 Writing an elemental function that operates on both scalars and arrays
83(1)
3.9 New Fortran elements, at a glance
83(1)
3.10 Further reading
84(1)
4 Organizing your Fortran code using modules
85(25)
4.1 Accessing a module
86(5)
Getting compiler version and options
86(3)
Using portable data types
89(2)
4.2 Creating your first module
91(8)
The structure of a custom module
92(1)
Defining a module
93(2)
Compiling Fortran modules
95(2)
Controlling access to variables and procedures
97(1)
Putting it all together in the tsunami simulator
98(1)
4.3 Toward realistic wave simulations
99(8)
A brief look at the physics
101(1)
Updating the finite difference calculation
102(2)
Renaming imported entities to avoid name conflict
104(1)
The complete code
105(2)
4.4 Answer key
107(1)
Exercise 1 Using portable type kinds in the tsunami simulator
107(1)
Exercise 2 Defining the set_gaussian subroutine in a module
107(1)
4.5 New Fortran elements, at a glance
108(1)
4.6 Further reading
108(2)
5 Analyzing time series data with arrays
110(33)
5.1 Analyzing stock prices with Fortran arrays
111(3)
Objectives for this exercise
111(1)
About the data
112(2)
Getting the data and code
114(1)
5.2 Finding the best and worst performing stocks
114(18)
Declaring arrays
116(2)
Array constructors
118(3)
Reading stock data from files
121(1)
Allocating arrays of a certain size or range
122(1)
Allocating an array from another array
123(1)
Automatic allocation on assignment
123(1)
Cleaning up after use
124(2)
Checking for allocation status
126(1)
Catching allocation and deallocation errors
126(1)
Implementing the CSV reader subroutine
127(2)
Indexing and slicing arrays
129(3)
5.3 Identifying risky stocks
132(3)
5.4 Finding good times to buy and sell
135(4)
5.5 Answer key
139(2)
Exercise 1 Convenience (de)allocator subroutines
139(1)
Exercise 2 Reversing an array
140(1)
Exercise 3 Calculating moving average and standard deviation
140(1)
5.6 New Fortran elements, at a glance
141(1)
5.7 Further reading
141(2)
6 Reading, uniting, and formatting your data
143(28)
6.1 Your first I/O: Input from the keyboard and output to the screen
144(7)
The simplest I/O
144(3)
Reading and uniting multiple variables at once
147(1)
Standard input, output, and error
148(3)
6.2 Formatting numbers and text
151(6)
Designing the aircraft dashboard
151(1)
Formatting strings, broken down
152(5)
Format statements in legacy Fortran code
157(1)
6.3 Writing to files on disk: A minimal note-taking app
157(11)
Opening a file and writing to it
158(1)
Opening a file
159(2)
Writing to a file
161(1)
Appending to a file
162(1)
Opening files in read-only or write-only mode
163(1)
Checking whether a file exists
164(3)
Error handling and closing the file
167(1)
6.4 Answer key
168(1)
Exercise: Redirect stdout and stderr to files
168(1)
6.5 New Fortran elements, at a glance
169(2)
Part 3 Advanced Fortran use
171(120)
7 Going parallel with Fortran coarrays
173(29)
7.1 Why write parallel programs?
174(1)
7.2 Processing real-world weather buoy data
175(6)
About the data
176(2)
Getting the data and code
178(1)
Objectives
178(1)
Serial implementation of the program
179(2)
7.3 Parallel processing with images and coarrays
181(6)
Fortran images
182(1)
Getting information about the images
183(1)
Telling images what to do
184(2)
Gathering all data to a single image
186(1)
7.4 Coarrays and synchronization, explained
187(5)
Declaring coarrays
188(1)
Allocating dynamic coarrays
188(1)
Sending and receiving data
189(2)
Controlling the order of image execution
191(1)
7.5 Toward the parallel tsunami simulator
192(7)
Implementation strategy
192(2)
Finding the indices of neighbor images
194(1)
Allocating the coarrays
195(1)
The main time loop
196(3)
7.6 Answer key
199(2)
Exercise 1 Finding the array subranges on each image
199(1)
Exercise 2 Writing a function that returns the indices of neighbor images
200(1)
7.7 New Fortran elements, at a glance
201(1)
7.8 Further reading
201(1)
8 Working with abstract data using derived types
202(34)
8.1 Recasting the tsunami simulator with derived types
203(3)
8.2 Defining, declaring, and initializing derived types
206(14)
Defining a derived type
209(1)
Instantiating a derived type
210(2)
Accessing derived type components
212(1)
Positional vs. keyword arguments in derived type constructors
212(2)
Providing default values for derived type components
214(1)
Writing a custom type constructor
215(3)
Custom type constructor for the Field type
218(2)
8.3 Binding procedures to a derived type
220(4)
Your first type-bound method
220(1)
Type-bound methods for the Field type
221(1)
Controlling access to type components and methods
222(2)
Bringing it all together
224(1)
8.4 Extending tsunami to two dimensions
224(7)
Going from 1-D to 2-D arrays
225(1)
Updating the equation set
226(1)
Finite differences in x and y
226(2)
Passing a class instance to diffx and diffy functions
228(1)
Derived type implementation of the tsunami solver
229(2)
8.5 Answer key
231(3)
Exercise 1 Working with private components
231(2)
Exercise 2 Invoking a type-bound method from an array of instances
233(1)
Exercise 3 Computing finite difference in y direction
233(1)
8.6 New Fortran elements, at a glance
234(1)
8.7 Further reading
235(1)
9 Generic procedures and operators for any data type
236(28)
9.1 Analyzing weather data of different types
237(5)
About the data
238(3)
Objectives
241(1)
Strategy for this exercise
242(1)
9.2 Type systems and generic procedures
242(1)
Static versus strong typing
242(1)
9.3 Writing your first generic procedure
243(10)
The problem with strong typing
243(1)
Writing the specific functions
244(3)
Writing the generic interface
247(4)
Results and complete program
251(2)
9.4 Built-in and custom operators
253(6)
What's an operator?
253(1)
Things to do with operators
253(2)
Fortran's built-in operators
255(2)
Operator precedence
257(1)
Writing custom operators
257(1)
Redefining built-in operators
258(1)
9.5 Generic procedures and operators in the tsunami simulator
259(1)
Writing user-defined operators for the Field type
259(1)
9.6 Answer key
260(3)
Exercise 1 Specific average function for a derived type
260(2)
Exercise 2 Defining a new string concatenation operator
262(1)
9.7 New Fortran elements, at a glance
263(1)
10 User-defined operators for derived types
264(27)
10.1 Happy Birthday! A countdown app
265(1)
Some basic specification
265(1)
Implementation strategy
266(1)
10.2 Getting user input and current time
266(6)
Your first datetime class
266(1)
Reading user input
267(4)
Getting current date and time
271(1)
10.3 Calculating the difference between two times
272(10)
Modeling a time interval
273(1)
Implementing a custom subtraction operator
273(2)
Time difference algorithm
275(5)
The complete program
280(2)
10.4 Overriding operators in the tsunami simulator
282(6)
A refresher on the Field class
283(1)
Implementing the arithmetic for the Field class
284(2)
Synchronizing parallel images on assignment
286(2)
10.5 Answer key
288(2)
Exercise 1 Validating user input
288(1)
Exercise 2 Leap year in the Gregorian calendar
289(1)
Exercise 3 Implementing the addition for the Field type
289(1)
10.6 New Fortran elements, at a glance
290(1)
Part 4 The final stretch
291(64)
11 Interoperability with C: Exposing your app to the web
293(33)
11.1 Interfacing C: Writing a minimal TCP client and server
294(3)
Introducing networking to Fortran
295(2)
Installing libdill
297(1)
11.2 TCP server program: Receiving network connections
297(20)
IP address data structures
299(2)
Initializing the IP address structure
301(5)
Checking IP address values
306(2)
Intermezzo: Matching compatible C and Fortran data types
308(2)
Creating a socket and listening for connections
310(1)
Accepting incoming connections to a socket
311(1)
Sending a TCP message to the client
312(3)
Closing a connection
315(2)
11.3 TCP client program: Connecting to a remote server
317(5)
Connecting to a remote socket
317(2)
Receiving a message
319(2)
The complete client program
321(1)
11.4 Some interesting mixed Fortran-C projects
322(1)
11.5 Answer key
322(2)
Exercise 1 The Fortran interface to ipaddr_port
322(1)
Exercise 2 Fortran interfaces to suffix_detach and tcp_close
323(1)
11.6 New Fortran elements, at a glance
324(1)
11.7 Further reading
324(2)
12 Advanced parallelism with teams, events, and collectives
326(29)
12.1 From coarrays to teams, events, and collectives
327(1)
12.2 Grouping images into teams with common tasks
328(10)
Teams in the tsunami simulator
329(2)
Forming new teams
331(1)
Changing execution between teams
332(3)
Synchronizing teams and exchanging data
335(3)
12.3 Posting and waiting for events
338(5)
A push notification example
339(2)
Posting an event
341(1)
Waiting for an event
341(1)
Counting event posts
342(1)
12.4 Distributed computing using collectives
343(4)
Computing the minimum and maximum of distributed arrays
343(2)
Collective subroutines syntax
345(1)
Broadcasting values to other images
346(1)
12.5 Answer key
347(6)
Exercise 1 Hunters and gatherers
347(3)
Exercise 2 Tsunami time step logging using events
350(1)
Exercise 3 Calculating the global mean of water height
351(2)
12.6 New Fortran elements, at a glance
353(1)
12.7 Further reading
353(2)
Appendix A Setting up the Fortran development environment 355(6)
Appendix B From calculus to code 361(5)
Appendix C Concluding remarks 366(15)
Index 381
Milan Curcic is a meteorologist and oceanographer. A Fortran programmer since 2006, he has worked with teams from United States Navy and NASA on developing and improving Earth system prediction models. Milan has authored two general-purpose Fortran libraries and is currently working on a startup porting Fortran to the cloud for weather and ocean prediction.