Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7297 讨论

A memory allocation problem in cluster_sparse_solver

DreamlikeCastle
3,131 次查看

Hi, friends. I'm writing a fortran code that separates different cluster_sparse_solver phases. However, I get the following error info:

RANK # 3 failed to allocate -0.0291 Gb (-31195472). Memory already allocated 0.0000 Gb

Could anybody try the following code?

 

 

include 'mkl_cluster_sparse_solver.f90'
module pardiso_cluster
use mkl_cluster_sparse_solver
use mpi
implicit none
private
TYPE(MKL_CLUSTER_SPARSE_SOLVER_HANDLE), allocatable :: pt(:)
integer, allocatable :: iparm(:)
integer :: maxfct, mnum, n, nnz, mtype, phase, msglvl, error, idum(1), nrhs, i, mpi_stat, rank, mkl_comm
real(8) :: ddum(1)
public :: pardiso_cluster_1,pardiso_cluster_2,pardiso_cluster_3
contains
subroutine pardiso_cluster_1(ia,ja,va)
implicit none
integer,allocatable :: ia(:),ja(:)
real(8),allocatable :: va(:)
! Initialize task data on master MPI process
MKL_COMM = MPI_COMM_WORLD
call mpi_init(mpi_stat)
call mpi_comm_rank(MKL_COMM, rank, mpi_stat)
! initialize pardiso working arrays and parameters
allocate(iparm(64),pt(64))
do i=1,64
iparm(i) = 0
pt(i)%dummy = 0
end do
maxfct = 1
mnum = 1
mtype = -2
n = size(ia)-1
nnz = size(ja)
msglvl = 1
error = 0
nrhs = 1
! pardiso phase 1 and 2
phase = 12
!print*,ia
call cluster_sparse_solver (pt, maxfct, mnum, mtype, phase, n, Va, ia, ja, idum, nrhs, iparm, msglvl, ddum, ddum, MKL_COMM, error )
!print*,error
if (error.ne.0.and.rank.eq.0) stop "PARDISO PHASE 12 error"
end subroutine pardiso_cluster_1
subroutine pardiso_cluster_2 (b,x)
implicit none
real(8),allocatable :: b(:),x(:)
! pardiso phase 3
phase = 33
call cluster_sparse_solver ( pt, maxfct, mnum, mtype, phase, n, ddum, idum, idum, idum, nrhs, iparm, msglvl, b, x, MKL_COMM, error )
if (error.ne.0.and.rank.eq.0) stop "PARDISO PHASE 3 error"
end subroutine pardiso_cluster_2
subroutine pardiso_cluster_3
implicit none
! pardiso phase -1
phase = -1
call cluster_sparse_solver ( pt, maxfct, mnum, mtype, phase, n, ddum, idum, idum, idum, nrhs, iparm, msglvl, ddum, ddum, MKL_COMM, error )
if (error.ne.0.and.rank.eq.0) stop "PARDISO PHASE -1 error"
! deallocate arrays
if ( allocated(pt)) deallocate(pt)
if ( allocated(iparm)) deallocate(iparm)
! finalize MPI process
call mpi_finalize(mpi_stat)
if (error.ne.0.and.rank.eq.0) stop "MPI error"
end subroutine pardiso_cluster_3
end module pardiso_cluster

program main
use pardiso_cluster
implicit none
integer mtype, phase
integer i, n, nnz
integer, allocatable :: ia( : )
integer, allocatable :: ja( : )
real(8), allocatable :: a( : )
real(8), allocatable :: b( : )
real(8), allocatable :: x( : )
data n /8/, nnz /18/
allocate( ia ( n + 1 ) )
allocate( ja ( nnz ) )
allocate( a ( nnz ) )
allocate( b ( n ) )
allocate( x ( n ) )
ia = (/1, 5, 8, 10, 12, 15, 17, 18, 19/)
ja = (/1, 3, 6, 7, &
2, 3, 5, &
3, 8, &
4, 7, &
5, 6, 7, &
6, 8, &
7, &
8/)
a = (/7.d0, 1.d0, 2.d0,7.d0, &
-4.d0,8.d0, 2.d0, &
1.d0, 5.d0,&
7.d0, 9.d0, &
5.d0,1.d0,5.d0, &
-1.d0, 5.d0,&
11.d0, &
5.d0/)
b = 1.d0
CALL pardiso_cluster_1(ia,ja,a)
CALL pardiso_cluster_2(B,X)
print*,x
CALL pardiso_cluster_3
end program main

0 项奖励
6 回复数
AryanK_Intel
员工
3,087 次查看

Hi,


Thanks for posting in Intel Communities.

 

Could you please share your MKL version, software and hardware details so that we can reproduce the issue from our end?  


Could you please share the compiled code in a file to avoid indentation errors?

 

Thanks & Regards,

Aryan


0 项奖励
DreamlikeCastle
3,003 次查看

Thanks for your kind reply. I have attached the code example, please use the Release configuration.

 

My environment has been updated to the latest, including Windows 11 22621.2506, Visual Studio 17.7.6, and OneAPI 2023.2.

 

In my system, the error message is like:

 

PARDISO PHASE 12 error
RANK # 2 failed to allocate -0.0000 Gb (-20). Memory already allocated 0.0000 Gb
RANK # 3 failed to allocate -0.0000 Gb (-16). Memory already allocated 0.0000 Gb

===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= RANK 1 PID 38608 RUNNING AT DESKTOP-MGAJ355
= EXIT STATUS: -1 (ffffffff)
===================================================================================

===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= RANK 2 PID 31120 RUNNING AT DESKTOP-MGAJ355
= EXIT STATUS: -1 (ffffffff)
===================================================================================

===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= RANK 3 PID 36292 RUNNING AT DESKTOP-MGAJ355
= EXIT STATUS: -1 (ffffffff)
===================================================================================

0 项奖励
DreamlikeCastle
3,023 次查看

Thanks for your kind reply. I have attached the project below.

 

The environment has been updated to the latest, for instance, OneAPI 2023.2.

0 项奖励
AryanK_Intel
员工
2,919 次查看

Hi,

 

Thank you for providing the code.

 

Could you please kindly execute the code on the Intel oneAPI command prompt for Intel 64 with Visual Studio 2022 and let us know if the issue persists? Additionally, could you please provide us with the commands being used so that we can reproduce the same at our end?

 

Thanks & Regards,

Aryan

 

0 项奖励
AryanK_Intel
员工
2,867 次查看

Hi,


Gentle reminder:


We haven't heard back from you. Could you please provide an update on the above information?


Thanks and Regards,

Aryan


0 项奖励
AryanK_Intel
员工
2,824 次查看

Hi,


Gentle reminder:


We haven't heard back from you. Could you please provide an update on the above information?


Thanks and Regards,

Aryan


0 项奖励
回复