Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Use OpenMP when invoking MKL poisson library

Chang_Lei
Beginner
451 Views
I invoked MKL Poisson Library in my program and tried to turn on OpenMP option as follow compile instructions:
ifort -openmp -fast .. program.f90 .. -L/export/mathlib/cmkl90/lib/em64t/ -lmkl_em64t -lguide -lpthread -lm

And four threads areused to run the program(I have set ipar(23)=4). However, the result shows that the cpu time used by MKL poisson solver only decrease to 0.09,as a comparation,when only one threadis used, the time is 0.12.

It seems that the accelerating speed is tiny.

Is this ordinary to the MKL poisson library(or where could I find the PARALLEL PERFORMANCE of MKL Poisson solver) ?

Thanks.
0 Kudos
1 Solution
Alexander_K_Intel2
451 Views
Hi,
Try to rewrite your code in next way:

call d_init_Helmholtz_3D(ax,bx,...,...,BCtype,q,ipar,dpar,stat)
ipar(23)=4 !OpenMP number of threads
call d_commit_Helmholtz_3D(ff,bd_ax,bd_bx,...,...,dpar,stat)
call d_Helmholtz_3D(ff,bd_ax,,...,...,ipar,dpar,stat)

call free_Helmholtz_3D(xhandle,yhandle,ipar,stat)

With best regards,
Alexander Kalinkin

View solution in original post

0 Kudos
5 Replies
TimP
Honored Contributor III
451 Views
From your quoted command line, it doesn't appear that you linked any MKL library functions. Perhaps you misquoted from a usage of several years ago.
The goal of OpenMP parallelism is not to reduce CPU time, but to reduce elapsed time. You are lucky if the total CPU time is reduced; more often it would increase somewhat.
0 Kudos
Chang_Lei
Beginner
451 Views

Maybe I didn't give an clear account of the problem.
The exact command is as follows:
ifort -openmp -fast mkl_dfti.f90 mkl_poisson.f90 MyProgram.f90 -L/export/mathlib/cmkl90/lib/em64t/ -lmkl_em64t -lguide -lpthread -lm
And the code where I invoked Poisson library isin MyProgram.f90:

call cpu_time(t2)
call d_init_Helmholtz_3D(ax,bx,...,...,BCtype,q,ipar,dpar,stat)
call d_commit_Helmholtz_3D(ff,bd_ax,bd_bx,...,...,dpar,stat)
ipar(23)=4 !OpenMP number of threads
call d_Helmholtz_3D(ff,bd_ax,,...,...,ipar,dpar,stat)
call free_Helmholtz_3D(xhandle,yhandle,ipar,stat)
call cpu_time(t1)

I supposed t1-t2 is the elapsed time of all the *_Helmholtz_3D functions.
The program is submitted and run on cluster, and 4 threads are used(setin *.sh file as"nodes=1:ppn=4").
So, if I'm wrong. How can I get the right usage? You didn't mean the CMKL9.0 doesn't support OpenMP, did you?
Anywhere can I find the usage of Poisson library with OpenMP?
With best regards.

0 Kudos
Alexander_K_Intel2
452 Views
Hi,
Try to rewrite your code in next way:

call d_init_Helmholtz_3D(ax,bx,...,...,BCtype,q,ipar,dpar,stat)
ipar(23)=4 !OpenMP number of threads
call d_commit_Helmholtz_3D(ff,bd_ax,bd_bx,...,...,dpar,stat)
call d_Helmholtz_3D(ff,bd_ax,,...,...,ipar,dpar,stat)

call free_Helmholtz_3D(xhandle,yhandle,ipar,stat)

With best regards,
Alexander Kalinkin
0 Kudos
Chang_Lei
Beginner
451 Views
Hi,
I have rewrote as you said anddecreased the elapsed time from about 0.17 to 0.06.
That seems to be very good accelerating speed.

Here I have another question. Can MKL poisson library be used in cylindrical coordinate (r,z,thelta)? Especially for the axisymmetrical coordinate (r,z). (I'm holding my breath...)

Best regards.
0 Kudos
Alexander_K_Intel2
451 Views
Hi,

Current version of MKL support only cartesian and spherical coordinate system.
With best regards,
Alexander Kalinkin
0 Kudos
Reply