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

dynamic character array of deferred length in subroutine

$
0
0

I have found that that dynamic character array of deferred length in subroutine could not be allocated.

Here is the sample code. One array is declared in the main program (var name is array_main) and is being passed to subroutine. In subroutine this array is being declared as array_sub1. Also subroutine contains another array - array_sub2.

And here is the problem. First array (array_sub1) has no problems with allocation in the subroutine. The allocation of array_sub2 is not seen in debugger ("Undefined pointer/array") when program is being run the next after allocation statements. At the same time there are no error signs such as non zero error stat.

Where is the problem? How to allocate array of this kind in subroutine?

Intel Visual Fortran Composer XE 2013 + Microsoft Visual Studio 2012

 program TEST_PROG
    implicit none
    CHARACTER*(:), ALLOCATABLE :: array_main(:)
    INTERFACE
        SUBROUTINE TEST_SUB (array_sub1)
            IMPLICIT NONE
            INTEGER nword, wordlen, statv
            CHARACTER*(7) errv
            CHARACTER*(:), ALLOCATABLE :: array_sub1(:)
            CHARACTER*(:), ALLOCATABLE :: array_sub2(:)
        END SUBROUTINE
    END INTERFACE

    CALL TEST_SUB(array_main)
    end program TEST_PROG

    SUBROUTINE TEST_SUB (array_sub1)
    IMPLICIT NONE
    INTEGER nword, wordlen, statv
    CHARACTER*(7) errv
    CHARACTER*(:), ALLOCATABLE :: array_sub1(:)
    CHARACTER*(:), ALLOCATABLE :: array_sub2(:)

    nword = 3; wordlen = 4
    ALLOCATE (CHARACTER(wordlen)::array_sub2(nword), STAT=statv, ERRMSG=errv)
    WRITE (*,*) statv, errv
    ALLOCATE (CHARACTER(wordlen)::array_sub1(nword), STAT=statv, ERRMSG=errv)
    WRITE (*,*) statv, errv
    array_sub2(1) = 'abab'
    array_sub2(2) = 'cdcd'
    array_sub2(3) = 'efef'
    END SUBROUTINE

 


Allocatable Array of Inherited Derived Types Issues in Fortran

$
0
0

I'm attempting to create global-ish-ly available allocatable array of a set of derived types that share inheritance with a single object. Fortran does not seem to make this very easy. The below is what I have so far.

First the derived types and module with the allocatable array.

    Module Environment

        use Entity_M
        type(Entity_C), dimenion(:), allocatable :: objects
    End Module Environment

    Module Entity_M
        type Entity_T
            integer :: id
            real*8 :: time
            real*8, dimension(3) :: currPos

            type(TrajectoryDatum), dimension(:), allocatable :: trajTable

        end type Entity_T

        type Entity_C
            class(Entity_T), pointer :: e
        end type Entity_C

        type, extends(Entity_T) :: Aircraft_T
            real*8 :: altitude
        end type Aircraft_T

        type, extends(Entity_T) :: Missile_T
            integer :: targetID
        end type Missile_T

    End Module Entity_M

Now the main program

   

 Program Main

        use Initialization
        use Environment
        use Entity_M

        call simInit(3)
        write(*,*) objects%trajTable !<---- this does not persist

        call runSim()

    End Program Main

The code with the issue

    

