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

Error for binary operation

$
0
0

Hi, the following code produces an error with ifort 2018u2 on x64 platform:

module test1
    implicit none
    
    type, abstract :: tp1
        private
    contains
        private
        procedure(iequals), public, pass, deferred :: equals
    end type tp1
    
    abstract interface
        function iequals(this, obj)
            import tp1
            logical                :: iequals
            class(tp1), intent(in) :: this
            class(tp1), intent(in) :: obj
        end function iequals
    end interface
    
end module test1

module test2
    use test1, only: tp1
    implicit none
    
    type, extends(tp1) :: tp2
        private
        integer :: var2
    contains
        private
        procedure, public, pass :: equals => equalsfunc
    end type tp2

    contains
    
    function equalsfunc(this, obj)
        implicit none

        logical                :: equalsfunc
        class(tp2), intent(in) :: this
        class(tp1), intent(in) :: obj

        select type(obj)
        type is(tp2)
            equalsfunc = (this % var2 == obj % var2)
        class default
            equalsfunc = .false.
        end select

    end function equalsfunc

end module test2

module test3
    use test1, only: tp1
    use test2, only: tp2
    implicit none
    
    type, extends(tp1) :: tp3
        private
        type(tp2) :: var3
    contains
        private
        procedure, public, pass :: equals => equalsfunc
    end type tp3

    contains
    
    function equalsfunc(this, obj)
        implicit none

        logical                :: equalsfunc
        class(tp3), intent(in) :: this
        class(tp1), intent(in) :: obj

        select type(obj)
        type is(tp3)
            equalsfunc = (this % var3 == obj % var3)
        class default
            equalsfunc = .false.
        end select

    end function equalsfunc

end module test3

Error message is:

error #6355: This binary operation is invalid for this data type.    [VAR3]

on line 78. Is this a bug and is there any workaround that I can temporarily make it through ? Thanks for any help.


Load Failed for C projects in a mixed language solution

$
0
0

I have recently migrated my VS2015 solution to a new computer and am having teething problems getting it to work.  

I have attached an image file showing the response in VS2015 and here is a list of the products in VS2015 and it includes C++ and the Intel Visual Fortran:

Microsoft Visual Studio Professional 2015

Version 14.0.25431.01 Update 3

Microsoft .NET Framework

Version 4.7.02558

 

Installed Version: Professional

 

Visual Basic 2015   00325-60005-53699-AA785

Microsoft Visual Basic 2015

 

Visual C# 2015   00325-60005-53699-AA785

Microsoft Visual C# 2015

 

Visual C++ 2015   00325-60005-53699-AA785

Microsoft Visual C++ 2015

 

Application Insights Tools for Visual Studio Package   7.0.20622.1

Application Insights Tools for Visual Studio

 

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0

ASP.NET and Web Tools 2015.1 (Beta8)

 

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0

For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

 

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0

For additional information, visit http://www.asp.net/

 

Common Azure Tools   1.8

Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

 

Intel® Parallel Studio XE 2018 Update 2 Composer Edition for Fortran Windows*   Package ID: w_comp_lib_2018.2.185

Intel® Parallel Studio XE 2018 Update 2 Composer Edition for Fortran Windows* Integration for Microsoft Visual Studio* 2015, Version 18.0.0038.14, Copyright © 2002-2018 Intel Corporation. All rights reserved.

* Other names and brands may be claimed as the property of others.

 

JavaScript Language Service   2.0

JavaScript Language Service

 

JavaScript Project System   2.0

JavaScript Project System

 

Microsoft Azure Mobile Services Tools   1.4

Microsoft Azure Mobile Services Tools

 

NuGet Package Manager   3.4.4

NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

 

PreEmptive Analytics Visualizer   1.2

Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

 

SQL Server Data Tools   14.0.60519.0

Microsoft SQL Server Data Tools

 

TypeScript   1.8.36.0

TypeScript tools for Visual Studio

 

I'd be grateful if anyone could point me to what I need to do.

 

Thanks.

AttachmentSize
Downloadimage/jpegvs2015.jpg62.61 KB

write an allocatable array in a file

$
0
0

hi
I have a 2 dimension allocatable array which I need to write each row of the array in one line of output file. the problem is that I don't know the size of array so I can't use formats like '(8(f8.2,x))'. please consider this program:

program Console8

implicit none
integer(8) :: i,n,m
real,allocatable ::bt(:,:)
open(unit = 1, file ='output.txt')
read*,n,m
allocate(bt(n,m))
do i=1,n
bt(i,1:m) = i
write(1,*) bt(i,1:m)
end do
end program Console8

