Quantcast
Channel: Intel® Fortran Compiler
Viewing all 3270 articles
Browse latest View live

Optional OpenMP-Directives

$
0
0

Hi

I want to put OpenMP-directives and OpenACC-directives in one program.

In the OpenACC-program some OpenMP-directives shall be ignored (when there is an equivalent OpenACC-directive) but others shall be used (when the code has to run on CPU)

In the non-OpenAcc-program all OpenMP-directives shall be used.

I tried to opt out OpenMP by a define. The following example is minimalist:

#ifndef _OPENACC
#define MYOMP !$OMP
#else
#define MYOMP C
#endif
      PROGRAM MAIN
      OPTION EXPLICIT
      INTEGER a(1000),i

MYOMP PARALLEL DO
      DO I=1,1000
        a(i) = 0
      END DO
MYOMP END PARALLEL DO
      END
Compile with ifort 15 on Windows: ifort test.for /openmp /fpp

The compiler/preprocessor removes the !$OMP-directive. Obviously its treats as a comment.
Any Advice?
Benedikt

Output of compiler:
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 15.0.0.108 Build 20140726
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

test.for(10): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % [ : . = =>
      PARALLEL DO
-----------------^
test.for(14): error #5082: Syntax error, found IDENTIFIER 'PARALLELDO' when expecting one of: <END-OF-STATEMENT> ; BLOCK PROGRAM BLOCKDATA MODULE TYPE FUNCTION SUBROUTINE ...
      END PARALLEL DO
----------^
test.for(14): error #8731: An END BLOCK occurred without a corresponding BLOCK statement.
      END PARALLEL DO
------^
test.for(10): error #6218: This statement is positioned incorrectly and/or has syntax errors.
      PARALLEL DO
-----------------^
compilation aborted for test.for (code 1)

 


Support for passing internal procedures fails in parallel environment (not thread safe)

$
0
0

Fortran 2008 allows passing internal procedures as actual arguments and Intel Fortran supports this. A passed internal procedure can see host data so it makes it easier to write generic functions like a function integrator. In this test the host data is an element of an allocatable array. I passed the host data to my function integrator so that I could compare to see if it was the same data that could be seen by host association.

The test shows the data often does not match when using OpenMP. Try a break point on the continue statement.

Also note the access violation at the end which I don't understand.

module someFairlyOrdinaryCode
   implicit none
   contains

subroutine integrator(k, answer)
   use omp_lib
   real, intent(in) :: k
   real, intent(out) :: answer
  
   !Normally host association would be used to obtain additional data required by f(x)
   !Passing k for test purposes
   call integrateAnyFunction(f, k, 0.0, 1.0, answer)
  
contains
   real function f(x, kPassedValue)
      real, intent(in) :: x, kPassedValue
        
      !k is not visible in debugger so copy to local
      real hostK
      hostK = k
        
      !Put break point on continue
      if (hostK /= kPassedValue) then
         continue
      end if
      f = k*x
   end function
end subroutine

subroutine integrateAnyFunction(f, k, a, b, answer)
   interface
      real function f(x, k)
         real, intent(in) :: x, k
      end function
   end interface
   real, intent(in) :: a, b, k
   real, intent(out) :: answer
  
   real h, x1, x2
   integer i
   answer = 0.0
   h = (b - a)/9
   do i = 1, 10
      x1 = a + h*(i-1)
      x2 = x1 + h
      answer = answer + (f(x1, k) + f(x2, k))*h/2
   end do
end subroutine

end module

program TestOpenMPThatTookAYearToFind
   use ifport
   use someFairlyOrdinaryCode
   integer numTimes
   real, allocatable :: k(:), answer(:)
   integer i, j

   do j = 1, 2000
      numTimes = int(rand(0)*20.0) + 1
      allocate(k(numTimes), answer(numTimes))
      do i = 1, numTimes
         k(i) = i
      end do
      !$OMP PARALLEL DO
      do i = 1, numTimes
         call integrator(k(i), answer(i))
      end do
      !$OMP END PARALLEL DO
      deallocate(k, answer)
   end do
end program

 

change run time just for a line

$
0
0

Dear all,

I wrote a very complex code. I mean a code with many subroutines and functions. I used to worked fine. Last few days I noticed that the code became very very slow. After that I noticed that this depends by a single line. If I comment this line the code became very fast again.

To be more clear, this is a peace of may code:

                  CALL PDEPositivity(status,QR)
                          IF(status.LT.0) THEN
                             QR = QQ(:,jp)
                          ENDIF
                     VL(1)  = QL(2)/QL(1)
                     VL(2)  = QL(3)/QL(1)
                     VR(1)  = QR(2)/QR(1)
                     VR(2)  = QR(3)/QR(1)

                      UU  = 0.5d0*(VL+VR)
                      !
                      VL=0.d0
                      VR=0.d0
                      UU=0.d0
                      VPL=0.d0
                      VPR=0.d0
                      !
                      FL = PDEflux(nVar,UU,QL(:))
                      FR = PDEflux(nVar,UU,QR(:))
                      FI = PDEflux(nVar,VPL,QQ(:,ip))
                      Gij =  0.5d0*(FL+FR)-FI
                      Vij =  0.5d0*(VL+VR)-VPL
!
                      Vfn(:,ip) = Vfn(:,ip)+VPR*W*VOL(jp)

If I comment the line

      Vfn(:,ip) = Vfn(:,ip)+VPR*W*VOL(jp)

all became fast again.

I do bot understand why, it looks a very simple line.

Someone could explain me why or where I am wrong?

Thanks alot

Compatibility VS2008 and IMSL7

$
0
0

Hello everybody,

I'm using intel visual fortran implemented in the visual studio software VS2008 (specifications' details are joined below). My problem is that I need some mathematical functions which are not supported by the MKL library. So I would like to have access to IMSL library.

