Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6985 Discussions

cannot call SASUM without fortran 'call' hence cannot load a return from it

Broglie
Beginner
700 Views

Not sure i'm linked to mkl however I am linked to Lapack and Blas in 'project properties' - Linker compile line I have liblapack and libblas , and if I use fortran 90's 'call' as in call SASUM it compiles but I cannot get the return from it , I also solved a system 3 equates in 3 vars call sgesv() and that works but I want to step through the lapack functions one by one and learn them , however I cannot call SASUM() on a vector without the fortran 'call' and so I cannot get it's return!  

0 Kudos
6 Replies
Broglie
Beginner
649 Views

Sorry here is my code, happy if anyone helps

 

 
      !INCLUDE C:/Blas_Lapack/libblas.lib
    !include "mkl_omp_offload.f90"
     !INCLUDE mkl.fi, blas.f90
    !  include mkl.fi
 
    
      PROGRAM EXA_1
      
      
      
      USE iso_fortran_env, only:real64
     
      !USE ! example.f90
! Example program that solves the matrix equation AX = B using LAPACK.
 
  ! =================================================
! solving the matrix equation A*x=b using LAPACK
! =================================================
 
      
  IMPLICIT NONE  !(type, external)
    !  INTRINSIC MOD
   ! USE liblapack
     
   ! =================================================
   ! declarations, notice single precision
   ! =================================================
  REAL :: A(3,3), b(3)
      !REAL(kind=kind(1.d0)), EXTERNAL::SASUM
      !REAL(kind=kind(1.d0)), EXTERNAL::SGESV
      INTEGER :: C(1:12),N 
  INTEGER ::  i, j, pivot(3), ok
      INTEGER(8) X, XX, XXX
      INTEGER(8) Y,YY, YYY
      INTEGER(8) Z, ZZ, ZZZ
      INTEGER(8) ANSWER1,ANSWER2,ANSWER3
      INTEGER(8) D,E
      
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  !  receive user input
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    write (*,*) "Solves 3 by 3 system, assuming varibles 'X' 'Y' 'Z' enter coefficient for X in 1st equation"
    read (*,*) X
    write (*,*) "enter coefficient for Y in 1st equation"  
    read (*,*) Y
    write (*,*) "enter coefficient for Z in 1st equation"
    read (*,*) Z
    write (*,*) "enter coefficient for X in 2nd equation"
    read (*,*) XX
    write (*,*) "enter coefficient for Y in 2nd equation"
    read (*,*) YY
    write (*,*) "enter coefficient for Z in 2nd equation"
    read (*,*) ZZ
    write (*,*) "enter coefficient for X in 3rd equation"
    read (*,*) XXX
    write (*,*) "enter coefficient for Y in 3rd equation"
    read (*,*) YYY
    write (*,*) "enter coefficient for Z in 3rd equation"
    read (*,*) ZZZ
    write (*,*) "enter answer of 1st equation"
    read (*,*) ANSWER1
    write (*,*) "enter answer of 2nd equation"
    read (*,*) ANSWER2 
    write (*,*) "enter answer of 3rd equation"
    read (*,*) ANSWER3
    
   ! =================================================
   ! define matrix A
   ! =================================================
  A(1,1)=X; A(1,2)=Y; A(1,3)=Z
  A(2,1)=XX; A(2,2)=YY; A(2,3)=ZZ
  A(3,1)=XXX; A(3,2)=YYY; A(3,3)=ZZZ
 
   ! =================================================
   ! define vector b, make b a matrix and you can solve multiple
   ! equations with the same A but different b
   ! =================================================
  b(1)=ANSWER1; b(2)=ANSWER2; b(3)=ANSWER3
 
      write (*,*) "this is A before 'segesv'"
      print*, A
      write (*,*) "b was loaded with answers to equations"
      print*, b
   ! =================================================
   ! find the solution using the LAPACK routine SGESV
   ! =================================================
  call SGESV(3, 1, A, 3, pivot, b, 3, ok)
   ! =================================================
   !
   ! parameters in the order as they appear in the function call:
   !    - 3= order of matrix A, 
   !    - 1= number of right hand sides (b)
   !    - A= matrix A,
   !    - 3= leading dimension of A
   !    - pivot= array that records pivoting, 
   !    - b= result vector b on entry, solution x on exit, 
   !    - 3= leading dimension of b
   !    - ok= return value
   ! =================================================
 
   ! =================================================
   ! print the solution vector 
   ! =================================================
      
     write (*,*) "after 'sgesv' A is now inverted"
      print *, A
     write(*,*) "b is now loaded with the solutions to X,Y and Z"
  print *, b
     write (*,*) "X=",b(1)
     write (*,*) "Y=",b(2) 
      write(*,*) "Z=",b(3)
      
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      !C(1:12)=1 2 3 4 5 6 7 8 9 10 11 12
      C(1)=1
      C(2)=-2
      C(3)=0
      C(4)=-4
      C(5)=5
      C(6)=0
      C(7)=7
      C(8)=-8
      C(9)=0
      C(10)=-10
      C(11)=11
      C(12)=0
      N=1
    FORALL (I=1:N) A(I, I) = 1
    write(*,*) "C=", C
    E=1
    
    write(*,*) "SASUM="
   ! E=SASUM(4,C,2)
    write(*,*) "C after SASUM"
    write(*,*) C
    write(*,*) "E after SASUM"
    write(*,*) E
      
