Error mkl_avx2.2.dll when calculating large array in Intel Fortran

Viewed 50

I need to calculate the operation APA' by mkl function mkl_sparse_d_syprd. I use visual studio 2019.

In the example below, A is the identity matrix and P is the matrix with all elements are one. In my code, for the small array with nstate=100 or 1000, the code can run well. However if the values of nstate=50000 or larger, the following error appears: "Exception thrown at 0x00007FFDFB353C57 (mkl_avx2.2.dll) in Console22.exe: 0xC0000005: Access violation reading location 0x0000025986EEA108." My computer has 128GB RAM so I think the problem is not about the storage.

Please help me solve this problem. Thank you very much!

    ! A=Identity matrix
    !P=matrix with all elements are one 
    
    program test_spblas
    use mkl_spblas
    implicit none
    integer, parameter :: nstate = 50000
    double precision,allocatable, dimension (:,:):: P,APAT
    integer, allocatable, dimension (:):: c_A,pB_A,pE_A
    double precision, allocatable, dimension (:):: v_A
    integer stat,nnz_A,i
    type(sparse_matrix_t) :: A_s
    nnz_A=nstate
    allocate(v_A(nnz_A),c_A(nnz_A),pB_A(nstate),pE_A(nstate))
    allocate(P(nstate,nstate),APAT(nstate,nstate))
    do i=1,nstate
        pB_A(i)=i
        pE_A(i)=i+1
        c_A(i)=i
    enddo
    v_A=1d0
    P=1d0
    APAT=0d0
    stat = mkl_sparse_d_create_csr(a_s,sparse_index_base_one,nstate,nstate,pb_a,pe_a,c_a,v_a)
    stat = mkl_sparse_d_syprd (sparse_operation_non_transpose,a_s, p, sparse_layout_column_major, nstate, 1d0, 0d0, apat,spaRSE_LAYOUT_COLUMN_MAJOR, nstate)
    end program test_spblas
0 Answers
Related