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

Another question with multi-processor?????

IDZ_A_Intel
Employee
552 Views

Hi, I have another question. Thanks everyone.

My computer has 4 cores inside, I really want the fortran compiler can make use of all of them when running the code. For my understanding, when we add, substract or multiple two matrix, the task is possible to be distributed to the CPU-cores in order to improve the speed.

So does the ifort or intel MKL have SMP/OpenMP Support on Linear Algebra Operators? I mean when adding, or substracting, or multiplying two matrix?

Thanks very much.

0 Kudos
3 Replies
IDZ_A_Intel
Employee
553 Views
MKL does. Intel Fortran doesn't do this automatically. If you enable autio-parallel, or use OpenMP, then the compiler may be able to do this in parallel. I recommend using MKL for this.
0 Kudos
IDZ_A_Intel
Employee
553 Views

Hi Steve,

Thank you very much firstly. Sorry that I am just a beginner, so could you make it in more detail? For example,

1. if I want to multiply two matrix, how MKL performs this by making use of my 4 cores? Does MKL do this automatically or I need to write special code manually?

2. I prefer MKL, but I really want to know how to operate the matrix with OpenMP. Again, if I want to multiply two matrix, do you mean something like below?

!$OMP PARALLEL DO

c=matmul(A,B)

!$OMP END PARALLEL DO

or you mean add /openmp when compiling the code?

3. how to enable autio-parallel?

Sorry that my questions are silly for you, but they are extremely useful for me.

Ying

0 Kudos
TimP
Honored Contributor III
553 Views

For MKL usage, you must call the BLAS library functions. They work the same as other BLAS functions, such as ACML, or the source code from netlib.org. You could read about it in the mkl/docs directory, or in independent references.

gfortran has a facility to generate DGEMM call from MATMUL, in case you are interested. It combines limitations of MATMUL and DGEMM.

If you wish to parallelize with OMP PARALLEL DO, you require a DO loop. This could be quite effective for parallelizing many independent instances of MATMUL.

The OpenMP way of parallelizing an individual MATMUL is with OMP WORKSHARE, but ifort supports this only as a SINGLE region. Thus, if you have a problem large enough to parallelize, MKL BLAS, or even writing it out in nested loops for use with PARALLEL DO, would be preferred.

Intel Fortran and C compilers include the auto-parallelization options -Qparallel. Checking the Windows help file would be a good start.

0 Kudos
Reply