Can software parallelization in Fortran reduce CPU usage and execution time?

  • Context: Fortran 
  • Thread starter Thread starter gholamghar
  • Start date Start date
  • Tags Tags
    cpu Fortran
Click For Summary

Discussion Overview

The discussion revolves around the potential for software parallelization in Fortran to reduce CPU usage and execution time on a personal computer with a multi-core processor. Participants explore various methods and technologies for achieving parallel execution, including MPI, OpenMP, and co-array Fortran.

Discussion Character

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

Main Points Raised

  • One participant notes that their Fortran code takes 8 hours to run while only utilizing 25% of CPU, suggesting a need for parallelization to leverage all four cores of their processor.
  • Another participant suggests using a message passing interface (MPI) for large-scale parallelization, indicating that even for shared memory systems, some coding adjustments are necessary to utilize multiple cores effectively.
  • It is mentioned that restructuring the code for parallel implementation with MPI involves adding message sending/receiving functionality, but that it is relatively straightforward.
  • A participant raises the possibility of identifying operations within the program that can be performed in parallel, potentially using GPU math libraries for additional performance gains.
  • Co-array Fortran is proposed as another option for parallelization, though details are limited.
  • The original poster clarifies that they are running on a personal computer and inquires about the applicability of MPI and OpenMP for their situation.
  • One participant shares their experience of reducing execution time significantly by enabling software parallelization in Intel's Fortran Compiler, indicating practical benefits of such approaches.

Areas of Agreement / Disagreement

Participants generally agree that parallelization can improve performance, but there are multiple competing views on the best methods to achieve this, including MPI, OpenMP, and co-array Fortran. The discussion remains unresolved regarding which approach is most suitable for the original poster's specific setup.

Contextual Notes

Participants express uncertainty about the specific implementation details for Fortran, particularly in relation to multi-threading and the use of MPI versus OpenMP. There are also assumptions about the nature of the code and operations that can be parallelized.

Who May Find This Useful

This discussion may be useful for individuals interested in optimizing Fortran code for multi-core processors, particularly those exploring parallel computing techniques and tools.

gholamghar
Messages
23
Reaction score
0
hello
i have intel core 2 quad and my operating system is windows,every time i execute my fortran code it takes 8 hours to finish and just 25% of my cpu is used during the run(cpu usage=25%),it means just one core of my processor is used,so is there any way that i can use all the 4 cores of my processor for executing my fortran code so that the executing time is reduced?
thanks in advance
 
Technology news on Phys.org
For using multiple processors on a large scale, we need to use a message passing interface to let the processors "talk" to each other. We use LAM/MPI if you're curious. Now, this is on large-scale clusters.

When the processors are all on-board, even though the memory is shared between the processors, I would still assume that some coding or MPI would need to be done to let code take full advantage of multiple cores.
 
Yup, the obvious answer is MPI. Note that you will have to restructure your code for parallel implementation and add the message sending/receiving functionality into it. MPI is really easy, only about six functions are completely necessary.
 
Are there any operations in your program that can be peformed in parallel? These could be split up into multiple threads. Also depending on the GPU in your video card, you might be able to use a GPU math library (ATI and nVIdia have these) which includes some vectorized floating point math operations, 4 to 16 operations in parallel.
 
Another option is something called co-array fortran. I heard about it somewhere... it could be worth looking into.
 
thank you all,i doubted that maybe i have not said the exact sentences to explain my questin,i am running my code in my personal computer not in a cluster,and my personal computer has just one core 2 quad processor,so you suggest that with MPI i can take advantage of all 4 cores of my processor?
(i have heard about OPENMP,is this like MPI? and could be used on my personal computer or it can be used only in a cluster?)
 
You can create a mutli-threaded application, which should end up using one cpu per thread. I've done this with a C program running under windows, but don't know how it would be done in Fortran.
 
Last edited:
You don't need to be running on a cluster to use MPI. You can break up your program into smaller pieces and run them in separate processes. Then you can use MPI to send data between the processes.
 
My code was taking 35 hours.
I've just enable software parallelization ( /Qparallel) in Intel's Fortran Compiler ( writing in Ms. Visual Studio 2008) and I saved a third of the time!

Please answer me for talk about this process,

Giovane
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 37 ·
2
Replies
37
Views
5K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 40 ·
2
Replies
40
Views
5K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 14 ·
Replies
14
Views
4K