!have yet to figure out reshape for a 3X3
 
 !implicit none (type, external)
 !external :: sgesv
 !real     :: a(3, 3)  ! Matrix A.
 !real     :: b(3)     ! Vector b/x.
 !real     :: pivot(3) ! Pivot indices (list of swap operations).
 !integer  :: rc       ! Return code.
 !
 !a = reshape([ 2., 3., 1., 1. ], [ 2, 2 ])
 !b = [ 5., 6. ]
 !
 !call sgesv(2, 1, a, 2, pivot, b, 2, rc)
 !
 !if (rc /= 0) then
 !    print '(a, i0)', 'Error: ', rc
 !    stop
 !end if
 !
 !print '("Solution (x1, x2): ", f0.4, ", ", f0.4)', b
      
      
      
 
      !use onemkl_blas_omp_offload_lp64
     ! use mkl_blas.fi
 
         
   
      
      
      !IMPLICIT NONE
      !INTEGER, PARAMETER :: N=100
      !REAL, DIMENSION (N) :: XRAY,Y1RAY,Y2RAY
      !REAL, PARAMETER :: PI=3.1415926
      !REAL :: FPI,STEP,X
      !INTEGER::I,IC
      ! !external :: sgesv
      !real     :: a(2, 2)  ! Matrix A.
      !real     :: b(2)     ! Vector b/x.
      !real     :: pivot(2) ! Pivot indices (list of swap operations).
      !integer  :: rc       ! Return code.
      !
      !
      !FPI=PI/180.
      !STEP=360./(N-1)
      !
      !DO I=1,N
      !  XRAY(I)=(I-1)*STEP
      !  X=XRAY(I)*FPI
      !  Y1RAY(I)=SIN(X)
      !  Y2RAY(I)=COS(X)
      !END DO
      !
      !write (*,*) X
      !
      !CALL METAFL('CONS')  !evidently only the disifl libs are fortran
      !CALL DISINI()
      !CALL PAGERA()
      !CALL COMPLX()
      !CALL AXSPOS(450,1800)
      !CALL AXSLEN(2200,1200)
      !
      !CALL NAME('X-axis','X')
      !CALL NAME('Y-axis','Y')
      !
      !CALL LABDIG(-1,'X')
      !CALL TICKS(10,'XY')
      !
      !CALL TITLIN('Demonstration of CURVE',1)
      !CALL TITLIN('SIN(X), COS(X)',3)
      !
      !IC=INTRGB(0.95,0.95,0.95)
      !CALL AXSBGD(IC)
      !
      !CALL GRAF(0.,360.,0.,90.,-1.,1.,-1.,0.5)
      !CALL SETRGB(0.7,0.7,0.7)
      !CALL GRID(1,1)
      !
      !CALL COLOR('FORE')
      !CALL TITLE()
      !
      !CALL COLOR('RED')
      !CALL CURVE(XRAY,Y1RAY,N)
      !CALL COLOR('GREEN')
      !CALL CURVE(XRAY,Y2RAY,N)
      !CALL DISFIN()
      !CALL F07AAF()
   
 
  
     
 
      END PROGRAM EXA_1

 

 

 