for example :
the file output.txt for n=2,m=8 will be

1.000000 1.000000 1.000000 1.000000 1.000000
1.000000 1.000000 1.000000
2.000000 2.000000 2.000000 2.000000 2.000000
2.000000 2.000000 2.000000

But I need it to be
1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000

any idea?
Thank you.

Compilation Failure Error 10298 IFORT

$
0
0

I have moved computers and have downloaded new version of VS2015 and Intel Fortran.  When compiling my project I get the following error:

Severity Code Description Project File Line Suppression State

Error error #10298: problem during post processing of parallel object compilation ifort

 

I wonder if anyone might help me through this issue?

compiler bug with /check:bounds and derived type

$
0
0

The program below compiles and runs with gfortran and g95 and also with ifort without the /check:bounds option, giving output 42.0. It also runs if components other than ff of the derived type are removed.

c:\fortran\ifort\sge>ver

Microsoft Windows [Version 10.0.16299.371]

c:\fortran\ifort\sge>type xbug.f90 
program xbar
implicit none
integer, parameter :: dp = kind(1.0d0)
type :: foo
   integer       :: n
   real(kind=dp) :: ff,gg,hh
   real(kind=dp), allocatable :: cc(:),dd(:),ee(:)
end type
integer, parameter :: nx=2
type(foo), allocatable :: xx(:)
allocate (xx(nx))
xx = bar(["a","b"])
xx(1)%ff = 42.0_dp
print*,xx(1)%ff
contains
function bar(ss) result(yy)
character (len=*), intent(in)  :: ss(:)
type(foo)                      :: yy(size(ss))
end function bar
end program xbar

c:\fortran\ifort\sge>ifort /traceback /check:bounds xbug.f90 
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.0.045 Beta Build 20180317
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

ifort: NOTE: The Beta evaluation period for this product ends on 11-oct-2018 UTC.
xbug.f90(16): warning #6178: The return value of this FUNCTION has not been defined.   [YY]
function bar(ss) result(yy)
------------------------^
Microsoft (R) Incremental Linker Version 14.00.24234.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:xbug.exe 
-subsystem:console 
-incremental:no 
xbug.obj 

c:\fortran\ifort\sge>xbug.exe
forrtl: severe (157): Program Exception - access violation
Image              PC                Routine            Line        Source             
xbug.exe           00007FF6B4085F21  Unknown               Unknown  Unknown
xbug.exe           00007FF6B4086447  Unknown               Unknown  Unknown
xbug.exe           00007FF6B4081526  MAIN__                     12  xbug.f90
xbug.exe           00007FF6B40D6E22  Unknown               Unknown  Unknown
xbug.exe           00007FF6B40D71C5  Unknown               Unknown  Unknown
KERNEL32.DLL       00007FFA2B501FE4  Unknown               Unknown  Unknown
ntdll.dll          00007FFA2BCBF061  Unknown               Unknown  Unknown

Fortran files with extensions other than F90, FOR, F in Visual Studio

$
0
0

How do I tell Visual Studio that a certain extension other than F90, FOR, F must be treated exactly the same way visually and debug-wise as a Fortran file?  Say it's a INC file, and when I look at it in Visual Studio I want it to behave like a F90 file, in appearance, debug hovering, etc.

I thought that Tools -> Options -> File Extension might help, but Intel Fortran is not listed as an Editor

character array index error

$
0
0

Hi, I want to show the following code which a character array index error occurs.

module test1
    implicit none
    
    private
    public :: tp1, const1, const2, const3, chars

    type :: tp1
        private
        integer :: var
    contains
        private
        procedure, public, pass :: getvalue
    end type tp1
    
    type(tp1), parameter :: const1 = tp1(0)
    type(tp1), parameter :: const2 = tp1(1)
    type(tp1), parameter :: const3 = tp1(2)

    character(*), dimension(0:*), parameter :: chars = ["1234", "5678", "9012" ]
    
    contains
    
    function getvalue(this)
        implicit none
    
        integer                :: getvalue
        class(tp1), intent(in) :: this
    
        getvalue = this % var
    
    end function getvalue
    
end module test1
    
program main    
    use test1
    implicit none
    
    integer :: idx

    print*, chars(0), '', chars(1), '', chars(2)  ! <---Output: 1234 5678 9012
    
    idx = const1 % getvalue()
    print*, idx                                     ! <---Output: 0

    print*, chars(idx)                              ! <---Output: 1234
    print*, chars(const1 % getvalue())              ! <---Output: 5678
    print*, chars(const2 % getvalue())              ! <---Output: 5678
    print*, chars(const3 % getvalue())              ! <---Output: 5678
    print*, chars(get())                            ! <---Output: 1234
    
    contains
    
    function get()
        implicit none
    
        integer :: get
    
        get = 0
    
    end function get
    
