Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all 5691 articles
Browse latest View live

openmp setup

$
0
0

Dears colleagues,
I´m having some problems with an OpenMP test program. The running time remains the same for any number of threads. My test code is:

PROGRAM openmp
!$ USE OMP_LIB
IMPLICIT NONE
INTEGER*4 :: i, num_threads
REAL*8 :: start_time
REAL*8 :: end_time
INTEGER*4, ALLOCATABLE, DIMENSION (:) :: m
ALLOCATE ( m (1000000000) )
m = 0
i = 0
DO num_threads = 1,8
CALL OMP_SET_NUM_THREADS ( num_threads )
start_time = OMP_GET_WTIME()
!$OMP PARALLEL DO
DO i = 1, 1000000000
m(i) = m(i) + 1
ENDDO
!$OMP END PARALLEL DO
end_time = OMP_GET_WTIME()
WRITE ( *, 50 ) num_threads, end_time - start_time
ENDDO
50 FORMAT ( ' Threads=', I2, '. Time ', F12.8,' seconds.' )
END PROGRAM openmp

OUTPUT:

Threads= 1. Time 0.44233354 seconds.
Threads= 2. Time 0.41301712 seconds.
Threads= 3. Time 0.38321273 seconds.
Threads= 4. Time 0.40626812 seconds.
Threads= 5. Time 0.40601481 seconds.
Threads= 6. Time 0.39871999 seconds.
Threads= 7. Time 0.70736344 seconds.
Threads= 8. Time 0.40052118 seconds.

Compilation options:
- Release x64,
- Fortran -> Preprocessor -> OpenMP Conditional Compilation -> Yes
- Fortran -> Language -> Process OpenMP Directives -> Generate Parallel Code (/Qopnmp)

Hadware: I7-3632QM
SO - Windows10

I appreciate any help.
Thanks in advance.


Error message when installing IMSL add-on

$
0
0

After I bought and downloaded the IMSL Fortran add-on (Rogue Wave IMSL Fortran Numerical Libraries 7.0 for Windows* OS - Named-user Commercial) Manuf Part #:  RFL999WLGE01X1Z     , I tried to install the libraries. I got the following error message: "Activation rigths do not allow this software to be installed. This could be due to expire subsciption or incompatible number."  The Fortran compiler is Composer XE 2013 Sp1 and used in Visual Studio 2012.

Any suggestion is highly appreciated.

 

strange crash

$
0
0

Hi,

We have a strange problem with a fortran DLL crashing within our application that we cannot identify. Of most concern is that a second recompile of the exact same code in the exact same environment has resolved the crash. We are using the Intel Fortran Compiler 15.0.0107.12 in Visual Studio 2013 Update 4 (12.0.31101.00).

In an include file we have:

structure /my_GUID/
  integer*4 data1
  integer*2 data2
  integer*2 data3
  character(8) data4
end structure
record /my_GUID/my_id
COMMON /NEW_INPUT/my_id

In a fortran file we have the following code:

my_id.data1 = 0
my_id.data2 = 0
my_id.data3 = 0
write(my_id.data4,'(8a1)') (char(0),i=1,8)

The 'write' call throws an access violation exception.

What could possibly cause inconsistent results from one compile to the next in our fortran code? Our QA team do not know what to expect with each release when we have stable code randomly causing crashes.

Cannot invert a matrix with IMSL routine LINDS

$
0
0

I am trying to use a standard IMSL routine LINDS to invert a positive definite matrix,. 

I installed the IMSL library based on these instructions. 

https://software.intel.com/en-us/articles/installing-and-using-the-imsl-...

 

Then I included the lines 

INCLUDE 'link_fnl_shared.h'

use linds_int

in my program, before setting up the matrix to be inverted

The program compiles without error, but when I debug it it, it exits without inverting the matrix. It  does not trigger a break  point, but it just stops. 

Any help will be greatly appreciated. Thank you very much

 

error #6413

$
0
0

In coding for a gui application (not qwin) I've run into a slight problem with compiling a subroutine.