DISLIN worked not involved here i just commented it out, other lines commented out are attempts I made to call SASUM without Fortran 'Call' so I could receive a return from it

0 Kudos
VarshaS_Intel
Moderator
595 Views

Hi,

 

Thanks for posting in Intel Communities.

 

Could you please find the sample example code for sasumx.f in the following path for Linux(/opt/intel/oneapi/mkl/latest/examples/examples_core_f.tgz) and Windows(C:\Users\svarshax\OneDrive - Intel Corporation\Desktop\MKL EXAMPLES\f\blas\)

Please extract the files and another folder as this path has only readable access.

 

Please find the below commands for compiling and running the codes:

ifx common_func.f sasumx.f -qmkl
./a.out < ../data/sasumx.d

For more details, please find the below screenshot:

VarshaS_Intel_0-1697436581210.png

Also, please find the below reference for the function sasumx.f:

https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2023-2/asum.html

 

Could you please let us know the OS details, and MKL version you are using? Also, could you please let us know the input data you are using as well as the expected results you need?

 

Thanks & Regards,

Varsha

 

0 Kudos
Broglie
Beginner
540 Views

Varsha , tried changed the vector C to REAL , it holds the numbers 1-12; loaded INTEGER N with 12 INTEGER incx with 1 and called

E=SASUM(N,C,incx) to no avail it will not compile here's the compiler error: "error #6404: This name does not have a type, and must have an explicit type. [SASUM]" 

can still compile though with call SASUM(N,C,incx)

My Intel version number I got from 'tools >options' 

IFORT
Intel® Fortran Compiler Classic 2021.10.0 [IA-32]

Intel® Fortran Compiler Classic for applications running on IA-32, version 2021.10.0 Package ID: w_oneAPI_2023.2.1.17


IFX
Intel® Fortran Compiler 2023.2.1 [Intel(R) 64]

Intel® Fortran Compiler for applications running on Intel(R) 64, version 2023.2.1 Package ID: w_oneAPI_2023.2.1.17

 

I think I'm using IFORT

segsv still solves the system of equations alright nothing wrong there

sorry about all the lines commented out!

Here is my code That would not compile:

    !INCLUDE C:/Blas_Lapack/libblas.lib
    !include "mkl_omp_offload.f90"
     !INCLUDE mkl.fi, blas.f90
    !  include mkl.fi
 
    
      PROGRAM EXA_1
      
      
      
      !USE iso_fortran_env, only:real64
     
      !USE ! example.f90
! Example program that solves the matrix equation AX = B using LAPACK.
 
  ! =================================================