Module Initialization

        use Entity_M

        contains

        subroutine simInit(numOfObjects)

            integer, intent(in) :: numOfObjects

            call objectsInit(numOfObjects)
            call launchersInit()

        end subroutine simInit


        subroutine objectsInit(numOfObjects)

            use Environment

            integer, intent(in) :: numOfObjects

            !local
            type(Aircraft_T) :: aircraft
            integer :: i

            allocate(objects(numOfObjects)

            do i = 1, numOfObjects

                aircraft%trajTable = getTrajectoryData()

                call allocatePointer(objects(i)%e, aircraft)

            end do

        end subroutine objectsInit

        subroutine allocatePointer(c, t)

            class(Entity), pointer, intent(out) :: c
            type(Aircraft), target, intent(in) :: t

            c => t

        end subroutine allocatePointer

    End Module Initialization

This above just example code written on a computer that doesn't have a compiler. I did my best and hopefully if there are typos they are few. I did my best to mirror the structure of the original code.

The problem is that the field "objects%trajTable" goes back to a undefined pointer after it leaves the "objectsInit" subroutine. The other values like time, id, and currPos are still correct. How can I correct this?

I am using Visual Studio 2012 and Intel Visual Fortran 2015.

Here is a link to the stack overflow question which has slightly better formatting. http://stackoverflow.com/questions/31439117/allocatable-array-of-inherit...

Fortran pointer error inside subroutine

$
0
0

Dear all,

The following minimal code will yield to many issues with ifort 14.0.2.176 and visual studio 2013 12.0.31101.00 update 4, but I couldn't figure out what is wrong with it. It produces three issues when a structure has a member which has pointers as sub-structure. I also don't understand why it reports error when I pass the pointer inside a subroutine and declare it as pointer  (toBeCalled2). In fact, another piece of my code seems to be doing the same thing but ran into no issue. Any comment is appreciated
 

Please see inline where these occur
! issue 1: we cannot examine run_input2%test%dat1 values in visual studio
! issue 2: upon leaving the subroutine, run_input2%test%dat1 points to some junk
! issue 3: it will die inside immediately    

    ================================
          module testMod
          type test
              real*8,pointer,dimension(:):: dat1
              real*8,pointer,dimension(:,:):: dat2
          end type
          TYPE :: containsMixed
              type(test):: test
          END TYPE containsMixed
          TYPE(containsMixed) :: run_input2
          end module
    
          program main
          use testMod, Only: run_input2
          implicit none
          real*8, dimension(100),target::x
          real*8, dimension(:),pointer::p2=>null()
          x=100D0
          run_input2%test%dat1 =>  x  ! issue 1: we cannot examine run_input2%test%dat1 values in visual studio. 
          
          print*, run_input2%test%dat1(1)
          call toBeCalled(run_input2%test%dat1)
          print*, run_input2%test%dat1(1:2) ! it will produce 2, 100 which is correct
          call toBeCalled2(run_input2%test%dat1)  ! issue 2: upon leaving the subroutine, run_input2%test%dat1 points to some junk
          print*, run_input2%test%dat1(1:2) ! see junk  
           if(associated(p2)) deallocate(p2)
          call toBeCalled2(p2)  ! issue 3: it will die inside immediately
          print*, run_input2%test%dat1(1:2) ! it will produce 2, 100 which is correct
    end program
          
    subroutine toBeCalled(dat)
    real*8, dimension(*) ::dat
    dat(1)=2;
    end subroutine
          
    subroutine toBeCalled2(dat)
    ! issue 2: it will die inside
    real*8, dimension(:),pointer ::dat
    real*8, dimension(:),pointer::x2
    allocate(x2(200))
    x2 = 200
    dat=> x2;
    print*, dat(1:10)
    end subroutine

LIBCMT.LIB external symbol error

$
0
0

Hi

I am compiling and linking code developed by another source. They have recently changed to using Fortran 11.1 so we are using the trial version of that compiler (previously using 9.1).

can you suggest the cause of the following errors?

libifcoremt.lib(for_init.obj) : error LNK2001: unresolved external symbol __imp_GetModuleHandleA
libifcoremt.lib(for_aio.obj) : error LNK2001: unresolved external symbol __imp_GetModuleHandleA
libifcoremt.lib(for_exit_handler.obj) : error LNK2001: unresolved external symbol __imp_GetModuleHandleA
libifcoremt.lib(for_diags_intel.obj) : error LNK2019: unresolved external symbol __imp_CreateFileA referenced in function for__dump_msg_buff
libifcoremt.lib(for_nt_open_proc.obj) : error LNK2001: unresolved external symbol __imp_CreateFileA
LIBCMT.lib(open.obj) : error LNK2001: unresolved external symbol __imp_CreateFileA
LIBCMT.lib(initcon.obj) : error LNK2001: unresolved external symbol __imp_CreateFileA
libifcoremt.lib(for_init.obj) : error LNK2019: unresolved external symbol __imp_SetErrorMode referenced in function for_rtl_init_wrap_
libifcoremt.lib(for_init.obj) : error LNK2019: unresolved external symbol __imp_GetCommandLineA referenced in function for_rtl_init_wrap_
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol __imp_GetCommandLineA
libifcoremt.lib(for_init.obj) : error LNK2019: unresolved external symbol __imp_GetACP referenced in function for_rtl_init_wrap_
LIBCMT.lib(mbctype.obj) : error LNK2001: unresolved external symbol __imp_GetACP
LIBCMT.lib(getqloc.obj) : error LNK2001: unresolved external symbol __imp_GetACP
libifcoremt.lib(for_init.obj) : error LNK2019: unresolved external symbol __imp_SetConsoleCtrlHandler referenced in function for_rtl_init_wrap_
LIBCMT.lib(winsig.obj) : error LNK2001: unresolved external symbol __imp_SetConsoleCtrlHandler
libifcoremt.lib(for_aio.obj) : error LNK2019: unresolved external symbol __imp_DeleteCriticalSection referenced in function for__aio_destroy
LIBCMT.lib(mlock.obj) : error LNK2001: unresolved external symbol __imp_DeleteCriticalSection
LIBCMT.lib(ioinit.obj) : error LNK2001: unresolved external symbol __imp_DeleteCriticalSection
LIBCMT.lib(closeall.obj) : error LNK2001: unresolved external symbol __imp_DeleteCriticalSection
libifcoremt.lib(for_aio.obj) : error LNK2019: unresolved external symbol __imp_InitializeCriticalSection referenced in function for__aio_acquire_lun_fname

Many more of the same type

thanks

Alison

 

troubleshooting user subroutine with abaqus 6.10

$
0
0

Hi Dear,

 

Im trying to implement subroutine umat(user defined code is written in 2006- not sure which version of abaqus is used?! ) and run a job.However, i,m getting this error through  abaqus cae and cmd (attached file),i was wondering if you could help me out?i,m using abaqus 6.10 -VS2008-IVF 11 AND successfully run some examples from abaqus verification.i also can send my fortran file ( .for) and input abaqus file for more clarification if you require.

is it possible that mismatching abaqus version cause this kinda error?i mean running a subroutine(written code in 06) is it sensetive to abaqus versions(6.10)? 

any help really apreciated.

 

 

ERROr on cae :
 

The executable J:\SIMULIA\Abaqus\6.10-1\exec\standard.exe aborted with system error code 144. Please check the .dat, .msg, and .sta files for error messages if the files exist.  If there are no error messages and you cannot resolve the problem, please run the command "abaqus job=support information=support" to report and save your system information.  Use the same command to run Abaqus that you used when the problem occurred.  Please contact your local Abaqus support office and send them the input file, the file support.log which you just created, the executable name, and the error code.

 

With regards,

Milad

AttachmentSize
Downloaderr1.png31.21 KB

Intel Fortran Static Library with OpenMP enabled

$
0
0

Hello,

In our group, we work with different versions of Intel Visual Fortran. Recently, we have included some parallelization directives in some subroutines. It seems that when we create a static library with an older version of Intel Fortran that includes OpenMP parallelization, this library cannot run properly in a new version of Intel Visual Fortran, producing a run-time error. Is this normal? Would it be any way around it? When we do not include processing for OpenMP directives, the functioning of the library is proper. Thank you very much.

Please help with error LNK2019

$
0
0

 

Hello, I am trying to build and compile a Fortran 77 program in Visual Studio 2013, using Intel Fortran.

The program consists of a main .for file, and many .for and .f subroutines. To run it, I create a new Fortran console project, and load all the .for and .f files. Then, when I try to build, I get the following error:

Error    1     error LNK2019: unresolved external symbol _MAIN__ referenced in function _main    libifcoremdd.lib(for_main.obj)    
Error    2     fatal error LNK1120: 1 unresolved externals    Debug\test.exe    

 

What am I doing wrong?

 

Moving to iFort from gFortran

$
0
0

From a command line, I had a couple of scripts which did the following:

To compile:

          gFortran -c %1.f95

Then to put each object and MOD into a static library:

          ar r MyLib.a %1.o %1,mod

And finally to compile the main program, link it, and create an EXE

gfortran -o Test Test.f90 MyLib.a

I would like to do the same with iFort, xilink, etc. How do I accomplish this ? PS, I hate make so please don't suggest it.

Thanks,

Brooks Van Horn


Composer 15 can't find MKL

$
0
0

Hi.  I just installed Composer 15 and the associated MKL libraries and integrated them with my previously existing version of Parallel Studio 2010.  The web told me that Composer 15 would replace Composer 13, which I had not uninstalled, but it appears to have installed Composer 15 in its own folder, while leaving Composer 13 alone. 

I rebooted my computer and tried to compile and link some code using a makefile.  I got the following errors:

Wal83.f(5): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MKL95_LAPACK]

      USE mkl95_LAPACK, ONLY: GEEV

