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

  • Thread starter Thread starter gholamghar
  • Start date Start date
  • Tags Tags
    cpu Fortran
AI Thread Summary
To reduce the execution time of Fortran code on a quad-core Intel Core 2 processor, utilizing all four cores is essential. The primary method discussed is implementing a message passing interface (MPI), which allows for parallel processing by enabling communication between multiple processes. While MPI is commonly associated with large-scale clusters, it can also be applied on personal computers to leverage multiple cores. Restructuring the code for parallel execution is necessary, which involves breaking the program into smaller tasks that can run concurrently. Another option mentioned is OpenMP, a parallel programming model that can be used on personal computers to create multi-threaded applications, allowing each thread to utilize a separate core. Additionally, enabling software parallelization features in the Intel Fortran Compiler can lead to significant time savings. Users are encouraged to explore these parallelization techniques to optimize their code execution times effectively.
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
 
Back
Top