! solving the matrix equation A*x=b using LAPACK
! =================================================
 
      
  IMPLICIT NONE  !(type, external)
    !  INTRINSIC MOD
   ! USE liblapack
     
   ! =================================================
   ! declarations, notice single precision
   ! =================================================
  REAL :: A(3,3), b(3)
      !REAL(kind=kind(1.d0)), EXTERNAL::SASUM
      !REAL(kind=kind(1.d0)), EXTERNAL::SGESV
      REAL :: C(1:12),N 
  INTEGER ::  i, j, pivot(3), ok
      INTEGER(8) X, XX, XXX
      INTEGER(8) Y,YY, YYY
      INTEGER(8) Z, ZZ, ZZZ
      INTEGER(8) ANSWER1,ANSWER2,ANSWER3
      INTEGER(8) D,E
      INTEGER incx
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  !  receive user input
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    write (*,*) "Solves 3 by 3 system, assuming varibles 'X' 'Y' 'Z' enter coefficient for X in 1st equation"
    read (*,*) X
    write (*,*) "enter coefficient for Y in 1st equation"  
    read (*,*) Y
    write (*,*) "enter coefficient for Z in 1st equation"
    read (*,*) Z
    write (*,*) "enter coefficient for X in 2nd equation"
    read (*,*) XX
    write (*,*) "enter coefficient for Y in 2nd equation"
    read (*,*) YY
    write (*,*) "enter coefficient for Z in 2nd equation"
    read (*,*) ZZ
    write (*,*) "enter coefficient for X in 3rd equation"
    read (*,*) XXX
    write (*,*) "enter coefficient for Y in 3rd equation"
    read (*,*) YYY
    write (*,*) "enter coefficient for Z in 3rd equation"
    read (*,*) ZZZ
    write (*,*) "enter answer of 1st equation"
    read (*,*) ANSWER1
    write (*,*) "enter answer of 2nd equation"
    read (*,*) ANSWER2 
    write (*,*) "enter answer of 3rd equation"
    read (*,*) ANSWER3
    
   ! =================================================
   ! define matrix A
   ! =================================================
  A(1,1)=X; A(1,2)=Y; A(1,3)=Z
  A(2,1)=XX; A(2,2)=YY; A(2,3)=ZZ
  A(3,1)=XXX; A(3,2)=YYY; A(3,3)=ZZZ
 
   ! =================================================
   ! define vector b, make b a matrix and you can solve multiple
   ! equations with the same A but different b
   ! =================================================
  b(1)=ANSWER1; b(2)=ANSWER2; b(3)=ANSWER3
 
      write (*,*) "this is A before 'segesv'"
      print*, A
      write (*,*) "b was loaded with answers to equations"
      print*, b
   ! =================================================
   ! find the solution using the LAPACK routine SGESV
   ! =================================================
  call SGESV(3, 1, A, 3, pivot, b, 3, ok)
   ! =================================================
   !
   ! parameters in the order as they appear in the function call:
   !    - 3= order of matrix A, 
   !    - 1= number of right hand sides (b)
   !    - A= matrix A,
   !    - 3= leading dimension of A
   !    - pivot= array that records pivoting, 
   !    - b= result vector b on entry, solution x on exit, 
   !    - 3= leading dimension of b
   !    - ok= return value
   ! =================================================
 
   ! =================================================
   ! print the solution vector 
   ! =================================================
      
     write (*,*) "after 'sgesv' A is now inverted"
      print *, A
     write(*,*) "b is now loaded with the solutions to X,Y and Z"
  print *, b
     write (*,*) "X=",b(1)
     write (*,*) "Y=",b(2) 
      write(*,*) "Z=",b(3)
      
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      !C(1:12)=1 2 3 4 5 6 7 8 9 10 11 12
      C(1)=1
      C(2)=-2
      C(3)=0
      C(4)=-4
      C(5)=5
      C(6)=0
      C(7)=7
      C(8)=-8
      C(9)=0
      C(10)=-10
      C(11)=11
      C(12)=0
      N=12
   ! FORALL (I=1:N) A(I, I) = 1
    write(*,*) "C=", C
    E=1
    incx=1
    write(*,*) "SASUM="
   E=SASUM(N,C,incx)
    write(*,*) "C after SASUM"
    write(*,*) C
    write(*,*) "E after SASUM"
    write(*,*) E
      