----------^

Wal83.f(241): error #6406: Conflicting attributes or multiple declaration of name.   [GEEV]

        CALL GEEV(TestMat,WR,WI,INFO=INFO)

-------------^

Wal83.f(5): error #6580: Name in only-list does not exist.   [GEEV]

      USE mkl95_LAPACK, ONLY: GEEV

------------------------------^

compilation aborted for Wal83.f (code 1)

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64\ifort.EXE"' :

 return code '0x1'

Stop.

According to information given at https://software.intel.com/en-us/node/528327, I ran the following command from the command line, while in the following directory: C:\Program Files (x86)\Intel\Composer XE 2015\mkl\bin.

mklvars intel64 mod

I tried running the makefile again, rebooted my computer again, and tried running the makefile a third time.  Each time I got the same errors as before.

It appears that the compiler can’t find the mkl library, but I don’t know what else to do to set the path.

The code for the makefile I am using for composer 2015 is:

LINCL=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\include

LINCL_95=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\include\intel64\lp64

L1=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64\mkl_intel_lp64.lib

L2=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64\mkl_intel_thread.lib

L3=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64\mkl_core.lib

L4=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64\mkl_sequential.lib

L5=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64\mkl_blas95_lp64.lib

L6=C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64\mkl_lapack95_lp64.lib

