- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
I met a problem when used the Fortran with MKL to write a program. When the volume of data is small, the function dgetrf and dgetrs, which can get the inverse of matrix , runs well, but as the data become large, say about 12GB, these functions produce strange result.
I used -mcmodel=medium to compile the code and at first sloving inverse of matrix is not based on the data.
Does anybody encounter this problem?
Thanks
Link Copied
13 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
For large data it's recommended to place them into allocatable buffers. Are they in allocatable memory?
Also, maybe you need to use ILP64 interfaceof MKL....
For large data it's recommended to place them into allocatable buffers. Are they in allocatable memory?
Also, maybe you need to use ILP64 interfaceof MKL....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Can you describe the problem in detail? The result from detrf function wasn't correct or you got error message?
Do you pay attention to return INFO parameter? You can find the following informationfor INFO parameter for dgetrf function in documentation
Can you describe the problem in detail? The result from detrf function wasn't correct or you got error message?
Do you pay attention to return INFO parameter? You can find the following informationfor INFO parameter for dgetrf function in documentation
* INFO (output) INTEGER
* = 0: successful exit
* < 0: if INFO = -i, the i-th argument had an illegal value
* > 0: if INFO = i, U(i,i) is exactly zero. The factorization
* has been completed, but the factor U is exactly
* singular, and division by zero will occur if it is used
* to solve a system of equations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At first, supposing the max of i = 50, I use dgetrf and dgetrs to solve a matrix, dimension 8*8, in a do stetement and return a right result. But when the max of i equals to 7000000, the result is not right.
However,both dgetrf and dgetrs's INFO are equal to 0.
For example:
do i = 1,50
call dgetrf( n, n, v, n,ipiv,info1)
call dgetrs( trans,n, n, v, n, ipiv,tt,n,info2)
end do
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used ILP64 interface but it did not work. The result is also wrong.
This is my link and compile code:
ifort -i8 -I${MKL_HOME}/include/intel64/ilp64 -I${MKL_HOME}/include -mcmodel=medium -shared-intel Mixfun.f90 MIX.f90 -c
ifort -o MIX.out Mixfun.o MIX.o -L${MKL_HOME}/lib/intel64 ${MKL_HOME}/lib/intel64/libmkl_lapack95_ilp64.a -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread -mcmodel=medium -shared-intel -lm
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to place the data into allocatable buffers?
You mean like this:
real, allocatable :: DataName(:,:,:).
and read the data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please share with usyour testcase (MIX.f90 or some small reproducer) to analyze your problem?
Could you please share with usyour testcase (MIX.f90 or some small reproducer) to analyze your problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not clear from the example where i is used? Probably, there is a typo. Or you ment solving the same sytem 50 times?
And one more question - how do you know the result is not correct?
And one more question - how do you know the result is not correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for your help.
At first, I put these functions into the DO statement, which may be a bad habit.
Now, I put dgetrf and dgetfs into a function and when I use them, I will load the function I write.
This method works well and the result is correct.
I use R software, which is famous in statistics computing, to test the result.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PS: the ILP interface works well.
Thank you very much.
Shawn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Shawn, does that mean there are no problems with big input data you originally indicated?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I don't use the ILP interface, there are some problems about the output,such as nagetive value of a variable which is positive as it is the variance of a sample.But it is OK after using the ILP interface.
Thank you for your help.
Shawn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Shawn, I don't know methods how we can check the problem based on this description. as already Victor suggested - would you please give us the testcase for investigation the problem on our side?
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,Gennady,
I will give a description briefly.
At first ,I need to calculate the inverse of a matrix in DO statements just like below:
do k=1,km
do j=1,jm
mtemp0 = tsigma
ivm1 = i8
call dgetrf( 8, 8, mtemp0, 8,ipiv1,info1)
call dgetrs( trans,8,8, mtemp0, 8, ipiv1,ivm1,8,info2)
if(info1 /= 0 .OR. info2 /= 0) then
write(*,*) "Sigular Matrix in IVM1."
end if
mtemp1 = sigma + ivm1
ivm2 = i8
call dgetrf( 8, 8, mtemp1, 8,ipiv2,info3)
call dgetrs( trans,8,8, mtemp1, 8, ipiv2,ivm2,8,info4)
if(info3 /= 0 .OR. info4 /= 0) then
write(*,*) "Sigular Matrix in IVM2."
end if
do i=1,im
! some statements in it
end do
end do
end do
########################################
I used ILP interface to compile and link the code, however, it got some error results.
Then I modified the code, putting dgetrf and dgetrs into a function.
The function code list below(I put the function into a module):
#######################################
function inv(n,m)
integer n,ipiv(n),info1,info2
real(kind = 8) :: m(n,n),temp(n,n),inv(n,n)
call dgetrf( n, n, m, n,ipiv,info1)
temp = i8
call dgetrs(trans, n, n, m,n, ipiv,temp,n,info2)
if(info1 /= 0 .AND. info2 /=0) then
write(*,*) "Sigular matrix in sigma!!"
end if
inv = temp
end function inv
########################################
PS: i8 is anidentity matrix of dimension 8*8
At last I changed the code in the DO statments:
##################################################
do k=1,km
do j=1,jm
ivm1 = inv(8,tsigma)
mtemp1 = sigma + ivm1
vb = inv(8,mtemp1)
....
....
do i=1,im
! some statements in it
end do
end do
end do
###############################
My compile and link statements are on the #4
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