!have yet to figure out reshape for a 3X3
 
 !implicit none (type, external)
 !external :: sgesv
 !real     :: a(3, 3)  ! Matrix A.
 !real     :: b(3)     ! Vector b/x.
 !real     :: pivot(3) ! Pivot indices (list of swap operations).
 !integer  :: rc       ! Return code.
 !
 !a = reshape([ 2., 3., 1., 1. ], [ 2, 2 ])
 !b = [ 5., 6. ]
 !
 !call sgesv(2, 1, a, 2, pivot, b, 2, rc)
 !
 !if (rc /= 0) then
 !    print '(a, i0)', 'Error: ', rc
 !    stop
 !end if
 !
 !print '("Solution (x1, x2): ", f0.4, ", ", f0.4)', b
      
      
      
 
      !use onemkl_blas_omp_offload_lp64
     ! use mkl_blas.fi
 
         
   
      
      
      !IMPLICIT NONE
      !INTEGER, PARAMETER :: N=100
      !REAL, DIMENSION (N) :: XRAY,Y1RAY,Y2RAY
      !REAL, PARAMETER :: PI=3.1415926
      !REAL :: FPI,STEP,X
      !INTEGER::I,IC
      ! !external :: sgesv
      !real     :: a(2, 2)  ! Matrix A.
      !real     :: b(2)     ! Vector b/x.
      !real     :: pivot(2) ! Pivot indices (list of swap operations).
      !integer  :: rc       ! Return code.
      !
      !
      !FPI=PI/180.
      !STEP=360./(N-1)
      !
      !DO I=1,N
      !  XRAY(I)=(I-1)*STEP
      !  X=XRAY(I)*FPI
      !  Y1RAY(I)=SIN(X)
      !  Y2RAY(I)=COS(X)
      !END DO
      !
      !write (*,*) X
      !
      !CALL METAFL('CONS')  !evidently only the disifl libs are fortran
      !CALL DISINI()
      !CALL PAGERA()
      !CALL COMPLX()
      !CALL AXSPOS(450,1800)
      !CALL AXSLEN(2200,1200)
      !
      !CALL NAME('X-axis','X')
      !CALL NAME('Y-axis','Y')
      !
      !CALL LABDIG(-1,'X')
      !CALL TICKS(10,'XY')
      !
      !CALL TITLIN('Demonstration of CURVE',1)
      !CALL TITLIN('SIN(X), COS(X)',3)
      !
      !IC=INTRGB(0.95,0.95,0.95)
      !CALL AXSBGD(IC)
      !
      !CALL GRAF(0.,360.,0.,90.,-1.,1.,-1.,0.5)
      !CALL SETRGB(0.7,0.7,0.7)
      !CALL GRID(1,1)
      !
      !CALL COLOR('FORE')
      !CALL TITLE()
      !
      !CALL COLOR('RED')
      !CALL CURVE(XRAY,Y1RAY,N)
      !CALL COLOR('GREEN')
      !CALL CURVE(XRAY,Y2RAY,N)
      !CALL DISFIN()
      !CALL F07AAF()
   
 
  
     
 
      END PROGRAM EXA_1

 

0 Kudos
Broglie
Beginner
551 Views

Thanks a lot Varsha , haven't tried anything yet but for the first time I see the parameters to SASUM include number of locations in the vector, coming from C++ that made sense, but I had no idea where to put it , Let try this and I'll get back

0 Kudos
Broglie
Beginner
513 Views

Thanks a lot Varsha for the website referrals, I solved the problem, must have been these changes most of them I am sure about;

declared sasum REAL because the compiler was saying 'sasum' has no explicit type so I added REAL :: sasum, I am attempting to follow the ESSEL manual ( from NAG I think) they state that 'N' which is the size or number locations in vector C, should be type INTEGER, however I found that REAL(8) worked as well, the vector C of course is REAL and 'incx' which is the stride or the concatenation of numbers you want sasum to add (it adds all of the absolute values of numbers in the vector) should be INTEGER so I made it INTEGER incx . The example I follow is also from the ESSEL manual, they load a vector with seven signed integers they could be floats as well: {1,-3,-6,7,5,2,-4} and ofcourse the negatives are added as positives (absolute values) so the return from sasum into E is 28.

  Following I show the output and then the code with changes: 

 

        OUTPUT:

 

  C= 1.000000 -3.000000 -6.000000 7.000000 5.000000
2.000000 -4.000000
C after SASUM
1.000000 -3.000000 -6.000000 7.000000 5.000000
2.000000 -4.000000
E after SASUM
28.0000000000000

 

CODE:

 

    !INCLUDE C:/Blas_Lapack/libblas.lib
    !include "mkl_omp_offload.f90"
    ! INCLUDE Source2.f90
    !  include mkl.fi
 
    
      PROGRAM EXA_1
      
     
     ! USE blas_d
     !USE blas_dense
    
      !USE iso_fortran_env, only:real64
     
      !USE ! example.f90
! Example program that solves the matrix equation AX = B using LAPACK.
 
  ! =================================================