end program main

The 2-4 PRINT statements of chars gives a strange output of chars(1) rather than the expected chars(0), all other PRINTs are all correctly printed. Is this a mistake or something ?

Visual Fortran 2018 Slower then 2017?

$
0
0

Hi All,

 

So I just upgraded this week from Intel Visual Fortran 2017 to 2018. I have each on different computers and the compiler settings are identical (as far as I can tell).

 

I am compiling a large numerical simulation software and have two simulation domains I am running it on. The first requires the same amount of time to complete the simulation for the 2017 and 2018 versions. The second has the 2018 taking about 3 times longer for the simulation to complete. Is there a default optimization that has changed (such as loop unroll count) or anyway that I can get the same speed with 2018 as I do with 2017.


debug variables in dlls

$
0
0

Hi all,

I just realised i had posted in the wrong section, so I replicate the topic here, apologize for cross-posting

I'm having problems trying to debug a fortran code: during debug i cannot WATCH variables contained in a module which is in another project of the solution and which is compiled as .dll and variables exported with the clause:  

 !DEC$ ATTRIBUTES DLLEXPORT::  variable

I managed to reproduce the problem in a simple toy solution, with the same structure described above.

please find attached the solution along with a similar one, but with the module included in the main project (the latter debugs just fine).

i'm using VS 2017 enterprise 15.7.1 + Intel compiler 18

thank you

 

UPDATE 1 (23/05/2018 14:40 UTC) uploaded new toy solution, previous was not compiling after cleaning)

UPDATE 2 seems like same issue was already found out in the (very) past 

AttachmentSize
Downloadapplication/zipdebug_toy.zip413.74 KB

Exporting subroutines from a Fortran DLL

$
0
0

In a DLL project, we export all our subroutines and functions (which are normally in modules) using:

!dec$ attributes dllexport :: routine_name

in the appropriate place in the files.

I now want to add some external code which I'd rather not edit (as it will get overwritten every time I get new versions), so I created a DEF file containing:

EXPORTS
new_routine1 @1
new_routine2 @2

Then I included this file in the DLL project and rebuilt.  However when I look in the DLL using DEPENDS, these functions are not exported.

Not sure what I am doing wrong.

Intel® Parallel Studio XE 2018 conflict with Qt visual studio tool 2.2.1

$
0
0

 

My OS is win7 and I have installed VS2017 with Qt visual  studio tool 2.2.1

Recently I installed the Intel® Parallel Studio XE 2018. There is something wrong.

VS2017 can‘t run once again except reboot the computer . I guess it maybe something change the system variables such as "windir", because I can't start the windows media center from start menu and the software's icon has change to system default icon.

Look for help

Jie Xu 

What’s new in the Intel® Compiler 19.0 beta

Intel support for Named IF block in Fortran 2008

$
0
0

Consider the following simple Fortran program:

program testNamedIfBlock

implicit none

integer :: i, counter

test: if (.true.) then
    write(*,*) 'Hello World!'
    exit test
else test
end if test
    
end program testNamedIfBlock

Compiling this code with Intel's ifort compiler 2018 on both Linux and Windows leads to internal compiler error:

$ifort main.f90 -o a.out
main.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for main.f90 (code 1)

Commenting the line

exit test

leads to error-free successful compilation of the code. Is this a compiler bug, or is it simply because named if block is not yet supported in ifort? It looks like the named BLOCK constructs are already supported, so it seems an oddity if named IF constructs are not yet supported.

Recognizing new license

$
0
0

How do I get my latest license recognized by IVF?

I tried doing a repair of the existing install, but was not prompted for the license/activation.

Is there a simple way, or do I need to do a complete reinstall?

Thanks,

David

Inconsistent compiler error: contiguous attribute

$
0
0

Hi.
I was playing with the contiguous attribute and I run into this:

integer, allocatable, target :: a(:)
integer, pointer, contiguous :: b(:)

allocate(a(5))
a = 0
b => a ! No problem here
b => a(1:3) ! No problem here
b => a(:3) ! Error
associate(x => a(:3))
b => x ! No problem here either
end associate

Ifort's error says I'm associating a contiguous pointer to a non contiguous target in the third case.

Is this a bug or a feature?


Asynchronous File - How to Set Up

$
0
0

I noticed there are several methods for setting up asynchronous file writing.

