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

The following code that calls sgels returns different answers depending on whether I link with mkl 18.5 or 19.5. Also mkl 18.5 seems return different results depending on different machines.

My link command :

/opt/intel/19/bin/ifort reproduce.f90 -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_intel_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -liomp5 -lpthread -lm -ldl -I${MKLROOT}/include

```
program reproduce
implicit none
integer :: row_A, col_A, row_B, col_B, info
integer :: i
real, allocatable :: A(:,:), B(:,:), work(:,:)
! allocate input matrices
row_A = 2
col_A = 2
row_B = 2
col_B = 1
allocate(A(row_A,col_A))
allocate(B(row_B,col_B))
allocate(work(row_A*row_B,col_A*col_B))
A = 1
B = 1490.890
! sgels
call sgels('N', size(A,1), size(A,2), size(B,2), A, size(A,1), B, &
size(B,1), work, size(work), info)
! check
write(*,*) '--> A matrix'
do i = 1, ubound(A, 1)
write(*,*) A(i, :)
end do
write(*,*) '--> B matrix'
do i = 1, ubound(B, 1)
write(*,*) B(i, :)
end do
write(*,*) '--> Info'
write(*,*) info
deallocate(A, B, work)
end program
```

**Output for mkl 19 on skylake (Intel(R) Xeon(R) W-2145 CPU @ 3.70GHz)**

--> A matrix

-1.414214 -1.414214

0.4142135 0.0000000E+00

--> B matrix

-2108.437

8.2589657E-05

--> Info

2

**Output for mkl 18 on skylake (Intel(R) Xeon(R) W-2145 CPU @ 3.70GHz)**

--> A matrix

-1.414214 -1.414214

0.4142135 1.9078982E-08

--> B matrix

-2837.939

4328.829

--> Info

0

**Output for mkl 18 on sandybridge ( Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz)**

--> A matrix

-1.414214 -1.414214

0.4142135 0.0000000E+00

--> B matrix

-2108.437

1.2207031E-04

--> Info

2

Link Copied

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

The MKL documentation for ?gels says, "It is assumed that `A`` has full rank". Your matrix is of size 2 X 2 but its rank is only 1, so the input to the routine is improper. In such cases, what is the point of comparing the output, which could well be meaningless?`

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