! solving the matrix equation A*x=b using LAPACK
! =================================================
 
      
  IMPLICIT NONE  !(type, external)
   ! INTRINSIC MOD
   ! USE liblapack
    
   ! =================================================
   ! declarations, notice single precision
   ! =================================================
  REAL :: A(3,3), b(3)
      REAL::sasum  !(REAL::N,REAL::C(1:12),INTEGER::incx)
      REAL :: C(1:7)
      REAL SUMM
      !REAL(kind=kind(1.d0)), EXTERNAL::SASUM
      !REAL(kind=kind(1.d0)), EXTERNAL::SGESV
      REAL(8) ::E
  INTEGER ::  N,  i, j, pivot(3), ok
      INTEGER(8) X, XX, XXX
      INTEGER(8) Y,YY, YYY
      INTEGER(8) Z, ZZ, ZZZ
      INTEGER(8) ANSWER1,ANSWER2,ANSWER3
      INTEGER(8) D
      INTEGER incx
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  !  receive user input
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! write (*,*) "Solves 3 by 3 system, assuming varibles 'X' 'Y' 'Z' enter coefficient for X in 1st equation"
   ! read (*,*) X
   ! write (*,*) "enter coefficient for Y in 1st equation"  
   ! read (*,*) Y
   ! write (*,*) "enter coefficient for Z in 1st equation"
   ! read (*,*) Z
   ! write (*,*) "enter coefficient for X in 2nd equation"
   ! read (*,*) XX
   ! write (*,*) "enter coefficient for Y in 2nd equation"
   ! read (*,*) YY
   ! write (*,*) "enter coefficient for Z in 2nd equation"
   ! read (*,*) ZZ
   ! write (*,*) "enter coefficient for X in 3rd equation"
   ! read (*,*) XXX
   ! write (*,*) "enter coefficient for Y in 3rd equation"
   ! read (*,*) YYY
   ! write (*,*) "enter coefficient for Z in 3rd equation"
   ! read (*,*) ZZZ
   ! write (*,*) "enter answer of 1st equation"
   ! read (*,*) ANSWER1
   ! write (*,*) "enter answer of 2nd equation"
   ! read (*,*) ANSWER2 
   ! write (*,*) "enter answer of 3rd equation"
   ! read (*,*) ANSWER3
   ! 
   !! =================================================
   !! define matrix A
   !! =================================================
  !A(1,1)=X; A(1,2)=Y; A(1,3)=Z
  !A(2,1)=XX; A(2,2)=YY; A(2,3)=ZZ
  !A(3,1)=XXX; A(3,2)=YYY; A(3,3)=ZZZ
   !
   !! =================================================
   !! define vector b, make b a matrix and you can solve multiple
   !! equations with the same A but different b
   !! =================================================
  !b(1)=ANSWER1; b(2)=ANSWER2; b(3)=ANSWER3
   !
   !   write (*,*) "this is A before 'segesv'"
   !   print*, A
   !   write (*,*) "b was loaded with answers to equations"
   !   print*, b
   !! =================================================
   !! find the solution using the LAPACK routine SGESV
   !! =================================================
  !call SGESV(3, 1, A, 3, pivot, b, 3, ok)
   !! =================================================
   !!
   !! parameters in the order as they appear in the function call:
   !!    - 3= order of matrix A, 
   !!    - 1= number of right hand sides (b)
   !!    - A= matrix A,
   !!    - 3= leading dimension of A
   !!    - pivot= array that records pivoting, 
   !!    - b= result vector b on entry, solution x on exit, 
   !!    - 3= leading dimension of b
   !!    - ok= return value
   !! =================================================
   !
   !! =================================================
   !! print the solution vector 
   !! =================================================
   !   
   !  write (*,*) "after 'sgesv' A is now inverted"
   !   print *, A
   !  write(*,*) "b is now loaded with the solutions to X,Y and Z"
  !print *, b
   !  write (*,*) "X=",b(1)
   !  write (*,*) "Y=",b(2) 
   !   write(*,*) "Z=",b(3)
      
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      !X=(1.0, -3.0, -6.0, 7.0, 5.0, 2.0, -4.0)
      !C(1:12)=1 2 3 4 5 6 7 8 9 10 11 12
      C(1)=1
      C(2)=-3
      C(3)=-6
      C(4)=7
      C(5)=5
      C(6)=2
      C(7)=-4
      !C(8)=-8
      !C(9)=0
      !C(10)=-10
      !C(11)=11
      !C(12)=0
      N=7
   ! FORALL (I=1:N) A(I, I) = 1
    
    write(*,*) "C=", C
    E=0.0
    incx=1.0
   ! write(*,*) "SASUM="
    E=sasum(N,C,incx)  !SOMETHING IS WRONG WITH VARIABLES N OR incx
    write(*,*) "C after SASUM"
    write(*,*) C
    write(*,*) "E after SASUM"
    write(*,*) E
      
