- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We have just switched from usingCompaq visual fortran (CVF) incl IMSL to Intel Visual Fortran (IVF)without IMSLand therefor I am using IMKL to do FFT. I have included mkl_dfti.f90 in my project and enabled IMKL byincluding mkl_intel_c.lib mkl_sequential.lib mkl_core.lib (or alternatively /Qmkl:sequential). This all works fine. However the size of our applications (exe files) increases from approximately 2Mb (when using CVF)to 26Mb (when using IVF).I can track the cause to be inclusion of IMKL.
It seems to me that I am including the entire IMKL library, even though I only need the part doing FFT. Am I doing something wrong or is it common that the size will increase that much? Is it possible to limit the size by e.g. linking only to part of the IMKL?
Regards
Lars
We have just switched from usingCompaq visual fortran (CVF) incl IMSL to Intel Visual Fortran (IVF)without IMSLand therefor I am using IMKL to do FFT. I have included mkl_dfti.f90 in my project and enabled IMKL byincluding mkl_intel_c.lib mkl_sequential.lib mkl_core.lib (or alternatively /Qmkl:sequential). This all works fine. However the size of our applications (exe files) increases from approximately 2Mb (when using CVF)to 26Mb (when using IVF).I can track the cause to be inclusion of IMKL.
It seems to me that I am including the entire IMKL library, even though I only need the part doing FFT. Am I doing something wrong or is it common that the size will increase that much? Is it possible to limit the size by e.g. linking only to part of the IMKL?
Regards
Lars
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lars,
You used static linking with MKL. Please link with dynamic MKL:
mkl_intel_c_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib
or with single dynamic library (with additional setting to use sequential libs, see MKL doc)
mkl_rt.lib
You used static linking with MKL. Please link with dynamic MKL:
mkl_intel_c_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib
or with single dynamic library (with additional setting to use sequential libs, see MKL doc)
mkl_rt.lib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Victor,
This will indeed reduce the size of the .exe file. When counting the additional dll's that needs to be distributed(mkl_core.dll and mkl_sequential.dll) Iend up withapproximately 11Mb.
However this is still 4 times the size of my old code andI would rather have a static linked library.
Any suggestions are highly appreciated?
Thanks
Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Lars,
MKL static libraries from which custom library is built currently contain all supported CPU-codes since Pentium-4.
Therefore they are so big in size.
Do you need both single and double precision DFT transforms?
In case of one precision, you can reduce DLL size by selecting correct names in export list. See comments in DFT example list.
But if your application uses for exampleDFT with 2-power sizes only you can try to use IPP FFT libraries.
MKL static libraries from which custom library is built currently contain all supported CPU-codes since Pentium-4.
Therefore they are so big in size.
Do you need both single and double precision DFT transforms?
In case of one precision, you can reduce DLL size by selecting correct names in export list. See comments in DFT example list.
But if your application uses for exampleDFT with 2-power sizes only you can try to use IPP FFT libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Gennady and Victor,
Thank you both, I will look into both IPP and the DFT examples.
Regards
Lars
Thank you both, I will look into both IPP and the DFT examples.
Regards
Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Victor,
I found the example inmkl_dfti.f90 and tried to use
USE MKL_DFTI, FORGET=>DFTI_SINGLE, DFTI_SINGLE=>DFTI_SINGLE_R
This reduced the size of the exe from approximately 26Mb to 12Mb. However I am somewhat puzzled by the FORGET=>DFTI_SINGLE part of the above. From mkl_dfti.f90
What is meant by: ...word'FORGET' can be any name not used in the program?
Regards
Lars
I found the example inmkl_dfti.f90 and tried to use
USE MKL_DFTI, FORGET=>DFTI_SINGLE, DFTI_SINGLE=>DFTI_SINGLE_R
This reduced the size of the exe from approximately 26Mb to 12Mb. However I am somewhat puzzled by the FORGET=>DFTI_SINGLE part of the above. From mkl_dfti.f90
[bash] ! DFTI_PRECISION for reduced size of statically linked application. ! Recommended use: modify statement 'USE MKL_DFTI' in your program, ! so that it reads as either of: ! USE MKL_DFTI, FORGET=>DFTI_SINGLE, DFTI_SINGLE=>DFTI_SINGLE_R ! USE MKL_DFTI, FORGET=>DFTI_DOUBLE, DFTI_DOUBLE=>DFTI_DOUBLE_R ! where word 'FORGET' can be any name not used in the program. [/bash]
What is meant by: ...word'FORGET' can be any name not used in the program?
Regards
Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Lars,
Literally, you can replace word 'FORGET' with any other word which is not used in the program/function/subroutine that includes the USE statement.
Fortran statement
USE module-name, local-name => use-name, local-name => use-name
is a convenient way to redefine a use-name (the name injected into the program by
the USE statement) by rename operator '=>'.
Ifthe local-name that wewant toemploycoincides with a use-name,
then werun into the situation which is described by Fortran standard as
'two or more accessible entities have the same name'. This is ok unless the name
is referenced in the program and is not a generic name, which is not our case.
In other words, we cannotwriteDFTI_SINGLEat the left of '=>' until we
rename it by placing it at the right of '=>', whichis what we do in the firstrename.
Word 'forget' is not a keyword, it is chosen so to correctly convey the semantics
of the operation.
Thanks
Dima
Literally, you can replace word 'FORGET' with any other word which is not used in the program/function/subroutine that includes the USE statement.
Fortran statement
USE module-name, local-name => use-name, local-name => use-name
is a convenient way to redefine a use-name (the name injected into the program by
the USE statement) by rename operator '=>'.
Ifthe local-name that wewant toemploycoincides with a use-name,
then werun into the situation which is described by Fortran standard as
'two or more accessible entities have the same name'. This is ok unless the name
is referenced in the program and is not a generic name, which is not our case.
In other words, we cannotwriteDFTI_SINGLEat the left of '=>' until we
rename it by placing it at the right of '=>', whichis what we do in the firstrename.
Word 'forget' is not a keyword, it is chosen so to correctly convey the semantics
of the operation.
Thanks
Dima
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dima,
Thank you for the explanation -this makes sense.
Additional question:
I tried to compile the code without the first rename i.e.
use MKL_DFTI, DFTI_SINGLE=>DFTI_SINGLE_R
and this compiles without error (and I get a reduced size of my executable). The full code looks like this:
Is there an exception in this case?
Regards
Lars
Thank you for the explanation -this makes sense.
Additional question:
I tried to compile the code without the first rename i.e.
use MKL_DFTI, DFTI_SINGLE=>DFTI_SINGLE_R
and this compiles without error (and I get a reduced size of my executable). The full code looks like this:
[bash]subroutine FFTRF(nXi,nXo, X_in, X_out) !------------------------------------------------------------------------------- ! !-- Compute the Fourier coefficients of a real periodic sequence using Intel Math Kernel Library. ! Based on the example in the IMKL help. !------------------------------------------------------------------------------- USE MKL_DFTI, DFTI_SINGLE=>DFTI_SINGLE_R implicit none integer , intent(in) :: nXi, nXo ! number of points in X_OUT real(4), dimension(nXi), intent(in) :: X_in ! real sequence real(4), dimension(nXo), intent(in out) :: X_out ! fourier coefficients type(DFTI_DESCRIPTOR), pointer :: fftDescHandle integer :: iret ! Perform a complex to complex transform iret = DftiCreateDescriptor(fftDescHandle, DFTI_SINGLE, & DFTI_REAL, 1, nXo ) iret = DftiSetValue(fftDescHandle, DFTI_PLACEMENT, DFTI_NOT_INPLACE) iret = DftiCommitDescriptor(fftDescHandle) iret = DftiComputeForward(fftDescHandle, X_in, X_out) iret = DftiFreeDescriptor(fftDescHandle) ! result is given by {X_out(1),X_out(2),...,X_out(32)} return end subroutine FFTRF[/bash]
Is there an exception in this case?
Regards
Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are prepared to do a little extra work in order to invoke only those module entities that are used, you can spell them out:
[fortran] USE MKL_DFTI, only : & DFTI_DESCRIPTOR, & DftiCreateDescriptor, & DftiSetValue, & DftiComputeForward, & DftiCommitDescriptor, & DftiFreeDescriptor, & DFTI_REAL, & DFTI_PLACEMENT, & DFTI_NOT_INPLACE & DFTI_SINGLE [/fortran]This will exclude all module entities that are not used from fattening up your OBJ and EXE files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mecej4,
I already tried that, but it did not give mea size reduction of my exe. In fact you still have to use DFTI_SINGLE => DFTI_SINGLE_R in the only list to geta size reduction.
Regards
Lars
I already tried that, but it did not give mea size reduction of my exe. In fact you still have to use DFTI_SINGLE => DFTI_SINGLE_R in the only list to geta size reduction.
Regards
Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there an exception in this case?
This is probably my misinterpretation of the standard's intericate clauses. Compiler may interpretthe clause differently anyway and not require the 'forget' rename. If you care about portability of the software, you should probably leave the 'forget' rename in place.
Thanks
Dima
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page