all:

      ifort /I"$(LINCL)" /I"$(LINCL_95)" Wal83.f Wmod83.f ModApril2013.f  \

      "$(L1)""$(L2)""$(L3)""$(L4)""$(L5)""$(L6)"

cls:

      del -f *.obj *.exe *.log

If anyone can help me, I would be most grateful!

Rebecca

      

how to configure the intel mpi in visual studio 2012

$
0
0

HI friends,

I want to know how to configure and setup the intel mpi in vs2012,so I counld debug and run the mpi code in vs2012.

my mpi version is 5.0.1.037.

thanks

Internal read: want to read an integer into a real variable

$
0
0

I want to use an internal read as follows:

if (iStnPress /= 99999) read(iStnPress, '(f5.1)') StnPress

Here, iStnPress is declared an integer; StnPress is declared real.

Before the line is executed, iStnPress has been read as '9245'.

My hope was to have StnPress be set to '924.5'

Unfortunately, I get a runtime crash w/ IVF, with the hint that it's taking '9245' to be a unit number.

Any thoughts?  Am I trying to do the impossible?

 

 

Fortran calling vb.net

$
0
0

Is it possible to call vb.net from fortran?  If so, is there an example available anywhere, or can someone please describe the syntax for doing this.

I really do mean going from fortran to vb.net.  Which is the opposite way from what most people want to do.

Visual Studio 2015 Support

$
0
0

Hi Lionel,

Microsoft just release Visual Studio 2015, and we plan to upgrade. Any idea when Intel will start supporting integration with this version?

Thank you.

error with deferred size character array with fixed length

$
0
0

I have a module that does this (among other things):

module tryit
implicit none

character(len=:),allocatable,dimension(:),save :: subtitle

contains

subroutine setSubTitle(lines)
character(len=*),dimension(:) :: lines
subtitle=lines
end subroutine setSubTitle

subroutine getSubTitle ( lines )
character(len=*),dimension(:),intent(out) :: lines
if (allocated(subtitle)) lines = subtitle
end subroutine getSubTitle

end

This works fine. But I had a reason to consider making the length of subtitle a constant, e.g.:

character(len=60),allocatable,dimension(:),save :: subtitle

This crashes on the first reference to subtitle *after* the assignment. Should this work?

In each case I tried the actual argument passed as lines was a static array, e.g.:

character(len=220),save :: buffer(20)

call setSubTitles(buffer(3:9))

 

compaq fortran project generates 8284 error message

$
0
0

I have a LIB project I've been using for years with Compaq fortran.  When I compile it with Intel Fortran I get many error 8284's because scalers are being passed into array arguments in subroutine calls.

Is there a compiler option in Intel Fortran to allow this?


OpenMP and /QopenMP switch

$
0
0

Hello,

I encountered an issue due to openMP. The results from the sequential code is OK while the parallel one is wrong and random (suggesting a race condition). The structure looks like this :

!$OMP DO PRIVATE{i,j,var3}
do i = 1, n
[blabla...]

   do j=1,jj
      a = interpol( var1(i), j,  var3)
   end do

[blabla...]
end do
!$OMP END DO

where interpol is a library function with no common, share variable nor "save" attribute at all. Adding !$OMP CRITICAL  around the inner do loop solves the issue but a significant part of the parallelization gain is lost. 

Eventually I solved the issue by adding the /Qopenmp switch to the library compilation, even though there no OMP directive at all in the code. So problem solve but I missing the why and thus doubt about the robustness of the fix. 

Can somebody explain me the effect of the /Qopenmp switch when there is no OMP directive ?

   Thanks,

