Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Shi_J_
Beginner
754 Views

The ordinal 242 could not be located in the dynamic link library mkl_intel_thread.dll

Jump to solution

Hi everyone

I have been doing fortran programs with intel mkl for several years, but this time I faced a runtime error as:

The ordinal 242 could not be located in the dynamic link library C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\redist\intel64\mkl\mkl_intel_thread.dll 

when I was trying to test sparse matrix function MKL_SPARSE_D_MV , and the test code is exactly the one I download from Intel official site. For convenience I paste the code here, and Line 66 is the function of  MKL_SPARSE_D_MV , if I comment this function it runs well.

My environment is listed as follows

Windows 10 x64, Visual Studio 2017 + Intel® Parallel Studio XE 2019 Update 3, and compiled with x64 Release version.

PROGRAM SPMV
!   *****************************************************************************
!   Declaration and initialization of parameters for sparse representation of
!   the matrix A in CSR format:
!   *****************************************************************************
    USE MKL_SPBLAS
    IMPLICIT NONE

    INTEGER M, N, NNZ, i, info
!   *****************************************************************************
!   Sparse representation of the matrix A
!   *****************************************************************************
    INTEGER, ALLOCATABLE :: csrColInd(:), csrRowPtr(:)
    DOUBLE PRECISION, ALLOCATABLE :: csrVal(:)
!   Matrix descriptor
    TYPE(MATRIX_DESCR) descrA     ! Sparse matrix descriptor
!   CSR matrix representation 
    TYPE(SPARSE_MATRIX_T) csrA    ! Structure with sparse matrix
!   *****************************************************************************
!   Declaration of local variables:
!   *****************************************************************************
    DOUBLE PRECISION, ALLOCATABLE :: x(:), y(:)
    DOUBLE PRECISION alpha, beta

    M = 5
    N = 5
    NNZ = 13
    ALLOCATE(csrColInd(NNZ))
    ALLOCATE(csrRowPtr(M+1))
    ALLOCATE(csrVal(NNZ))
    ALLOCATE(x(M))
    ALLOCATE(y(M))
    csrVal = (/ 1.0,-1.0,-3.0,-2.0,5.0,4.0,6.0,4.0,-4.0,2.0,7.0,8.0,-5.0 /)
    csrColInd = (/ 0,1,3,0,1,2,3,4,0,2,3,1,4 /)
    csrRowPtr = (/ 0, 3, 5, 8, 11, 13 /)
    x = (/ 1.0, 5.0, 1.0, 4.0, 1.0 /)
    y = (/ 0.0, 0.0, 0.0, 0.0, 0.0 /)
    alpha = 1.0
    beta  = 0.0

    print*,'EXAMPLE PROGRAM FOR MKL_SPARSE_D_MV'
    print*,'---------------------------------------------------'
    print*,''
    print*,'INPUT DATA FOR MKL_SPARSE_D_MV'
    print*,'WITH GENERAL SPARSE MATRIX'
    print*,'ALPHA =',alpha,'BETA =',beta
    print*,'SPARSE_OPERATION_NON_TRANSPOSE'
    print*,'Input vector'
    do i = 1, M
        print*,x(i)
    enddo

!   Create CSR matrix
    i = MKL_SPARSE_D_CREATE_CSR(csrA,SPARSE_INDEX_BASE_ZERO,M,N,csrRowPtr,csrRowPtr(2),csrColInd,csrVal)

!   Create matrix descriptor
    descrA % TYPE = SPARSE_MATRIX_TYPE_GENERAL

!   Analyze sparse matrix; chose proper kernels and workload balancing strategy
    info = MKL_SPARSE_OPTIMIZE(csrA)

!   Compute y = alpha * A * x + beta * y
!! #############################################################

!! error from here, but when I comment following function, it runs well;
    info = MKL_SPARSE_D_MV(SPARSE_OPERATION_NON_TRANSPOSE,alpha,csrA,descrA,x,beta,y)
!! #############################################################

!   Release internal representation of CSR matrix
    info = MKL_SPARSE_DESTROY(csrA)

    print*,''
    print*,'OUTPUT DATA FOR sparseDcsrmv'
    do i = 1, M
        print*,y(i)
    enddo

    print*,'---------------------------------------------------'