The first is opening the file with asynchronous='YES', then having any read or write with asynchronous='YES', but I also saw the attribute asynchronous.

Do I need to have all three specified in order to ensure that the asynchronous writing occurs? Or can I get away with just using the attribute.

For example the following:

USE, INTRINSIC:: ISO_FORTRAN_ENV, ONLY: REAL32, REAL64

REAL(REAL64), DIMENSION(NCOL,NROW,NLAY):: BUF

OPEN(55, ACTION='WRITE', FORM='UNFORMATTED', ACCESS='STREAM', STATUS='REPLACE', POSITION='REWIND',  BUFFERED='yes', BLOCKSIZE=1048576,BUFFERCOUNT=1)

DO K=1,NLAY;  DO I=1,NROW;  DO J=1,NCOL
                                      WRITE(55) REAL(BUF(J,I,K), REAL32)
END DO; END DO; END DO

would make use of asycn if:

USE, INTRINSIC:: ISO_FORTRAN_ENV, ONLY: REAL32, REAL64

REAL(REAL64), DIMENSION(NCOL,NROW,NLAY):: BUF

OPEN(55, ACTION='WRITE', FORM='UNFORMATTED', ACCESS='STREAM', STATUS='REPLACE', POSITION='REWIND',  BUFFERED='yes', BLOCKSIZE=1048576,BUFFERCOUNT=1)

DO K=1,NLAY;  DO I=1,NROW;  DO J=1,NCOL
                                       WRITE(55,ASYNCHRONOUS='YES') REAL(BUF(J,I,K), REAL32)
END DO; END DO; END DO

or

USE, INTRINSIC:: ISO_FORTRAN_ENV, ONLY: REAL32, REAL64

REAL(REAL64), DIMENSION(NCOL,NROW,NLAY):: BUF

OPEN(55, ACTION='WRITE', FORM='UNFORMATTED', ACCESS='STREAM', STATUS='REPLACE', POSITION='REWIND',  BUFFERED='yes', BLOCKSIZE=1048576,BUFFERCOUNT=1,ASYNCHRONOUS='YES')

DO K=1,NLAY;  DO I=1,NROW;  DO J=1,NCOL
                                       WRITE(55,ASYNCHRONOUS='YES') REAL(BUF(J,I,K), REAL32)
END DO; END DO; END DO

or

USE, INTRINSIC:: ISO_FORTRAN_ENV, ONLY: REAL32, REAL64

REAL(REAL64), DIMENSION(NCOL,NROW,NLAY),ASYNCHRONOUS='YES':: BUF

OPEN(55, ACTION='WRITE', FORM='UNFORMATTED', ACCESS='STREAM', STATUS='REPLACE', POSITION='REWIND',  BUFFERED='yes', BLOCKSIZE=1048576,BUFFERCOUNT=1,ASYNCHRONOUS='YES')

DO K=1,NLAY;  DO I=1,NROW;  DO J=1,NCOL
                                       WRITE(55,ASYNCHRONOUS='YES') REAL(BUF(J,I,K), REAL32)
END DO; END DO; END DO

 

So in summary, what combination of ASYNCHRONOUS words do I need to have ASYNCHRONOUS to be in effect.

 

Also is there any penalty for opening a file with ASYNCHRONOUS='YES', but never writing a file with it (so there never is a write statement with ASYNCHRONOUS='YES')

 

One last point, is there any danger to using ASYNCHRONOUS='YES' along with BUFFERED='YES'

 

ifort command line installation with Parallel Studio XE 2018 and VS2017

$
0
0

Hello all, 

My apologies if I missed this issue in searching through the forums.  I've rolled over to XE 2018 Update 2 Composer Edition (w_comp_lib_2018.2.185) and VS2017 15.6.6 (win 10 machine).  From VS2017 itself,  I ran the hello world console example program and it appears to be integrated and to compile just fine, however the command line version of ifort does not seem to work for me.  

Post-install of both programs, I followed the Intel getting started guide: C:\Program Files (x86)\IntelSWTools\documentation_2018\en\ps2018\getstart_comp_wf.htm , 

When I run .\psxevars.bat from the powershell or attempt to use the command line tools ("Compiler 18.0 Update 2 for Intel 64 Visual Studio 2017 environment") from the start menu , I get the following message:

Via Powershell:

PS C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2018.2.046\bin> .\psxevars.bat intel64 vs2017

Output below:

Intel(R) Parallel Studio XE 2018 Update 2
Copyright (C) 2018 Intel Corporation. All rights reserved.