!have yet to figure out reshape for a 3X3
 
 !implicit none (type, external)
 !external :: sgesv
 !real     :: a(3, 3)  ! Matrix A.
 !real     :: b(3)     ! Vector b/x.
 !real     :: pivot(3) ! Pivot indices (list of swap operations).
 !integer  :: rc       ! Return code.
 !
 !a = reshape([ 2., 3., 1., 1. ], [ 2, 2 ])
 !b = [ 5., 6. ]
 !
 !call sgesv(2, 1, a, 2, pivot, b, 2, rc)
 !
 !if (rc /= 0) then
 !    print '(a, i0)', 'Error: ', rc
 !    stop
 !end if
 !
 !print '("Solution (x1, x2): ", f0.4, ", ", f0.4)', b
      
      
      
 
      !use onemkl_blas_omp_offload_lp64
     ! use mkl_blas.fi
 
         
   
      
      
      !IMPLICIT NONE
      !INTEGER, PARAMETER :: N=100
      !REAL, DIMENSION (N) :: XRAY,Y1RAY,Y2RAY
      !REAL, PARAMETER :: PI=3.1415926
      !REAL :: FPI,STEP,X
      !INTEGER::I,IC
      ! !external :: sgesv
      !real     :: a(2, 2)  ! Matrix A.
      !real     :: b(2)     ! Vector b/x.
      !real     :: pivot(2) ! Pivot indices (list of swap operations).
      !integer  :: rc       ! Return code.
      !
      !
      !FPI=PI/180.
      !STEP=360./(N-1)
      !
      !DO I=1,N
      !  XRAY(I)=(I-1)*STEP
      !  X=XRAY(I)*FPI
      !  Y1RAY(I)=SIN(X)
      !  Y2RAY(I)=COS(X)
      !END DO
      !
      !write (*,*) X
      !
      !CALL METAFL('CONS')  !evidently only the disifl libs are fortran
      !CALL DISINI()
      !CALL PAGERA()
      !CALL COMPLX()
      !CALL AXSPOS(450,1800)
      !CALL AXSLEN(2200,1200)
      !
      !CALL NAME('X-axis','X')
      !CALL NAME('Y-axis','Y')
      !
      !CALL LABDIG(-1,'X')
      !CALL TICKS(10,'XY')
      !
      !CALL TITLIN('Demonstration of CURVE',1)
      !CALL TITLIN('SIN(X), COS(X)',3)
      !
      !IC=INTRGB(0.95,0.95,0.95)
      !CALL AXSBGD(IC)
      !
      !CALL GRAF(0.,360.,0.,90.,-1.,1.,-1.,0.5)
      !CALL SETRGB(0.7,0.7,0.7)
      !CALL GRID(1,1)
      !
      !CALL COLOR('FORE')
      !CALL TITLE()
      !
      !CALL COLOR('RED')
      !CALL CURVE(XRAY,Y1RAY,N)
      !CALL COLOR('GREEN')
      !CALL CURVE(XRAY,Y2RAY,N)
      !CALL DISFIN()
      !CALL F07AAF()
   
 
  
     
 
      END PROGRAM EXA_1

 

0 Kudos
VarshaS_Intel
Moderator
454 Views

Hi,


>>Thanks a lot Varsha for the website referrals, I solved the problem, must have been these changes.


Thanks for sharing the complete code with us. It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.


Have a Good Day!


Thanks and Regards,

Varsha





0 Kudos
Reply