END PROGRAM SPMV

 

0 Kudos
1 Solution
mecej4
Black Belt
754 Views

I found a PC with

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.3.203 Build 20190206

and your program ran and gave correct results.

I suspect that some of your installed MKL files may have become corrupted. Please report what you get when you change to the directory containing mkl_intel_thread.dll and type the command

certutil -hashfile mkl_intel_thread.dll MD5

On my system, I see

3a31c220105784fb60edb3354dd147f5

 

View solution in original post

8 Replies
mecej4
Black Belt
754 Views

I tried the earlier release 19.0.1 (Windows 10, 64 bit) on your example source, and the resulting program ran fine. I'll try to find a PC with 19.0.3 installed and try again.

Shi_J_
Beginner
754 Views

Thank you mecej4, happy to hear that.

I also found that the sparse matrix - vector multiply functions mkl_dcsrgemv, mkl_dcsrmv lead to the same runtime error.

call mkl_dcsrgemv ( 'N' , M , csrVal , csrRowPtr , csrColInd , x , y )

matdescra(1) = 'G'
matdescra(4) = 'F'
call mkl_dcsrmv ( 'N' , M , M , alpha , matdescra , csrVal , csrColInd , csrRowPtr , csrRowPtr(2) , x , beta , y )

 

mecej4
Black Belt
755 Views

I found a PC with

Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.3.203 Build 20190206

and your program ran and gave correct results.

I suspect that some of your installed MKL files may have become corrupted. Please report what you get when you change to the directory containing mkl_intel_thread.dll and type the command

certutil -hashfile mkl_intel_thread.dll MD5

On my system, I see

3a31c220105784fb60edb3354dd147f5

 

View solution in original post

Shi_J_
Beginner
754 Views

Hi mecej4

I see my hash code is exactly identical to yours. 

I think the program linked to right DLL, because the popup error shows the DLL at the right location.

Spencer_P_Intel
Employee
754 Views

Hi Shi, 

Can you show us how you are building, linking and then running the code sample?  Often when I have seen an ordinal issue like this in my own applications, it is because the export lib (ex: mkl_intel_thread_dll.lib) I linked against in my application and the runtime DLL (ex: mkl_intel_thread.dll) that is picked up are somehow incompatible, ie from different releases.

Best,

Spencer 

Shi_J_
Beginner
754 Views

Hi Spencer

I 'm using VS2017 + Intel® Parallel Studio XE 2019 Update 3, and this is my setting of this fortran project using x64 Release version

  1. in Fortran\Libraries\Runtime Library, use Multithread DLL (/libs:dll /threads)
  2. in Fortran\Libraries\Use Intel Math Kernel Library, use Parallel (/Qmkl:parallel)
  3. In Linker\Input\Additional Dependencies, use mkl_intel_thread_dll.lib

 The Command line of Compiling procedure:

/nologo /O2 /standard-semantics /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc150.pdb" /libs:dll /threads /Qmkl:parallel /c

The Command line of linking procedure:

 /OUT:"x64\Release\Console1.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Release\Console1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\Users\xxxx\Documents\Visual Studio 2017\Projects\Console1\Console1\x64\Release\Console1.lib" mkl_intel_thread_dll.lib

 and the runtime library path is

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.3.203\windows\redist\intel64_win\mkl

where  mkl_intel_thread.dll located, and this path is in the system Path variable.

Shi_J_
Beginner
754 Views

Hi  mecej4 and Spencer

Thank you for your kind replies, which inspired me to check all DLLs that exe file depended on. Finally I found that an old version of

libiomp5md.dll

 located in my System32 and SysWOW64 folder, which are incompatible with my intel compiler. I replaced this file with lastest one, and the code ran fine. So next time the ordinal issue come up, I think every depended dll requires double check.

 

mecej4
Black Belt
754 Views

Shi J., thanks for that report -- I would not have guessed that the openMP DLL was the mismatched one. 

In similar situations, I have found it useful to use the WHERE utility to locate and report a DLL whose name I specify. If it is not the one I expected to be used, I can look at the environment setup to see why, for example, an older DLL will be used instead of a newer version which is available in a different directory.

Reply