1>------ Build started: Project: Pearson, Configuration: Debug x64 ------
1>Compiling with Intel(R) Visual Fortran Compiler 16.0 [Intel(R) 64]...
1>DoGrids.f90
1>C:\Users\Brooks\Desktop\Projects\Pearson\Pearson\DoGrids.f90(26): error #6413: This global name is invalid in this context.   [SETWINDOWORG]
1>C:\Users\Brooks\Desktop\Projects\Pearson\Pearson\DoGrids.f90(37): error #6413: This global name is invalid in this context.   [SETWINDOWEX]
1>C:\Users\Brooks\Desktop\Projects\Pearson\Pearson\DoGrids.f90(48): error #6413: This global name is invalid in this context.   [SETVIEWPORTEX]
1>compilation aborted for C:\Users\Brooks\Desktop\Projects\Pearson\Pearson\DoGrids.f90 (code 1)

These three routines are needed. There is no use that I've found so I created 3 interfaces that I designed using msdn as a guide. They are:

 

interface
   function SetWindowOrg(hdc, x, y, pt)
use ifwinty
   integer(BOOL),intent(out):: SetWindowOrg
   !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'SetWindowOrg' :: SetWindowOrg
   integer(HANDLE),Intent(in):: hdc
   integer(4),Intent(in):: x, y
   !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: pt
   type(T_POINT),Intent(out):: pt
   end function setWindowOrg
end interface
interface
   function SetWindowEx(hdc, x, y, pt)
use ifwinty
   integer(BOOL),intent(out):: SetWindowEx
   !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'SetWindowEx' :: SetWindowEx
   integer(HANDLE),Intent(in):: hdc
   integer(4),Intent(in):: x, y
   !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: pt
   type(T_POINT),Intent(out):: pt
   end function setWindowEx
end interface
interface
   function SetViewportEx(hdc, x, y, pt)
use ifwinty
   integer(BOOL),intent(out):: SetViewportEx
   !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'SetViewportEx' :: SetViewportEx
   integer(HANDLE),Intent(in):: hdc
   integer(4),Intent(in):: x, y
   !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: pt
   type(T_POINT),Intent(out):: pt
   end function SetViewportEx
end interface

So I don't understand the error messages. I've tried compiling without the interfaces and still problems!

Sincerely,

Brooks Van Horn

Not able to use 'GetProcAddress' from Fortran to call .Net methods

$
0
0

Hi All,

Please escuse me if this post seems silly. I'm totally new to Fortran and have been tasked to use some existing Fortran DLL's in my .NET project.

I'm able to access functions created in Fortran from .net code (C# to be precise) and get replies/values back.

I also have some functions in Fortran which call external methods directly(previously they were used to call Delphi methods).

Unfortunately the same does not work on C#. Do I have to change something on the C# end get it working.

I cannot change any code in fortran as its maintained by someone else and I know fortran part works as i'm able to see data in delphi.

Have any one encountered such issues ? if so it would be great if you can direct me to some URL or jolt down some steps as to how I can impliment this.

The following is my C# code (simplified) : 

using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace MYAPP
{
    public partial class Form1 : Form
    {

        private const string dll_Name = "FortranDLL.dll";
        static string filePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
        byte[] fileName = System.Text.Encoding.ASCII.GetBytes(filePath);

        //This works fine
        [DllImport(dll_Name, CallingConvention = CallingConvention.Cdecl)]
        public static extern int INITIALISE(int callerId, byte[] fileName);

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int callerId = 2;
            int returnValue = INITIALISE(callerId, fileName);
            Console.WriteLine("Initialize call " + returnValue.ToString());
            // The above statement works and i can get proper value
        }

        [ComVisible(true)]
        public static void SetMessageString(int one, int two, byte[] arr)
        {
            Console.WriteLine("Hello there ! ");
        }

    }
}

 Thanks & regards,

Rohan W.

reading file and input conversion error

$
0
0

hello everybody

i am trying to read in a file. its a two column data. Right when i run this code, at line 5242, i get input conversion error. i am pasting the code here. the file i am trying to read is attached.

please help

 

program readout
implicit none

real::a(8243)
real::b(8243)
integer :: j=0

open (unit=10, file='nacanodes.txt', status='old')

do j=1,8243

read(10,fmt='(2f18.15)') a(j),b(j)

write(*,'(i4)') j
write(*,'(2f18.15)')a(j),b(j)

end do

close(10)

end program readout 

 

AttachmentSize
Downloadtext/plainnacanodes.txt296.11 KB

Memory

$
0
0

Back in the old days - Conte and deBoore was a nice textbook on Numerical Analysis. I remember using this textbook in my Mechanical Engineering course on Numerical Analysis - of course one could only use Fortran then.