Guillaume

 

 

 

Fix for 2015 Update 4 Composer Edition install exiting

$
0
0

Some users may experience a problem where installing Intel Parallel Studio XE 2015 Composer Edition for Fortran Windows Update 4 exits the installer after clicking Next on the first install screen. This is most likely to occur if the system also has Intel VTune Amplifier XE or Intel Advisor XE installed.

The problem will be fixed in Update 5. A workaround is as follows:

  • Save the attached file composer_xe_2015_common.zip and unpack it to your desktop, creating composer_xe_2015_common.js
  • Run the w_fcompxe_2015.4.221 installer - uncheck the box for removing the installer files.
  • Once the installer finishes unpacking the files and shows the initial "splash screen", cancel the install.
  • Copy the composer_xe_2015_common.js file you unpacked to C:\Program Files (x86)\Intel\Download\w_fcompxe_2015.4.221\config\PreRequisites  (If you unpacked to a different location, adjust accordingly) This will require administrator privilege.
  • Open a command prompt window and "cd C:\Program Files (x86)\Intel\Download\w_fcompxe_2015.4.221\" (If you unpacked to a different location, adjust accordingly)
  • Type "setup.exe -nsev"

The install should now complete.

An alternative workaround is to download and run the installer for Update 4 of the Professional or Cluster Edition, if your license provides access to that.

ifortvars.bat not found

$
0
0

i install Intel Composer XE 2015 but i don´t find ifortvars.bat. Can someone Help to solve this problem?

 

AttachmentSize
DownloadUnbenannt.jpg81.79 KB

Create an INTERFACE or a FUNCTION with OPTIONAL arguments

$
0
0

This is a question of programming style and effectiveness (speed).  I have the option of creating two possible array accessors:

MODULE Stuff
INTERFACE Get_Val
    MODULE PROCEDURE Get_Val_One, Get_Val_Three
END INTERFACE Get_Val
INTEGER, PRIVATE :: II, JJ, KK, IJK
INTEGER, PARAMETER :: F = SELECTED_REAL_KIND(6, 30)
REAL (KIND = F), DIMENSION(:), ALLOCATABLE, PRIVATE :: ValArray

CONTAINS
REAL (KIND = F) FUNCTION Get_Val_One(IDX)
    INTEGER, INTENT(IN) :: IDX

    Get_Val_One = ValArray(IDX)
END FUNCTION Get_Val_One
REAL (KIND = F) FUNCTION Get_Val_Three(I, J, K)
    INTEGER, INTENT(IN) :: I, J, K

    INTEGER :: IDX
    IDX = ((K - 1) * JJ + J - 1) * II + I
    Get_Val_Three = ValArray(IDX)
END FUNCTION Get_Val_Three
!  Other functions setting values of the ValArray and one- and three-dimensional array bounds
END MODULE Stuff

The other array accessor would be the following:

MODULE OtherStuff
INTEGER, PRIVATE :: II, JJ, KK, IJK
INTEGER, PARAMETER :: F = SELECTED_REAL_KIND(6, 30)
REAL (KIND = F), DIMENSION(:), ALLOCATABLE, PRIVATE :: ValArray

CONTAINS
REAL (KIND = F) FUNCTION Get_Val(I, J, K)
    INTEGER, INTENT(IN) :: I
    INTEGER, INTENT(IN), OPTIONAL :: J, K

    INTEGER :: IDX

    IF (PRESENT(J) .AND. PRESENT(K)) THEN
        IDX = ((K - 1) * JJ + J - 1) * II + I
    ELSE
        IDX = I
    END IF
    Get_Val = ValArray(IDX)
END FUNCTION Get_Val
!  Other routines setting ValArray values and one- and three-dimensional array bounds
END MODULE OtherStuff

Is there any difference speed-wise and memory-footprint wise between the two options.  Which option might be preferable?

lost installation in hard drive failure - now what?

$
0
0

I owned a license to Intel Fortran, and had it on my machine.  I suffered a catastrophic hard drive failure (actually, two in a row), and the replacement drive no longer has the installation.

I've been wandering around completely lost on the Intel site trying to figure out what to do.  The support seems deliberately designed to be impossible to contact for help.  I have the emails with the original product serial number and SKU, but I see nothing I can do with it.

What do I do?  Do I download a trial ,then try to enter my original license information?  I really need this software quite badly right now, I spent a *lot* of money for a single-person license, and I need to get it back.

Any thoughts gratefully appreciated....

Viewing all 5691 articles
Browse latest View live


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