My questions are:

1. Is VS2008 compatible with IMSL7 library?

2. If YES, how can I upload it and install it? Is it free of charge?

3. If NOT, what shall I do? Do I have to upgrade VS version?

I can provide, if necessary, my login ID or my serial code.

Thank you by advance.

*******************************************************************************

Microsoft Visual Studio 2008

Version 9.0.21022.8 RTM

Microsoft .NET Framework

Version 3.5 SP1

Installed Edition: IDE Standard

Intel(R) Visual Fortran Compiler Integration     Package ID: w_cprof_p_11.1.072

Intel(R) Visual Fortran Compiler Integration for Microsoft Visual Studio* 2008, 11.1.3471.2008, Copyright (C) 2002-2010 Intel Corporation

*******************************************************************************

Mac OS X, Problems passing COMMON with a shared library.

$
0
0

I have the program:

PROGRAM main
  USE GLOBAL
  IMPLICIT NONE
  CALL open_f()
  print*,'In test',flags(1), ACC_TRUNC_F
END

and I create a shared library that contains the GLOBAL module:

MODULE GLOBAL

  IMPLICIT NONE

  INTEGER :: flags(1)
!DEC$ATTRIBUTES DLLEXPORT :: /FLAGSN/
  COMMON /FLAGSN/ flags
  INTEGER :: ACC_TRUNC_F
  EQUIVALENCE(flags(1), ACC_TRUNC_F)
CONTAINS
  SUBROUTINE open_f()
    IMPLICIT NONE
    flags(1) = 99
    print*,'In F',flags(1), ACC_TRUNC_F
  END SUBROUTINE open_f

END MODULE GLOBAL

And when I run the program the values print correctly in the subroutine, but when I print it in the main program the values are zero:

 In F          99          99
 In test           0           0

I'm using intel 15 on Mac OS X 10.9. It works if I build a static library and it works building shared on Windows.

What I'm I missing?