ERROR: Visual Studio 2017 is not found in the system.

Is there something I've done wrong such that VS2017 cannot be located?  Thank you for any help and/or pointing me in the right direction to work on fixing.  

class dummy argument causes problems with non contiguous array

$
0
0

Hello,

i got a problem with object members of arrays beeing passed to a subroutine. In the following example everything works fine a long as the dummy argument arr_arg of foo is defined as type. But as soon as it is defined as class it breaks. Dependent on compiler options (/Od) access violations are detected or (/O2) unpredictable behavior occours. This can cause difficult to find errors later on.

The code-example gives 4 cases: Type/Class and Variant 1/2

Surprisingly variant 2 works for the type definition ( and for the class with /O2), where i thought it should not as the brackets produce a copy of the objects(?)

Greetings

Wolf

program MAIN
  implicit none

  ! Inner Type
  type T_B
    integer, allocatable :: arr_real(:,:)
    integer              :: dummy_1b
  end type

  ! Outer Type
  type T_A
    type(T_B)         :: arr_T_B
    integer           :: dummy_1a
    real, allocatable :: dummy_3a(:)
  end type


  type(T_A)        :: bar(1:2)
  integer, pointer :: ptr_outer(:)


  allocate(bar(1)%arr_T_B%arr_real(10,2))
  allocate(bar(2)%arr_T_B%arr_real(10,2))
  bar(1)%arr_T_B%arr_real(:,1) = [10:19]+1000
  bar(1)%arr_T_B%arr_real(:,2) = [10:19]+2000
  bar(2)%arr_T_B%arr_real(:,1) = [20:29]+1000
  bar(2)%arr_T_B%arr_real(:,2) = [20:29]+2000

  write(*,'("0x",Z8.8)')LOC(bar(1)%arr_T_B)
  write(*,'("0x",Z8.8)')LOC(bar(2)%arr_T_B)
  write(*,*)LOC(bar(2)%arr_T_B) - LOC(bar(1)%arr_T_B) !< Always 92
  write(*,*)

  ! Variant 1
  call foo(bar(1:2)%arr_T_B, ptr_outer)

  ! Variant 2
!  call foo([bar(1)%arr_T_B,bar(2)%arr_T_B], ptr_outer)

    write(*,*)"Extern"
    write(*,'(*(I6))')ptr_outer


    bar(2)%arr_T_B%arr_real(:,2) = [1:10]
    write(*,*)
    write(*,*)"Pointer modified"
    write(*,'(*(I6))')ptr_outer ! Surprisingly Variant 2 with "Type" works

  contains


  subroutine foo(arr_arg, ptr_inner)
!    type(T_B), target, intent(in   ) :: arr_arg(1:2)  !< Works
    class(T_B), target, intent(in   ) :: arr_arg(1:2)  !< Does not work

    integer,   pointer, intent(  out) :: ptr_inner(:)

    ! New(V1&V2) address for type      -> Old(V1) | New(V2) address for class
    write(*,'("0x",Z8.8)')LOC(arr_arg(1))

    ! New(V1&V2) address for type(+92) -> Old(V1) | New(V2) address for class(+52)
    write(*,'("0x",Z8.8)')LOC(arr_arg(2))

    write(*,*)LOC(arr_arg(2)) - LOC(arr_arg(1)) !< Always 52;

    write(*,*)"is_contiguous?", is_contiguous(arr_arg) ! Seems to be correct
    write(*,*)"Intern"

    ptr_inner => arr_arg(2)%arr_real(:,2)
    write(*,'(*(I6))')ptr_inner !< Printed results are wrong

    write(*,'(*(I6))')arr_arg(2)%arr_real(:,2) !< Error is thrown here

  end subroutine

end program

 

Allocatable Arrays in Fortran

$
0
0

Hello,

Can someone please help me understand what are allocatable arrays while writing a code in Fortran? When do we allocate/deallocate arrays? What is the role of the module? 

Thanks

F1 access to documentation

$
0
0

Intel folks:

Many thanks for bringing back F1 access to the Fortran documentation with the latest update 18.03. It was certainly helpful to have it available in release 19.0 beta, but essential for our production work which is using release 18.0

https://software.intel.com/en-us/articles/download-documentation-intel-c...

I note, however, that my version of WinZip (19.5) will not extract the documentation ZIP file that the link in the above Intel page contains -- WinZIP reports a error. But I believe that to be bogus, since if open the file with WinZIP and copy the entire contents to the specified folder the F1 access works as advertised. Not a big deal, but it is strange. 

 

Viewing all 5691 articles
Browse latest View live


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