Skip forward to 1987 and I needed a quick inverter to solve a minor problem, so I used the old Conte and de Boore method. 

I still have the code and the examples. 

The structural analysis package I lifted from 1973 is giving me one or two minor and interesting answers that I wanted to check - nothing major just annoyances as I work out the program.  Combined with FEAST it is a treat to use compared to a commerical package, one can get at all the numbers quickly and can play with them.

 

So I thought I would run out the old program,  found the floppy drive, load it into VS 2013 - compiles first time - run out a 30 by 30 test case from the 73 code and get the C and deB to invert the matrix, to see if the results are the same. 

Answer was a big NO.

Load up the C and deBoore test case, one can still find a PDF of the textbook online -- must be illegal - but what the heck. Still getting the wrong answer on reading in the data.  After a bit of exploration with Watch on VS 2013, I learnt something I had completely forgotten, one can pass a vector through a subroutine call and then declare it as an array in the subroutine. Here was the sticking point - it is in column and not row order.   Fixing the input routines solved a simple problem and now I can check the 73 code.  Of course one should load up the MKL inverter, but what the heck life is short play hard.  I need to put the MKL inverter into the 73 code, that is next.

One of the problems with eigenvectors is visuallying the result.  I have DISLIN - but I was darned if I could get it to run at the weekend - just ornery I guess and a 9 year old yellling in my ear, I had a simple bitmap drawer from Japan, so I thought - what the heck it is only simple line sketches.  I thought I need to draw lines, circles and some text.  I was fun -- text looks like MS DOS prompts after heated to 1200 C, but who cares.  It is possible to create bitmaps from a standard FORTRAN program -- of course it is not pretty - but then again neither am I.

Here is the code - very old Fortran - but it still works. and is often said - if it is not broken do not fix it

C *********************************************************************
      PROGRAM MATRIX
C *********************************************************************
C      This is a matrix inversion progamme taken from Conte and deBoor
C      Elementary Numerical Analysis.
C      It has been amended to run on an IBM PC under Microsoft Fortran
C      by John Nichols.
C *********************************************************************
      implicit character*60(z)

      DIMENSION Aorg(10000)
      Dimension A(10000),ainv(10000),b(100),ipivot(100),c(100),d(100)
      write(*,1)