Misc. information:

To compile the module

libtool: compile:  ifort -g -check all -I../../src -I../../fortran/src -c H5fortran_types.f90 -o H5fortran_types.o >/dev/null 2>&1
/bin/sh ../../libtool  --tag=FC   --mode=compile ifort -g -check all -I../../src -I../../fortran/src  -c -o H5f90global.lo  H5f90global.f90
libtool: compile:  ifort -g -check all -I../../src -I../../fortran/src -c H5f90global.f90  -o .libs/H5f90global.o
libtool: compile:  ifort -g -check all -I../../src -I../../fortran/src -c H5f90global.f90 -o H5f90global.o >/dev/null 2>&1

To make the library (ignore all the other files in the library (They were empty for the testing, it's part of a bigger program),

/bin/sh ../../libtool  --tag=FC   --mode=link ifort -g -check all -I../../src -I../../fortran/src  -version-info 6:205:0   -o libhdf5_fortran.la -rpath /Users/brtnfld/hdf5/trunk.min/hdf5/lib H5f90global.lo H5fortran_types.lo H5_ff_F90.lo H5_ff.lo H5Aff.lo H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Off.lo H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo H5_DBLE_InterfaceInclude.lo H5f90kit.lo H5_f.lo H5Af.lo H5Df.lo H5Ef.lo H5Ff.lo H5Gf.lo H5If.lo H5Lf.lo H5Of.lo H5Pf.lo H5Rf.lo H5Sf.lo H5Tf.lo H5Zf.lo H5Aff_F90.lo H5Dff_F90.lo H5Eff_F90.lo H5Fff_F90.lo H5Lff_F90.lo H5Off_F90.lo H5Pff_F90.lo H5Rff_F90.lo H5Tff_F90.lo HDF5.lo ../../src/libhdf5.la -lz -ldl -lm
libtool: link: ifort -dynamiclib -undefined dynamic_lookup -o .libs/libhdf5_fortran.6.dylib  .libs/H5f90global.o .libs/H5fortran_types.o .libs/H5_ff_F90.o .libs/H5_ff.o .libs/H5Aff.o .libs/H5Dff.o .libs/H5Eff.o .libs/H5Fff.o .libs/H5Gff.o .libs/H5Iff.o .libs/H5Lff.o .libs/H5Off.o .libs/H5Pff.o .libs/H5Rff.o .libs/H5Sff.o .libs/H5Tff.o .libs/H5Zff.o .libs/H5_DBLE_InterfaceInclude.o .libs/H5f90kit.o .libs/H5_f.o .libs/H5Af.o .libs/H5Df.o .libs/H5Ef.o .libs/H5Ff.o .libs/H5Gf.o .libs/H5If.o .libs/H5Lf.o .libs/H5Of.o .libs/H5Pf.o .libs/H5Rf.o .libs/H5Sf.o .libs/H5Tf.o .libs/H5Zf.o .libs/H5Aff_F90.o .libs/H5Dff_F90.o .libs/H5Eff_F90.o .libs/H5Fff_F90.o .libs/H5Lff_F90.o .libs/H5Off_F90.o .libs/H5Pff_F90.o .libs/H5Rff_F90.o .libs/H5Tff_F90.o .libs/HDF5.o    ../../src/.libs/libhdf5.dylib -lz -ldl -lm    -install_name  /Users/brtnfld/hdf5/trunk.min/hdf5/lib/libhdf5_fortran.6.dylib -compatibility_version 7 -current_version 7.205 -single_module
libtool: link: (cd ".libs"&& rm -f "libhdf5_fortran.dylib"&& ln -s "libhdf5_fortran.6.dylib""libhdf5_fortran.dylib")
libtool: link: ar cru .libs/libhdf5_fortran.a  H5f90global.o H5fortran_types.o H5_ff_F90.o H5_ff.o H5Aff.o H5Dff.o H5Eff.o H5Fff.o H5Gff.o H5Iff.o H5Lff.o H5Off.o H5Pff.o H5Rff.o H5Sff.o H5Tff.o H5Zff.o H5_DBLE_InterfaceInclude.o H5f90kit.o H5_f.o H5Af.o H5Df.o H5Ef.o H5Ff.o H5Gf.o H5If.o H5Lf.o H5Of.o H5Pf.o H5Rf.o H5Sf.o H5Tf.o H5Zf.o H5Aff_F90.o H5Dff_F90.o H5Eff_F90.o H5Fff_F90.o H5Lff_F90.o H5Off_F90.o H5Pff_F90.o H5Rff_F90.o H5Tff_F90.o HDF5.o
libtool: link: ranlib .libs/libhdf5_fortran.a
libtool: link: ( cd ".libs"&& rm -f "libhdf5_fortran.la"&& ln -s "../libhdf5_fortran.la""libhdf5_fortran.la" )

And to make the program:

/bin/sh ../../libtool  --tag=FC   --mode=link ifort -g -check all -I../../fortran/src -I../../fortran/src    -o libh5test_fortran.la  tf_F08.lo tf.lo t.lo  -lz -ldl -lm
libtool: link: ar cru .libs/libh5test_fortran.a .libs/tf_F08.o .libs/tf.o .libs/t.o
libtool: link: ranlib .libs/libh5test_fortran.a
libtool: link: ( cd ".libs"&& rm -f "libh5test_fortran.la"&& ln -s "../libh5test_fortran.la""libh5test_fortran.la" )
/bin/sh ../../libtool  --tag=FC   --mode=link ifort -g -check all -I../../fortran/src -I../../fortran/src    -o fortranlib_test fortranlib_test-tH5F.o fortranlib_test-tH5D.o fortranlib_test-tH5R.o fortranlib_test-tH5S.o fortranlib_test-tH5T.o fortranlib_test-tH5VL.o fortranlib_test-tH5Z.o fortranlib_test-tH5Sselect.o fortranlib_test-tH5P.o fortranlib_test-tH5A.o fortranlib_test-tH5I.o fortranlib_test-tH5G.o fortranlib_test-tH5E.o fortranlib_test-tHDF5.o fortranlib_test-fortranlib_test.o libh5test_fortran.la ../../test/libh5test.la ../../fortran/src/libhdf5_fortran.la ../../src/libhdf5.la -lz -ldl -lm
libtool: link: ifort -g -check all -I../../fortran/src -I../../fortran/src -o .libs/fortranlib_test fortranlib_test-tH5F.o fortranlib_test-tH5D.o fortranlib_test-tH5R.o fortranlib_test-tH5S.o fortranlib_test-tH5T.o fortranlib_test-tH5VL.o fortranlib_test-tH5Z.o fortranlib_test-tH5Sselect.o fortranlib_test-tH5P.o fortranlib_test-tH5A.o fortranlib_test-tH5I.o fortranlib_test-tH5G.o fortranlib_test-tH5E.o fortranlib_test-tHDF5.o fortranlib_test-fortranlib_test.o  ./.libs/libh5test_fortran.a ../../test/.libs/libh5test.a ../../fortran/src/.libs/libhdf5_fortran.dylib /Users/brtnfld/hdf5/trunk.min/src/.libs/libhdf5.dylib ../../src/.libs/libhdf5.dylib -lz -ldl -lm

 

 

 

 

 

 

 

 

 

 

ifort 15: Internal compiler error

$
0
0

ifort -c -coarray cgca_m1co.f90

ifort -c -coarray -debug full -free -fPIC -warn all  cgca_m2stat.f90
cgca_m2stat.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 cgca_m2stat.f90 (code 1)
make: *** [cgca_m2stat.o] Error 1

ifort --version
ifort (IFORT) 15.0.0 20140723

the files:

http://sourceforge.net/p/cgpack/code/HEAD/tree/head/cgca_m2stat.f90

http://sourceforge.net/p/cgpack/code/HEAD/tree/head/cgca_m1co.f90

 

With some time I can narrow it down. For now, please confirm

you're getting this error too.

Thanks

Anton

Pause program to wait for external signal

$
0
0

For a fortran program are there any extensions (or even possible with Fortran standard) that can pause a program during execution and wait for a signal from an external source to resume execution.

 

My assumption is that the EXECUTE_COMMAND_LINE could work for running a separate program, but I would ideally like to have two separate programs that run in parallel and pause to communicate with each other when there is a needed information exchange. I could do binary files that one program waits for the other to update, but is there any way to send an electronic signal or even pass arrays within memory (RAM) or does that only work with subordinate programs compiled as dll?

GNU Terry Pratchett

$
0
0
 

Terry Pratchett
xkcd

This post contains no Fortran.

British author Sir Terry Pratchett died March 12, 2015 at age 66, finally succumbing to what he called "The Embuggerance", a rare form of Alzheimer’s disease, posterior cortical atrophy (PCA), which affects the rear portions of the brain. An extensive obituary can be found here, and there's also Wikipedia's page on Pratchett.

Pratchett was absolutely one of my favorite authors - I believe I had read every book he had written (plus some of his collaborations with others.) I delighted in the way he was able to use fantasy as a mirror for social issues here on Earth, with deftness, caring and humor. When my son was young, I read to him from Pratchett's works for younger readers, especially "The Bromeliad Trilogy" (Truckers, Diggers and Wings) referenced in the xkcd cartoon above, and my son was soon reading all of Sir Terry's works himself. Among Pratchett's literary creations were the character of Death, WHO SPEAKS LIKE THIS and who rides a horse named Binky, and Hex, the computer of Unseen University that runs on ants in a tube and frequently emits the message "Out of cheese error".

Not every book was great, but even the worst was very good indeed. Probably my all-time favorite is Small Gods, though I am very fond of some of his later works, including Nation and Going Postal. It is from the latter that an online tribute sprang, one that I am pleased to contribute to and from where the title of this blog post comes.

It all started in a Reddit thread. As gnuterrypratchet.com explains:

In Terry Pratchett's Discworld series, the clacks are a series of semaphore towers loosely based on the concept of the telegraph. Invented by an artificer named Robert Dearheart, the towers could send messages "at the speed of light" using standardized codes. Three of these codes are of particular import:

G: send the message on
N: do not log the message
U: turn the message around at the end of the line and send it back again

When Dearheart's son John died due to an accident while working on a clacks tower, Dearheart inserted John's name into the overhead of the clacks with a "GNU" in front of it to as a way to memorialize his son forever (or for at least as long as the clacks are standing.)

"A man is not dead while his name is still spoken."
- Going Postal, Chapter 4 prologue

Keeping the legacy of Sir Terry Pratchett alive forever.
For as long as his name is still passed along the Clacks,
Death can't have him.

The primary idea is to insert into web headers 'X-Clacks-Overhead: "GNU Terry Pratchett"'gnuterrypratchett.com has rounded up the instructions for many kinds of servers and clients. The Guardian also wrote about this.

Since 2007 when Pratchett announced "The Embuggerance", every new book from him has been a treasure. There's one last Discworld book coming this summer. It's possible that his daughter, Rhianna, will try to continue the series, but it won't be the same.

If you are unfamiliar with Terry Pratchett's works and want to know where to start, there are no end of suggestions. I mentioned The Bromeliad for younger readers (and that means just a bit simpler writing and fewer footnotes - Pratchett never wrote down to children). His earliest Discworld novels were a bit rough, so you could start with Mort, which introduces the character of Death. I mentioned Small Gods, which, while a Discworld book pretty much stands alone.

Terry Pratchett gave me so much pleasure over the decades, and his work also inspired thoughtfulness. He will be missed, but his name will live on. GNU Terry Pratchett.

Icon Image: 

  • Intel® Fortran Compiler
  • Theme Zone: 

    IDZone

    Include in RSS: 

    1

    Intel 15.0.2 OMP Runtime Error

    $
    0
    0

    I received the following error while running a Fortran code in parallel:

    OMP: Error #13: Assertion failure at kmp_runtime.c(1592).

    OMP: Hint: Please submit a bug report with this message, compiler and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/product/support/.

    I am not able to share the source code but my configurations are as follows:

    Compiler Version: 15.0.2

    Native System Compiler: gcc-4.4.7

    MPI Version: OpenMPI-1.8.2

    OS: RHEL 6.5  2.6.32-431.20.3

    ld: cannot find -lm

    Compiler Installation and Uninstallation Help, Linux and Mac OS

    $
    0
    0

     

    Installing the Intel compilers on Linux* and Mac OS* X requires that you install various prerequisite packages. 
    Linux: Read this Help on Installing the Intel Compilers.

    Mac OS X: Read this article on Xcode and Command Line tools installation (prerequisite for installation and use)

    We also have an article on Linux Silent or Non-Interactive Installation Here

    And Mac OS X Silent or Non-Interactive Installation Here

    Having trouble REMOVING or UNINSTALLING the Intel Linux compilers?  Read this article: http://software.intel.com/en-us/articles/uninstall-intel-compiler-for-linux-when-uninstallsh-is-missing-or-not-functioning

    NOTE: ARTICLES such as this are not monitored on a regular basis - do NOT ask questions here, your quesiton may go unnoticed.  Please post all questions to the USER FORUM

    OS X 10.9 Xcode 5 error ld: library not found for -lcrt1.10.6.o

    $
    0
    0

    Environment:  OS X 10.9 (Mavericks) and Xcode 5.0

    Command line compilations/links fail with "ld: library not found for -lcrt1.10.6.o"

    Affected compiler:  Intel Composer XE 2013 Update 1

    Root cause:  Xcode 5.0 installation does not install all command line tools (include files, libraries, SDKs) need for the compiler to link user applications. 

    FIX: Install the Xcode 5.0 "Command Line Tools".  Follow this Knowledge Base article for installation of this package:  http://software.intel.com/en-us/articles/installing-intel-compilers-for-os-x-pre-requisite-xcode-command-line-tools

    Using -openmp and the effect of -auto in preparing a serial code to use OPenMP

    $
    0
    0

    Hi all,

    I have a large serial code (>15k line of code) with COMMONs blocks. I wanted to start transffering some time consuming loops to work under OpneMP parallelism. After reading some different posts in Intel's forums (i.e.:https://software.intel.com/en-us/forums/topic/279757), I decided to prepare first my code for OpenMP by adding the -auto compiler option to my set of flgas.

    I'm getting different results. I'm aware to the dafult -openmp which sets also -auto. My question is - how to intial local variables / arrays in a robust way, including the COMMON blocks (at the begining of the code) to get the very same results only by adding the -auto.

    The following step would be using -openmp flag / without any caluases for now - only to verify that the defualt behavior is not messing my calculations.

    Thanks for any detailed insight that you can provide.

    Jack.   

    Unresolved externals

    $
    0
    0

    I'm using the 30-day trial of the Intel Visual Studio 2015 with C++ and FORTRAN compilers. I'm evaluating for purchase and need some help please.

    When trying to build a simple mixed language project with a C++ main calling a FORTRAN subroutine I get LNK2019, unresolved external symbol for "_sqrtf in function _G6".  The code is as follows:

    --- C++ code ---

    #included <cstdlib>

    extern "C" void _cdecl G6();

    using namespace std;

    int main( void )

    {

        G6();

        return 0;

    }

    --- FORTRAN code ---

           SUBROUTINE G6

           IMPLICIT NONE

           REAL SUM

           REAL ROOTSUM

           SUM = 1 + 2.5

           ROOTSUM = SQRT(SUM)

           END

    ---------------------------------------------

    The FORTRAN code is compiled as a static library and linked into the C++ project.

    Relevant information:

    1. When compiled as a Release version the code compiles and executes properly.  When compiled as a Debug version the unresolved error occurs.

    2. I think I'm linking in the Intel libraries correctly in the project settings - the ones in the compiler\lib\ia32 and intel64 directories.

    3. The above applies to a 32 bit project.  When I switch to a 64 bit project I get error #10310: "Failed to enable trusted storage check for licensing."  I will also need to correct this because we will need to compile 64 bit code.  If possible, please let me know how to resolve this when responding to the above problem - If necessary I can make this a separate question.

    Thanks

    Ken W.

     

    I want Non Commercial Intel Fortran Compiler

    $
    0
    0

    hi all

    I am master student 

    I want Non Commercial Intel Fortran Compiler  for Linux

    any help please 

    Thanks


    Automatic pointer targeting

    $
    0
    0

    Hello,

    As common in OO programming, an object "y" of derived type "t" should have access to some other data "x", and we grant them access by storing a local pointer "ptr" to such data.  Such pointer needs only exist inside the object "y", while in the main program we declare "x" as "target".

    Often enough, we want to handle the pointer association "y%ptr => x" through a dedicated subroutine that performs additional operations and consistency checks.  With F2003, our only option is to have a "target" dummy argument that corresponds to the actual argument "x", but this way the compiler does not perform any check to verify that "x" was indeed a "target".  I think that this may lead to undefined behaviour in certain situations where "x" was not declared as target and gets copied-in instead of being passed by reference.  Please correct me if I am wrong.

    The F2008 standard helps us here, as we could now use the "automatic pointer targeting" feature, and declare a "pointer" dummy argument with "intent(in)".  This forces the actual argument "x" to be either a "pointer" or a "target".  Unfortunately, it appears that such a useful feature is not yet implemented by the Intel Fortran Compiler, while GFortran supports it since version 4.6.  Please consider the following code:

    program p
    
      implicit none
    
      type :: t
        real, pointer :: ptr(:) => null()
      end type t
    
      real, target :: x(10) = 1.0
      type( t )    :: y
    
      ! This produces an error at compile time with ifort
      call attach_pointer( x,y )
    
      ! This produces the right result in gfortran
      write(*,*) y%ptr
    
    contains
    
      subroutine attach_pointer( from, to )
        real, pointer, intent( in    ) :: from(:)
        type( t ),     intent( inout ) :: to
        to%ptr => from
      end subroutine attach_pointer
    
    end program p
    

    Compiling with

    $ ifort -stand f08 p.f90 -o -p

    I see a compiler error:

    p.f90(13): error #6691: A pointer dummy argument may only be argument associated with a pointer.   [X]
      call attach_pointer( x,y )
    -----------------------^
    compilation aborted for p.f90 (code 1)

    I am working on a project that must be supported by gfortran and ifort both, and we would like to use "automatic pointer targeting" for the reasons above.  Is there any chance it will be included in the next ifort release?  In the meanwhile, is there a workaround I should be aware of?  Or possibly, are we overestimating the importance of such a feature instead?

    $ ifort -V

    Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.2.164 Build 20150121

    Thanks,

    Yaman

     

    Can't access GetMenuInfo function from USER32.f90

    $
    0
    0

     

    I'm using Intel Visual Fortran 2013, with MSVS 2010.  I want to access the GetMenuInfo function which is in the USER32.f90 library.

    However I'm not able to access this function.   I've tried to create a minimal test case:

     

    SUBROUTINE updatemenu(hWnd)
      USE IFWINTY
      USE USER32
    IMPLICIT NONE
      INTEGER(HANDLE)  :: hWnd
      INTEGER(HANDLE)  :: ghMenu
      INTEGER(HANDLE)  :: submenu
      INTEGER(DWORD)   :: ignor
      TYPE(T_MENUINFO) :: minfo
    
      ghMenu  = GetMenu(hWnd)
      submenu = GetSubMenu(ghMenu, 1)
      ignor   = getMenuInfo(submenu, minfo)
         
    END SUBROUTINE updatemenu

     

    When I attempt to compile this, I get the following error:

    error #6404: This name does not have a type, and must have an explicit type.   [GETMENUINFO]

    What's going on here?

     

    Thanks

    Random reading of an unformatted file?

    $
    0
    0

    Hi All,

    I have a large file of geographic information created thus:

    open(1,file=trim(shapefile),status='replace',form='unformatted',iostat=ios, &
       err=1000,recl=128,recordtype='stream')

    I read the whole file and display its information on screen. The user clicks somewhere on screen and from that I know I have to re-sample a small part of the file starting at some byte N. Is there some Fortran way I can get at that byte number immediately without having to start from the beginning of the file?

    Many thanks

    Mike

     

    Is this is bug? Error: Invalid signal or error

    $
    0
    0

    Program Test
        implicit none
      INTEGER, PARAMETER :: dble = SELECTED_REAL_KIND(P=10,R=50)
      INTEGER, PARAMETER :: sngl = SELECTED_REAL_KIND(P=5)
      REAL (KIND = dble), ALLOCATABLE, DIMENSION(:), TARGET  ::  wk3 , wk10,rsb0
      REAL (KIND = dble), DIMENSION(:), POINTER :: cpmu,rhocp,rsn
       INTEGER  err
       INTEGER  mswk10,mswk3,mst,ncomp,mstart
       integer m221,mrrb,msn,m
        REAL (KIND=dble)::result11

          mswk10=20352600
          mswk3=70480200
          mst=6784000
          ncomp=2
          mstart=1
         ALLOCATE(wk10(mswk10),wk3 (mswk3 ), STAT = err )
         ALLOCATE (rsb0(mst*ncomp), STAT = err )
        
           rhocp    => wk10(1:mst) 
           cpmu     => wk3(1:mst) 
           rsn      => rsb0( mstart:mst*ncomp )

           m221=37
           mrrb=mst-200
           msn=0
           cpmu=10104414.9170140
           rsn=1.138435243319734D-003

           rhocp(m221:mrrb) = rhocp(m221:mrrb) + cpmu(m221:mrrb)*rsn(m221+msn:mrrb+msn)
           !DO m = m221, mrrb
           !    rhocp(m) = rhocp(m) + cpmu(m)*rsn(m+msn)
           !ENDDO
           !  DO m = m221, mrrb
           !ENDDO
           DO m = m221, mrrb
               result11 =result11+ rhocp(m)
           ENDDO
           write(*,*)result11
    end program Test

     

    when mst =67840 or 678400  the calculation is correct.

    if  mst =678400  there was an error :Program Exception - stack overflow

    But if I use gfortran compile and run, there was no error

     

    AttachmentSize
    DownloadSource1.f901.17 KB

    Problem with an unresolved symbol _for__rtc_uninit_src

    $
    0
    0

    Hello,

    for one of our program suites I keep getting a bizarre link error, which my colleagues do not experience. The message is:

    error LNK2001: unresolved external symbol _for__rtc_uninit_use_src   

    By the looks of it and from checking the sources (we do not have a routine of that name) I guess that this is a routine that should be in the runtime libraries. So, my question is: how can I solve this?

    For your information:

    • I am using Visual Studio 2010
    • The version of the Intel Fortran compiler is Intel® Parallel Studio XE 2015 Composer Edition for Fortran Windows* Update 1 Integration for Microsoft Visual Studio* 2010, Version 15.0.0115.2010

     

     

     

    Viewing all 3270 articles
    Browse latest View live


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