Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Testing different fortran coding paradigms for speed

License

NotificationsYou must be signed in to change notification settings

alex-robinson/fortran-speed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Testing different fortran coding paradigms for speed

Looping over types

This test compares looping over individual arraysof variables with multiple dimensions to loopingover arrays of derived types, where e.g., the last dimensionis contained within the derived type.

Case 1 (arrays): a single derived type contains 3D arrays inside it.

Case 2 (columns): a 2D array of derived types contains 1D arrays inside them.

Case 3 (points): a 3D array of derived types contains points inside them.

To perform the test, compile the code, then run it:

gfortran looping_over_types.f90./a.out

Example output:

Time using:   arrays:      2.45     sTime using:  columns:      2.08     sTime using:   points:      1.99     s

However, using different compiler flags can change the comparison:

gfortran -O3 -flto -march=native looping_over_types.f90./a.out
Time using:   arrays:      1.90     sTime using:  columns:      1.53     sTime using:   points:      1.53     s

Conclusions

gfortran 12.2.0, ifort 19.1.3.304

Using arrays inside the derived type is a little slower thanusing a 2D array of derived types with a column vector inside,and the fastest is actually to use a 3D array of derived typeswith points inside.

The right compiler flags can greatly reduce differences between these methods.

About

Testing different fortran coding paradigms for speed

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp