Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran multiprocessor cpu?

  1. May 11, 2009 #1
    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
  2. jcsd
  3. May 11, 2009 #2


    User Avatar
    Science Advisor

    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.
  4. May 11, 2009 #3
    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.
  5. May 11, 2009 #4


    User Avatar
    Homework Helper

    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.
  6. May 11, 2009 #5
    Another option is something called co-array fortran. I heard about it somewhere... it could be worth looking into.
  7. May 11, 2009 #6
    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?)
  8. May 12, 2009 #7


    User Avatar
    Homework Helper

    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: May 12, 2009
  9. May 13, 2009 #8
    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.
  10. May 27, 2010 #9
    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,

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Fortran multiprocessor cpu?
  1. CPU usage (Replies: 3)

  2. The CPU ALU unit (Replies: 5)

  3. CPU question (Replies: 6)