Parallel Fortran Programming Help Wanted

  • Context: Fortran 
  • Thread starter Thread starter alabdullah
  • Start date Start date
  • Tags Tags
    Fortran Parallel
Click For Summary

Discussion Overview

The discussion revolves around seeking assistance for creating a parallel program using Fortran, specifically focusing on performance optimization and parallelization techniques. Participants explore various tools, methodologies, and challenges associated with parallel programming in the context of Fortran 90 and GFORTRAN.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants inquire about the tools available for parallel programming and the capabilities of their Fortran compiler.
  • One participant mentions using GFORTRAN on a cluster but expresses concerns about the speed of their program and seeks help to improve it.
  • There is a suggestion that parallelization requires an appropriate algorithm that can be parallelized, not just a capable compiler.
  • Another participant advises researching OpenMP and suggests that identifying the most time-consuming loops can lead to effective parallelization with minimal code changes.
  • One participant acknowledges knowing which loop to parallelize but struggles with the implementation of OpenMP.
  • Another viewpoint emphasizes that many programs may benefit more from optimization rather than parallelization.
  • Participants discuss the learning curve associated with parallel programming and recommend online tutorials and books for further study.
  • There is mention of common errors in parallel programming and alternative approaches like the BSP library, though one participant expresses their novice status with these methods.
  • One participant offers to review another's program for feedback, highlighting the potential for collaborative problem-solving.
  • Technical suggestions are made regarding compiler options for inlining and optimization to improve performance before considering parallelization.
  • A question is raised about how to approach parallelizing multiple small loops within a main loop, emphasizing the need for understanding the dependencies between iterations.

Areas of Agreement / Disagreement

Participants express a mix of opinions on the necessity and approach to parallelization versus optimization. While some advocate for parallelization, others suggest focusing on optimizing existing code first. The discussion remains unresolved regarding the best path forward for the original poster's programming challenges.

Contextual Notes

Participants mention various tools and techniques, but there are limitations in terms of specific knowledge about the original program's structure and the exact nature of the loops involved. The discussion also reflects varying levels of familiarity with parallel programming concepts among participants.

Who May Find This Useful

This discussion may be useful for individuals interested in parallel programming with Fortran, particularly those seeking to optimize their code or learn about parallelization techniques using OpenMP or similar tools.

alabdullah
Messages
7
Reaction score
1
Hi mates
please are there anybody help me to make parallel program
best regards
 
Technology news on Phys.org
alabdullah said:
Hi mates
please are there anybody help me to make parallel program
best regards
What tools do you have to make a parallel program? Do you have a Fortran compiler which is capable of generating parallel code? Do you have a computer with parallel processors on which to run your code?
 
I use FORTRAN 90 and GFORTRAN on cluster
I did a program and got good result but it is so slow
can you help me to make it faster
Sorry I'm not professional in FORTRAN to know which compiler is good
regards
 
  • Like
Likes   Reactions: NascentOxygen
Is this a homework assignment?

In general, it takes more than just a compiler to parallelize your code. The algorithm on which the code is based must be capable of being parallelized.
 
gfortran supposrts OpenMP; dedicate a good hour of your time to google and find a handful of pages on OpenMP, tutorials and examples so that you understand what it takes to parallelized parts of your porgram, if at all possible.

If you know which do-loop in your program is the most time-consuming and if it can be parallelized, you will see that it only takes no more than 10 extra lines of code to parallelize.
 
  • Like
Likes   Reactions: FactChecker
I know which loop need parallel but it included some subroutine , and I don't know how to use openMP.
 
Most home-made programs do not need parallelization, they need optimization. First try to speed up your program by optimization before going parallel.
 
I tried it but it still slow
 
Learning parallel programming is not something we can teach you here. There are some tutorials online on how to use OpenMP or MPI. There are also some good books on the subject. I learned OpenMP with B. Chapman et al., Using OpenMP (MIT Press, 2008).
 
  • #10
A warning, it takes a while to get used to parallel programming.
I understand the basics but don't ask me to parallelize a simulation (for example) because I'll be stuck.
This was after a semesters worth of lectures and hands-on sessions.

OpenMP is the easiest way if you're not that familiar with the concepts while MPI is generally more powerful. (Luckily there are some new functions in MPI3 that can help you avoid deadlock at the cost of some performance.)

Here are some common errors you can encounter with full-blown parallel computing
https://wiki.csiro.au/display/ASC/Frequent+parallel+programming+errors

There's also the BSP library which introduce an entire paradigm to model algorithms with a reasonably good book by Rob Bisseling. I'm more familiar with this idea than OpenMP or MPI but again, I'm a novice at best. The advantage for this approach is that the cost model is very simple.

Can you expand on the algorithm you want to parallelize, maybe parallelizing it is hard or next to impossible even.
 
  • #11
Thank you sir for your replay
may I send you my program to see it and give me some feed back about it,please
 
  • #12
If it is impossible to post here (proprietary reasons or otherwise) I guess you can.
By posting it here we could get more eyes on it that might see something that is a serious bottleneck.
I can't guarantee I come up with anything.

Also what you could try is checking out optimization when compiling, https://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Optimize-Options.html
Using such optimization flags leads to a serious increase in performance.
I have some data on an example I used to test the effectiveness of the flags for C-code, I'll try to dig it up tomorrow.
 
  • #13
Thank you so much sir
 
  • #14
Your description of the problem loop 'calls a subroutine' to me: screams for inlining and localization of data. the -finline-functions compiler option will force inlining.

Next, if - then - else branch prediction failure can take a big negative performance bite when prefetching the correct code and data. Especially with several if - then clauses inside one loop. Even worse: Each if branch calling a different subroutine.

https://en.wikipedia.org/wiki/Branch_predictor
https://en.wikipedia.org/wiki/Inline_expansion

Consider this before trying parallelization. There is less to learn.
 
  • Like
Likes   Reactions: JorisL
  • #15
hi mates
If I have main loop ,but there are many small loops
if I want to make it parallel.
what I must do?
 
  • #16
It all depends on what the loops do.
Ideally you would parallelize the main loop.

This does require that the iterations don't use results from a previous iteration. Otherwise you'll need to see if you can make it so.
Can you give a sketch of the algorithm in pseudo code we don't have enough to go by.
 

Similar threads

  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 37 ·
2
Replies
37
Views
5K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 3 ·
Replies
3
Views
823
  • · Replies 4 ·
Replies
4
Views
2K