Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-18-2012
09:49 PM

128 Views

Memory question.

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

barragan_villanueva_

Valued Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-18-2012
11:56 PM

128 Views

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....

Nadezhda_M_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
12:52 AM

128 Views

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.

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
05:44 AM

128 Views

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

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
05:47 AM

128 Views

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

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
05:57 AM

128 Views

You mean like this:

real, allocatable :: DataName(:,:,:).

and read the data.

barragan_villanueva_

Valued Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
06:04 AM

128 Views

Could you please share with usyour testcase (MIX.f90 or some small reproducer) to analyze your problem?

Victor_K_Intel1

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
06:08 AM

128 Views

And one more question - how do you know the result is not correct?

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
06:37 PM

128 Views

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.

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
06:39 PM

128 Views

PS: the ILP interface works well.

Thank you very much.

Shawn

Gennady_F_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-19-2012
07:56 PM

128 Views

Shawn, does that mean there are no problems with big input data you originally indicated?

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-21-2012
10:14 PM

128 Views

Thank you for your help.

Shawn

Gennady_F_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-21-2012
10:27 PM

128 Views

--Gennady

shawnstat

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-25-2012
09:45 PM

128 Views

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

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

For more complete information about compiler optimizations, see our Optimization Notice.