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

Bloated EXEs produced when MKL-DSS used with static libraries

mecej4
Honored Contributor III
270 Views

Fortran and C applications that make calls to DSS (Direct Sparse Solver) produce huge EXE files on Windows when recent versions of Intel compilers and MKL are used, if static libraries are selected (/MT) rather than dynamic libraries (/MD). I noticed this problem when there was a noticeable delay before such a program, built from 35 lines of source code, ran and gave results from solving a set of five simultaneous linear equations. I happened to look at the HDD activity lights on my laptop, and then I checked the EXE size (all values given are byte counts).

Compiler      EXE Size (/MD)     EXE Size (/MT)            NOTE
------------   ----------------   -------------------     ---------
CVF 6.6         36,864                    831,488            32-bit, CXML
11.1.70         14,336                  7,812,608            32-bit
14.0.4          18,944                 44,312,064            LP64
15.0.4          19,968                 53,190,656            LP64
16.0.0          23,040                 61,577,216            LP64

Even if it is felt that nothing is amiss, it would be nice for users to be aware of the huge EXE sizes produced when DSS routines are called and static libraries are used.

Here is the test program, which is a simplified version of one of the examples provided with MKL.

      PROGRAM DSS_test
	    USe mkl_dss
        IMPLICIT NONE
C
        INTEGER, PARAMETER :: nRows=5, nCols=5, nNonZeros=9, nRhs=1
        INTEGER :: rowIndex(nRows + 1) = [ 1, 6, 7, 8, 9, 10 ]
		INTEGER :: columns(nNonZeros)  = [ 1, 2, 3, 4, 5, 2, 3, 4, 5 ]
        DOUBLE PRECISION :: 
     1     values(nNonZeros) = [9.,1.5,6.,.75,3.,0.5,12.,0.625,16.],
     2     rhs(nRows) = [ 1., 2., 3., 4., 5. ]
        DOUBLE PRECISION solution(nRows)
        INTEGER*8 handle
        INTEGER i, error, buf,idum(1)
C
        error = dss_create(handle, MKL_DSS_DEFAULTS)
        IF (error .NE. MKL_DSS_SUCCESS ) GO TO 999
C
        error = dss_define_structure( handle, MKL_DSS_SYMMETRIC,
     &  rowIndex, nRows, nCols, columns, nNonZeros )
        IF (error .NE. MKL_DSS_SUCCESS ) GO TO 999
        error = dss_reorder( handle, MKL_DSS_DEFAULTS, idum)
        IF (error .NE. MKL_DSS_SUCCESS ) GO TO 999
        error = dss_factor_real( handle, MKL_DSS_DEFAULTS, VALUES)
        IF (error .NE. MKL_DSS_SUCCESS ) GO TO 999
        error = dss_solve_real( handle, MKL_DSS_DEFAULTS, rhs, nRhs,
     &  solution)
        IF (error .NE. MKL_DSS_SUCCESS ) GO TO 999
        error = dss_delete( handle, MKL_DSS_DEFAULTS )
        IF (error .NE. MKL_DSS_SUCCESS ) GO TO 999
        WRITE(*,'(10ES12.4)') (solution(i), i = 1, nCols)
        STOP
  999   WRITE(*,*) "DSS error code ", error
        STOP 1
 1000 END PROGRAM

For speeding up the compilations, I used the following module, compiled once, instead of having include 'mkl_dss.fi' in my program source:

      module mkl_dss
c
      implicit none
      include 'mkl_dss.fi'
c
      end module

 

0 Kudos
0 Replies
Reply