Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

how to increase CPU usage for my fortran code?

rohitverma80
Beginner
2,000 Views
I am runninga Fortran program (DOS application), on my laptop processor i7-2760QM 2.4 GHz, 8GB 1600 MHz Ram, 120GB SSD, it shows 17% usage of total CPU. Also when I run the same program at another desktop with cheaper processor E8400 3GHz, 4GB Ram, it shows 50% usage and very shorter run times. Why is that so? Is there a solution?

It is also desirable to mention here that I am using intel parallel studio xe to compile the program. The latter involves explicit use of parallelizations in do and for loops.
0 Kudos
4 Replies
TimP
Honored Contributor III
2,000 Views
If you spend significant time on this, it's worthwhile to use formal tools to diagnose, e.g. Intel Inspector (thread checker) and Amplifier (performance profiler). Otherwise, you need to check each step of parallelism separately for correctness and performance gain (e.g. by commenting out OpenMP parallel regions). Such a problem could be caused by a race condition (incorrect threading) or false sharing (multiple threads writing to the same or nearby cache lines).
In some cases, asking ifort why it doesn't auto-parallelize, by /Qparallel, /Qpar-report2, and /Qguide-par, may give clues (or convince you the compiler is off target). It's usually best to optimize for vectorization first, then tackle threaded parallelism. Look for loop interchanges which the compiler will make for vectorization and write them in so that parallelization doesn't defeat them.
0 Kudos
jimdempseyatthecove
Honored Contributor III
2,000 Views
i7-2760QM is quad core with HT (8 hardware threads)
E8400 is dual core without HT (2 hardware threads)

100% / 8 = 12.5%
100% / 2 = 50%

17% on i7 indicates you have an additional 4.5% load over 1 thread.

For single threaded application you are not seeing underutilization of your processor.

Consider converting your Fortran program to take advantage of the additional cores.
Using OpenMP directive is one method. If you are using statistical functions consider using the Intel Math Kernel Library (MKL) as it is (has) multi-threaded support.

Jim Dempsey
0 Kudos
TimP
Honored Contributor III
2,000 Views
I assumed (should have so stated) that you were using 4 threads on the 4 core CPU. If the idle HT logical processors on your performance meter bother you, reboot with HT disabled.
0 Kudos
SergeyKostrov
Valued Contributor II
2,000 Views
>>How to increase CPU usage for my Fortran code?

For MS-DOS application I would consider the following:

- Reduce as much as possible I/O operations withHDD, that is, keep data in memory as much as you can,
or keep data on a RamDisk.A RamDisk driver isavailable on Microsoft's website.

Let me know if you won't be able to find and I look at my CD archives

-Try to use Extended Memory by using aDPMI driver

DPMI - DOS Protected Mode Interface

-Set CPU affinity for a second CPU

- Boost a priority to High, butI wouldn't recommend toboost toReal-Time

Best regards,
Sergey
0 Kudos
Reply