Click here to load reader
Upload
marco-parenzan
View
478
Download
5
Embed Size (px)
DESCRIPTION
Fortran Molecular Dynamic Simulation code conversion in C#
Citation preview
12 April 2023 - slide 1MOSE – University of Trieste
Case study: Conversione di una applicazione Fortran di dinamica molecolare – Part II
Marco Parenzan
GPU@UniTS
12 April 2023 - slide 2MOSE – University of Trieste
Source Conversionfrom Fortran to C#
Marco Parenzan
GPU@UniTS
12 April 2023 - slide 3MOSE – University of Trieste
Writing Good Code
Marco Parenzan
GPU@UniTS
12 April 2023 - slide 4MOSE – University of Trieste
The original codeOriginal code can be downloaded from http://www.fisica.uniud.it/~ercolessi/md/f90/
(C) 1995 Furio Ercolessi – SISSA
Written in Fortran 90Details
Typical imperative programming of the ‘80s Fortran primitives
Vectors Float
No object orientation Code + I/O + user interface mixed in code
Single module
12 April 2023 - slide 5MOSE – University of Trieste
Problems...High Coupling
No replace
No Separation of concerns I/O (Data Access), Screen (Presentation), Calculation (Business
Logic)
Low reuse Big blocks of code Vertical, for specific use,
Low maintability If I change something here, what happens there..?
12 April 2023 - slide 6MOSE – University of Trieste
What is New ?Team developmentComplex UIData AccessRelational DatabasesLAN, Internet, NetworksScaling (up and out)...
12 April 2023 - slide 7MOSE – University of Trieste
GPUs....GPUs require a lot of preparation code
GPUs preparation is a lot specific for the specific card
A lot of Hardware Hardware change Separate code for specific hardware from generic,
independent code
12 April 2023 - slide 8MOSE – University of Trieste
Modern Coding...Use Object Orientation
Identify Concepts Model Concepts into Classes and instantiate them into Objects
Organize Code Use modules (it depends on language of your choise) Organize modules in roles
Roles What a module do?
I/O Calculation Presentation
They are called tiers, if you distribute roles in different machines
Create libraries of reusable toolsUse modern IDE and Development environments
12 April 2023 - slide 9MOSE – University of Trieste
LOOK AT CODELinguaggi di programmazione e compilatori per le GPU
12 April 2023 - slide 10MOSE – University of Trieste
CONCLUSIONS – PART IILinguaggi di programmazione e compilatori per le GPU
12 April 2023 - slide 11MOSE – University of Trieste
ConclusionsAll of this are pre-requisites to good code developmentObjective
Create good code Good code=Maintainable code Sunstainable Development
Good code is a big candidate to be performant code If not, the process to become performant code is clean It’s not true about the opposite:
Optimal code (for perfomance) probably is not maintainable code ...and it’s difficult to get back The money you save making simulation fast, you loose money in
updating software
What about our code?
12 April 2023 - slide 12MOSE – University of Trieste
Molecular simulationOur C# code is quite «elegant» code
Good to maintain It’s easy to understand and to identify code to be ported to
GPU
Some extreme chooses (all is an object) are not the best for performances
Again, best for maintainability
GPU primitives are more confident to arrays that to objects
But you still remain with the host code Probably the biggest part of the application (in terms of #lines
of code)
GPU is the best solution in performance But it’s not the only solution
«ManyCore» and «Cloud», for example, are not GPU technologies
They likes objects...
12 April 2023 - slide 13MOSE – University of Trieste
blog:
email:
web:
twitter:
slideshare:
facebook:
linked-in:
Links
Marco Parenzan
http://blog.codeisvalue.com/
http://www.codeisvalue.com/
@marco_parenzan
http://www.slideshare.com/marco.parenzan
http://www.facebook.com/parenzan.marco
http://it.linkedin.com/in/marcoparenzan