1     format(1x,'This is an IBM MICROSOFT FORTRAN programme',/
     11x,'from CONTE and de BOOR,amended by John Nichols',/
     21x,'in July 1987.',/
     31x,' Ver. 1.0 --Ph (049 25464).'//)
C
C *********************************************************************
C
C      Read input and output devices for files.
C
C *********************************************************************
C

      write(*,20)
20    format(1x,'File name for input data :   '\)

      read(*,30)zFILE1
30    format(a12)

      write(*,40)
40    format(1x,'File name for output data :   '\)

      read(*,50)zFILE2
50    format(a12)

C
C *********************************************************************
C
C      Open files for input ouput
C
C *********************************************************************
C

      write(*,60)
60    format(1x,'Opening the input file to access data!'/)

      open(1,file=zFILE1,status='OLD')

      write(*,70)
70    format(1x,'Opening the output file for data!'/)

      open(2,file=zFILE2,status='UNKNOWN')

C
C *********************************************************************
C
C      Read input data from file 1
C
C *********************************************************************
C

100   continue
      c(1:100)=0.0

      read(1,80)N
80    format(I3)

      write(*,90)N
90    format(1x,'The matrix size is ',i2/)

      read(1,*)(d(j),j=1,n)
      read(1,*)N1

      nsq=N*N

      read(1,*)(a(j),j=1,nsq)
      do 102 i = 1,nsq
          aorg(i) = a(i)
102   end do

      write(*,101)(a(j),j=1,nsq)
  101 format(3(2x,F10.6))
      write(*,101)(d(j),j=1,n)
C
C *********************************************************************
C
C      Call factor subroutine
C
C *********************************************************************
C

      write(*,150)
150   format(1x,'At the factor subroutine!',/)

      call factor(a,a,ipivot,b,n,iflag)
      go to (120,110),iflag

110   continue

C
C *********************************************************************
C
C      The matrix is singular
C
C *********************************************************************
C

      write(*,130)
130   format(1x,'This matrix is singular have another shot!',/)
      go to 210

120   continue

C
C *********************************************************************
C
C      Call subst subroutine
C
C *********************************************************************
C

      do 140 I=1,N
          b(i)=0.0
140   continue

      ibeg=1

      do  160 j=1,N
          b(j)=1.0

          call subst(a,b,ainv(ibeg),ipivot,n)

          b(j)=0.0
          ibeg=ibeg+N
160   continue

C
C *********************************************************************
C
C      Inverted matrix results
C
C *********************************************************************
C

      write(2,170)
      write(*,170)
170   format(1x,'The computed inverse is ',//)

      write(2,101)(ainv(j),j=1,nsq)
      write(*,101)(ainv(j),j=1,nsq)
180   format((3F10.5))
210   continue

      call MatrixResult(aorg, ainv,d,c,n)
C
C *********************************************************************
C
C      End of programme
C
C *********************************************************************
C

      write(*,200)
200   format(1x,'The end of the programme',/)


      end

C
C *********************************************************************
C
      Subroutine MatrixResult(a,ainv,d,c, n)
C
C *********************************************************************      
C
      dimension a(n,n),d(n),c(n),ainv(n,n), f(n,n)
      integer n,i,j

      do 100 i = 1,n
          do 200 j =1,n

              c(i) = a(i,j)*d(i)+c(i)
200       Continue
100   Continue
      f(1:n,1:n)=0.0

      do 400 i=1, n
          do 300 j=1, n
              do 250 k=1, n
                  f(i,j)=f(i,j)+a(j,k)*ainv(k,i)
250   enddo
300   end do
400   end do
      do 500 i = 1,n
          write(*,180)(F(i,j),j=1,n)
500   end do
180   format((30F4.1))
      write(*,70)
70    format(1x,'Opening the C  data!'/)
      write(*,*)(c(i),i=1,n)

      return

      end

C
C
C *********************************************************************
C
      Subroutine Factor(a,w,ipivot,d,n,iflag)
C
C *********************************************************************      
C
      dimension a(n,n),w(n,n),ipivot(n),d(n)

C
C *********************************************************************
C
C      initialize vectors
C
C *********************************************************************
C

      iflag=1

      do 10 i=1,n
          ipivot(i)=i
          rowmax=0.0
          do 20 j=1,n
              w(i,j)=a(i,j)
              rowmax=amax1(rowmax,abs(w(i,j)))
20        continue
          if(rowmax .eq. 0.0) go to 999
          d(i)=rowmax
10    continue

C
C *********************************************************************
C
C      Gaussian elimination with scaled partial pivotting
C
C *********************************************************************
C

      nm1=n-1
      if(nm1 .eq. 0) return
      do 30 k=1,nm1
          j=k
          kp1=k+1
          ip=ipivot(k)
          colmax=abs(w(ip,k))/d(ip)
          do 40 i=kp1,n
              ip=ipivot(i)
              awikov=abs(w(ip,k))/d(ip)
              if (awikov .le. colmax ) go to 40
              colmax=awikov
              j=i
40        continue
          if (colmax .eq. 0.0) go to 999
          ipk=ipivot(j)
          ipivot(j)=ipivot(k)
          ipivot(k)=ipk
          do 30 i=kp1,n
              ip=ipivot(i)
              w(ip,k)=w(ip,k)/w(ipk,k)
              ratio=-w(ip,k)
              do 30 j=kp1,n
                  w(ip,j)=ratio*w(ipk,j)+w(ip,j)
30    continue
      if (w(ip,n) .eq. 0.0) go to 999
      return
999   iflag=2
      return
      end

C
C *********************************************************************
C
      subroutine subst (w,b,x,ipivot,n)
C
C *********************************************************************
C
      dimension w(n,n),b(n),x(n),ipivot(n)
      if (n .gt. 1) go to 10
      x(1)=b(1)/w(1,1)
      return
10    continue
      ip=ipivot(1)
      x(1)=b(ip)
      do 15 k=2,n
          ip=ipivot(k)
          km1=k-1
          sum=0.0
          do 14 j=1,km1
              sum=w(ip,j)*x(j)+sum
14        continue
          x(k)=b(ip)-sum
15    continue
      x(n)=x(n)/w(ip,n)
      k=n
      do 20 np1mk=2,n
          kp1=k
          k=k-1
          ip=ipivot(k)
          sum=0.0
          do 19 j=kp1,n
              sum=w(ip,j)*x(j)+sum
19        continue
          x(k)=(x(k)-sum)/w(ip,k)
20    continue
      return
      end

 

 

 


error #5102

$
0
0

Dear Users,

I've followed the instructions to add the IMSL Library to Visual Studio but I still cannot build my code. I have Visual Studio 2005 and I am facing the (aparently famous) error "error #5102: Cannot open include file 'link_fnl_static.h".

My Libraries:
$(IFortInstallDir)lib\ia32
$(VCInstallDir)atlmfc\lib
$(VCInstallDir)lib
$(VCInstallDir)PlatformSDK\lib
$(FrameworkSDKDir)lib
$(FNL_DIR)\IA32\lib

My Includes
$(IFortInstallDir)include
$(IFortInstallDir)include\ia32
$(VCInstallDir)atlmfc\include
$(VCInstallDir)include
$(VCInstallDir)PlatformSDK\include
$(FrameworkSDKDir)include
$(FNL_DIR)\IA32\include\dll

My Command Line (part of it)
INCLUDE 'link_fnl_static.h'
!DEC$ OBJCOMMENT LIB:'libiomp5md.lib'

My Output
1>------ Build started: Project: teste, Configuration: Debug Win32 ------
1>Compiling with Intel(R) Fortran 11.0.061 [IA-32]...
1>main.f90
1>C:\Users\Documents\Visual Studio 2005\Projects\teste\teste\main.f90(11): error #5102: Cannot open include file 'link_fnl_static.h'
1>compilation aborted for C:\Users\Documents\Visual Studio 2005\Projects\teste\teste\main.f90 (code 1)
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(FNL_DIR)
1>
1>Build log written to  "file://C:\Users\Documents\Visual Studio 2005\Projects\teste\teste\Debug\BuildLog.htm"
1>teste - 2 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

 

Any thoughts? 

Thank you

 

unresolved references in project that was working

$
0
0

Removed this - appears I had an obsolete version of my code with erroneous DLLEXPORT in an exe file.

Submodules - Experience and VS2015 integration issue

$
0
0

Dear all,

I recently played around with the new submodule capabilities in PSXE2016 and some questions arose.

The first one is a question of experience of other users: Do you take advantage of the procedure definition (example foo) or do you repeat the interface in the submodule (example bar)? I find it difficult to decide which one I should use.

The second is more a feature request. Staying at modules the "go to definition" works well and is really helpful. This does not work in any way with submodules (VS2015 sp1, PSXE2016 update 2, example code shows that it does not work). Please, Intel, enhance the VS2015 integration.

The third one is a question whether it makes sense to allow either 'end procedure foo' or alternatively 'end subroutine foo' within the submodule smod_test. The other way round the compiler gives an error ('end subroutine bar' vs. 'end procedure bar').

Here is the example code (4 different files):

submodule (mod_test) smod_test
  contains

  ! this version is without repeating the interface
  module procedure foo
    implicit none

    d = real(i*j*k,rk)
    return
  !end subroutine foo ! -> this does work too, but does it make sense?
  end procedure foo


  ! this version repeats the interface
  module subroutine bar(i, j, k, d)
    use mod_parameter
    implicit none
    integer(ik), intent(in ) :: i, j, k
    real(rk)   , intent(out) :: d

    d = real(i*j*k,rk)
    return
  end subroutine bar
  !end procedure bar ! -> this does not work

end submodule

module mod_parameter
  use ISO_FORTRAN_ENV, only : ik => int32
  use ISO_FORTRAN_ENV, only : rk => real64
  implicit none

  private
  public :: ik, rk
end module mod_parameter

module mod_test
  use mod_parameter
  implicit none

  private
  public :: foo, bar

  interface

    module subroutine foo(i, j, k, d)
      implicit none
      integer(ik), intent(in ) :: i, j, k
      real(rk)   , intent(out) :: d
    end subroutine foo

    module subroutine bar(i, j, k, d)
      use mod_parameter
      implicit none
      integer(ik), intent(in ) :: i, j, k
      real(rk)   , intent(out) :: d
    end subroutine bar

  end interface

end module mod_test

program submodule_test2
  use mod_parameter
  use mod_test
  implicit none

  integer(ik) :: i, j, k
  real   (rk) :: d

  ! ----------------------------------------------

  i = 2
  j = 5
  k = 3
  call foo(i,j,k,d)
  write(*,'(1ES18.4)') d
  call bar(i,j,k,d)
  write(*,'(1ES18.4)') d


end program submodule_test2

Any comment is highly welcome, Johannes

spin-control behavior

$
0
0

I have an up/down spin control in a dialog and I have a working call-back routine and the control works fine with its integer edit buddy. However, the edit box does not display an initial value. If I press the up or down part of the spinner then it correctly displays the right value. I just don't seem to be able to get it to display its startup value. If I query the spin-control for its position it returns the correct value. I've even tried to do a dlgsetint to the edit control but no correct initial display.

Any ideas?

Thanks,

Brooks Van Horn

Restoring minimized application

$
0
0

Just developing a gui-dialog based application that controls the graphics drawn in the main window. When I minimize the app all seems ok. When I try to maximize it it leaves nothing intact. The dialog is sort of greyed out and the main window is all white. While minimized to the tray I can put my mouse over the small display and when I select the small window, it pops my app up and all looks good until I release the mouse button. What am I ignoring or should I do something in the WM_QUERYOPEN message? Is this a simple thing or do I need to design this exchange in my code...like saving values when minimized and then restoring them when maximized?

Thanks,

Brooks Van Horn

2013 --> 2015 change in reading reals?

$
0
0

I'm sure this is just a compiler setting or something, but I'm rusty!  When we moved from 2013 to 2015, our applications stopped working properly.  We tracked it down to the fact that we were trying to read integers (or a delimited integer - e.g. '1') into a real.  In 2013 this worked.  In 2015 it's blowing up on us.  Any ideas?

Thanks!

Brad.

What is the effect of violating the contiguity attribute of a dummy argument?

$
0
0

Hello,

I am experimenting with the CONTIGUOUS attribute and I found to my surprise that passing a non-contiguous array section via a dummy argument that does have this attribute makes no difference. So I wonder if it should - for instance lead to a runtime error message - or not. I compiled the program below with the flag -check:all to see if any runtime error or warning is issued and none is (using Intel Fortran 15). The program works as if this attribute were not present.

Can someone enlighten me? (I can imagine that the attribute is recognised but does not lead to more efficient code ...)

! chktemp.f90 --
!
module temp
contains
subroutine mytemp( a, n )
    real, contiguous, dimension(:) :: a
    integer, intent(in) :: n

    a(1:n) = 1.0
end subroutine
end module temp

program chktemp
    use temp
    implicit none

    real, dimension(10,10) :: aha

    aha = 0.0

    call mytemp( aha(1,:), size(aha(1,:)) )

    write(*,'(10f5.2)') aha
end program chktemp

 

 


Using the 'value' attribute

$
0
0
module mymod
    implicit none
    type my_t
	integer :: a = 3
    end type my_t

contains
    subroutine by_value(i,m) bind(c,name='BY_VAL')
	use iso_c_binding
	integer(c_int), intent(in), value :: i
	type(my_t), intent(out) :: m
	m%a = i
    end subroutine by_value

end module mymod

program test
	use mymod
	implicit none
	integer :: i
	type(my_t) :: m

	i = 5

	call by_val(i,m)
	print *, m%a

	call by_value(i,m)
	print *, m%a

end program test

 

> ifort tc.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.180 Build 20160204
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

 

Microsoft (R) Incremental Linker Version 11.00.60610.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:tc.exe
-subsystem:console
tc.obj

> tc
  1060107240
           5

The above code shows the inconsistency. If I remove the output argument 'm' in the calls then both output values are '5' as I'd expect. I get the same result with Version 14.0.1.139 Build 20131008.

 

Printing graphics

$
0
0

If I have a window DC (sDC) and a printer DC (pDC), why can't I just draw into pDC the way I would a sDC? Or if I have a DIB, how di I print it? I would really like to know of any experience yoiu've had with this.

Thanks,

Brooks Van Horn

Fortran Manuals and Interfaces

$
0
0

Dear Steve:

A few years ago mecej4 on the MKL Forum helped me to fix - actually he fixed it and I just watched in awe, a bit like Shock and Awe in Fortran a program for the analysis of water supply systems. In mecej4's fix he used interfaces.

So in thinking about the Fortran Manuals - I dragged out Fortan 95/2003 explained.  The Metcalf book is more confusing than the Sonic Menu for hamburgers, but I digress. I could not make head nor tail of interfaces in the book. 

In the oldest iteration of the fixed program, we have a module called

Network that contains a lot of variable declarations, it ends then there are a series of subroutines, which are in the same file, but not in the module.

In the main program unit there are :

program Magni
  use Network
  implicit none
  
  interface
   subroutine PumpHead( H1, H4, a0, a1,  a2, a3, HRatio, retQ, flow0, pumpQ)
    use Network
    real(kind=dp) H1
    real(kind=dp) H4
    real(kind=dp) a0
    real(kind=dp) a1
    real(kind=dp) a2
    real(kind=dp) a3
    real(kind=dp) HRatio
    real(kind=dp) retQ
    real(kind=dp) flow0
    real(kind=dp) pumpQ
   end subroutine PumpHead
  
  end interface

a series of interface calls -- this program still compiles and run fine on the latest

A later version of the program has the subroutines within the module

  MODULE network
    INTEGER, PARAMETER :: dp = selected_real_kind(15, 307)
    REAL (KIND=dp) :: g = 9.806, pi = 3.14159265D0

    TYPE snode
        INTEGER id
        INTEGER :: tank = -1
        INTEGER :: zone = 0
        REAL (KIND=dp) x
        REAL (KIND=dp) y
        REAL (KIND=dp) e
        REAL (KIND=dp) c0
        REAL (KIND=dp) qbase
        REAL (KIND=dp) cs
        REAL (KIND=dp) h
        REAL (KIND=dp) c
        REAL (KIND=dp) inddemand
        REAL (KIND=dp) parkdemand
        REAL (KIND=dp) leakdemand
        REAL (KIND=dp) resdemand
        REAL (KIND=dp) dumc
        REAL (KIND=dp) q
    END TYPE

    TYPE spipe
        INTEGER id
        INTEGER n1
        INTEGER n2
        INTEGER :: zone = 0
        INTEGER pumpstatus
        INTEGER nodei, nodej
        REAL (KIND=dp) :: a0 = 0.0
        REAL (KIND=dp) a1
        REAL (KIND=dp) a2
        REAL (KIND=dp) a3
        REAL (KIND=dp) length
        REAL (KIND=dp) diameter
        REAL (KIND=dp) c
        REAL (KIND=dp) wlrf !pipe wall roughness, m
        REAL (KIND=dp) e
        REAL (KIND=dp) pumpq
        REAL (KIND=dp) deltaq
        REAL (KIND=dp) q
        REAL (KIND=dp) h0
        REAL (KIND=dp) h1
        REAL (KIND=dp) h2
        REAL (KIND=dp) h3
        REAL (KIND=dp) h4
        REAL (KIND=dp) qt
        REAL (KIND=dp) v
        REAL (KIND=dp) :: k = 0.0
        REAL (KIND=dp) :: k1
        REAL (KIND=dp) :: RE
        REAL (KIND=dp) :: fr
        integer :: cv = 0
        integer :: prv = 0
        REAL (KIND=dp) :: prvcoeffic = 1.0
        REAL (KIND=dp) :: prvzeropressure
        REAL (KIND=dp) kvis !kinematic viscosity, m^2/s
        REAL (KIND=dp) tc !water temperature, celsius
    END TYPE

    TYPE spump

        INTEGER :: pump = -1
        INTEGER :: pipe = 0
        INTEGER :: ontime = 0
        INTEGER :: offtime = 0
        INTEGER :: tank = -1
        REAL (KIND=dp) :: onlevel = 0.0
        REAL (KIND=dp) :: offlevel = 0.0

    END TYPE
    TYPE stank

        INTEGER id
        REAL (KIND=dp) area
        REAL (KIND=dp) c
        REAL (KIND=dp) h0
        REAL (KIND=dp) hmax
        REAL (KIND=dp) hmin
        REAL (KIND=dp) hnext
        REAL (KIND=dp) k1
        INTEGER node
        REAL (KIND=dp) v
        REAL (KIND=dp) centreX
        REAL (KIND=dp) centerY
        REAL (KIND=dp) radius

    END TYPE

    TYPE constants

        REAL (KIND=dp) :: resdemfact = 0.15
        REAL (KIND=dp) :: inddemfact = 0.15
        REAL (KIND=dp) :: parkfactor = 540.0
        REAL (KIND=dp) :: demand = 0.0
        REAL (KIND=dp) :: flow0 = 0.01
        REAL (KIND=dp) :: gpmpercfs = 448.4
        REAL (KIND=dp) :: htol = 0.01
        REAL (KIND=dp) :: huge_int = 999999999
        REAL (KIND=dp) :: lperet = 0.15
        REAL (KIND=dp) :: lperft3 = 28.3
        REAL (KIND=dp) :: metricratio = 1000.0
        REAL (KIND=dp) :: limit = 1000000

        INTEGER :: maxhrs = 24
        INTEGER :: maxid
        INTEGER :: maxiter = 2000
        INTEGER :: maxnodes
        INTEGER :: maxpipes
        INTEGER :: maxpumps
        INTEGER :: maxsegs
        INTEGER :: maxtanks
        INTEGER :: maxtexts = 50
        INTEGER :: nodedataccount = 12
        INTEGER :: runtime = 1
        REAL (KIND=dp) :: qtol = 0.01
        REAL (KIND=dp) :: ttol = 5.0
        REAL (KIND=dp) :: unknown = -999999
        CHARACTER *2 :: units = 'SI'
    END TYPE

    !-----------------------------------------------------
    !
    !
    !
    !-----------------------------------------------------
    CONTAINS

    SUBROUTINE timingline(sw)
    IMPLICIT NONE
    INTEGER :: sw
    INTEGER :: tmpday, tmpmonth, tmpyear
    INTEGER :: tmphour, tmpminute, tmpsecond, tmphund, values(8)
    CHARACTER *2 :: mer

    CALL date_and_time(values=values)
    tmpyear = values(1)
    tmpmonth = values(2)
    tmpday = values(3)
    tmphour = values(5)
    tmpminute = values(6)
    tmpsecond = values(7)
    tmphund = values(8)
    IF (tmphour.GT.12) THEN
        mer = 'pm'
        tmphour = tmphour - 12
    ELSE
        mer = 'am'
    END IF
    WRITE (sw, 100) tmpday, tmpmonth, tmpyear
    WRITE (sw, 110) tmphour, tmpminute, tmpsecond, tmphund, mer
    WRITE (*, 100) tmpday, tmpmonth, tmpyear
    WRITE (*, 110) tmphour, tmpminute, tmpsecond, tmphund, mer
    WRITE (sw, 120)
    RETURN
100 FORMAT ('       Analysis Date : ', I2, '/', I2.2, '/', I4.4)
110 FORMAT ('       Time : ', I2, ':', I2.2, ':', I2.2, ':', I3.3, &
        '', A)
120 FORMAT ('        ')
    END SUBROUTINE
    !-------------------------------------------------------------------
    !

And there are no inferfaces:

I was wondering which is the preferred standard and really if the module contains the subroutines, is there any need for interfaces?

John

Unresolved externals in release mode

$
0
0

My C++ / Fortran mixed language app builds fine in Debug mode, but in Release mode I get the following link errors. 

1>libirc.lib(irc_msg_support.obj) : error LNK2001: unresolved external symbol __imp__LoadLibraryA@4
1>libirc.lib(irc_msg_support.obj) : error LNK2001: unresolved external symbol __imp__GetThreadLocale@0
1>libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2001: unresolved external symbol __imp__LoadLibraryExA@12
1>libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2001: unresolved external symbol __imp__GetModuleHandleExA@12
1>libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2001: unresolved external symbol __imp__GetEnvironmentVariableA@12
1>C:\Users\otakiej\Documents\Subversion\OPT_trunk\Windows10\OPT\Release\OPT\OPT.exe : fatal error LNK1120: 5 unresolved externals

I've compared the compiler and linker settings between the debug and release builds and they seem equivalent.  I'm using VS 2015 and Intel® Parallel Studio XE 2016 Composer Edition for Fortran Windows* Integration for Microsoft Visual Studio* 2015, Version 16.0.0046.14.  Linker output with /verbose:lib is attached.  Please help.

AttachmentSize
Downloadtext/plainrelease4.txt22.37 KB

DLL built with 2013 and VS 2010 Fails

$
0
0

I have a large C# Project with an embedded Fortran DLL.   I upgraded from VS 2005 and Fortran 10 to VS 2010 and Foretran 2013.  My app works ffine on the development machine, but the DLL is inaccessible on a non development test machine.   I have installed the fortran 2013 redistributable:  w_fcompxe_redist_ia32_2013_sp1.4.237.msi​.    What am I missing?

Viewing all 5691 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>