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

parallel calculation using a DLL

$
0
0

I have searched, with no success, an example of parallel computation  where a called fundamental function is implemented in a DLL.

I.e. the basic structure to be parallelized is:

DO I=1,N,1

CALL SUB1(ZPARM1(I),ZPARM2(I), ..., OUTVAL1(I))

ENDDO

with SUB1 implemented as a DLL.

Does anybody knows some example ?

Regards


PrefetchInsertionOpt="prefetchAggressive"

$
0
0

I'm trying to change a few compiler flags to get a faster run time on ifort 2015 Update 4, x64, on E5-2699v3 and E5-1650v3.  I started with:

                <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" MultiProcessorCompilation="true" Optimization="optimizeFull" GenAlternateCodePaths="codeForCommonAVX512" IntegerKIND="integerKIND8" RealKIND="realKIND8" LocalSavedScalarsZero="true" FloatingPointExceptionHandling="fpe0" FloatingPointModel="source" FlushDenormalResultsToZero="true" Traceback="true"/>

This was my base case, #01, with a (normalized) running time of 1.0.

For case #02, I added QxSSE41, and now my running time went up to about 1.07, and the number of required timesteps went up by 4.6%.  I thought this flag would have no effect on CPUs that have AVX instructions?  The reason I added this, is because I thought it would be a pre-requisite for case #03.

Now for case #03 I added Aggressive Prefetch flag.  Now my running time went down to 0.94.  Results are digit for digit identical to case #02.  Nice performance improvement!  But...

For case #04, I tried to set the "required" flags to be for CPUs supporting AVX (I figure, less code to detect what kind of CPU instructions are available should enhance the running time), so now I have:

                <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" MultiProcessorCompilation="true" Optimization="optimizeFull" GenAlternateCodePaths="codeForCommonAVX512" UseProcessorExtensions="codeExclusivelyAVX" PrefetchInsertionOpt="prefetchAggressive" EnableEnhancedInstructionSet="codeArchAVX" IntegerKIND="integerKIND8" RealKIND="realKIND8" LocalSavedScalarsZero="true" FloatingPointExceptionHandling="fpe0" FloatingPointModel="source" FlushDenormalResultsToZero="true" Traceback="true"/>

Now, for case #04, my results are digit for digit identical with case #01, and the running time is 0.99.  It looks like the Prefetch flag got disabled.

So, my questions are:

-How exactly does the Prefetch flag work?  It looks like a very nice way to get some respectable performance gains, but I can't get it to work consistently.

-What do the UseProcessorExtensions/EnableEnhancedInstructionSet flags do to change the results, or disable the Prefetch optimization, given that I already have GenAlternateCodePaths="codeForCommonAVX512"?

visual studio question, line scroll up and down

$
0
0

My older versions of visual studio allowed scrolling the editor display up or down a line with control up and down arrow.  Can Visual Studio 2012 do this?  Control arrow doesn't do it, but are there other hotkeys that do, or can these commands be assigned to these keys?

Thanks

Brian

Brevard, NC

Is this standard Fortran 2008?

$
0
0

Is this code standard Fortran 2008?

MODULE PRECISION
IMPLICIT NONE
INTEGER,PARAMETER :: DP = 8
END MODULE PRECISION
MODULE M
USE PRECISION
IMPLICIT NONE
INTERFACE
    REAL(KIND=DP) MODULE FUNCTION F(X)
        REAL(KIND=DP),INTENT(IN) :: X
    END FUNCTION F
END INTERFACE
END MODULE M

I have another compiler who complains that DP in the "REAL(KIND=DP) MODULE FUNCTION F(X)" statement is not defined.
 

binary compatibility

$
0
0

We have run into a problem installing multiple versions of our application which uses the Intel Fortran runtime libraries.

The scenario is this. 

Application version 1 uses some Fortran dlls compiled with a 2013 Fortran version.  The install for this application thus uses the runtime libraries from 2013 Fortran (Version numbers vary here a little, but in general the binaries have major version number 14).

Application version 2 uses an updated 2015 Fortran to compile our dlls and thus uses runtime libraries from 2015 Fortran (Again, there is some variation in the version numbers, but in general these binaries have major version number 15).

The installation of the Intel libraries for both versions of the application is managed through the Intel installer (merge module) through our installation package.  The following installation procedure on the same machine causes application version 1 to break:

Install version 1 (this installs the redistributable Fortran binaries to ...Common Files\Intel\Shared Libraries\redist\ia32\compiler).  These are the 2013 version binaries with major version number 14.

Install version 2 (this installs the redistributable Fortran binaries to ...Common Files\Intel\Shared Libraries\redist\ia32\compiler).  These are the 2015 version binaries with major version number 15.

 

As part of the installation of version 2, the redistributable Fortran binaries are overwritten with the newest binaries.

Version 2 of our application runs fine.  And, on startup of version 1 of the application, all is ok.  But, when we invoke code that uses the Fortran binaries, the application crashes.

This seems to indicate a problem with binary compatibility.

Could someone provide more information on expectation of binary compatibility; that there is no "versioning" expected of the redistributables i.e. installation of an older version followed by a newer version will yield the newer version only which should be compatible with our binaries compiled against the older Fortran version.  Additionally, since we need to be able to support client installs of multiple versions of our application compiled against different (seemingly incompatible Fortran versions), we are considering moving the required redistributables into our application install location as a workaround for this problem.  We'd like some feedback on potential pitfalls of this approach.

Linking .lib file with visual studio

$
0
0

I have a MAIN file that calls a couple of functions in a apples.lib file. I drag the oranges.f and apples.lib file into the solution explorer, under the "Source Files". After pressing "Build Solution", 3 errors come up : "Fatal error LNK1120: 2 unresolved externals", "error LNK2019 : unresolved external symbol ABC referenced in function _MAIN__", "error LNK2019: unresolved external symbol XYZ in function _MAIN__".

I am able however to successfully compile and link the files with a makefile and using "nmake /f makefile". What am I missing to do it in Visual Studio ? I have Parallel Studio XE 2013 with VS2010.

Thank you.

How to output a matrix without changing to a new line?

$
0
0

For example

program main
integer m
complex cjj
complex matrix(3, 5)

cjj=(0.0, 1.0)
matrix(1, :)=2*cjj
matrix(2, :)=2+1*cjj
matrix(3, :)=5*cjj+6

open(16, file='data.txt')
do m=1, 3
write(16, *)matrix(m, :)
enddo
close(16)
end

The above code does not work well. What I want is that the data in the output file is the same as the dimension of the matrix.

For this case, the size of the matrix is 3*5. What I want is also there are 3 lines ,and each line has 5 values.

What VS displays when I hover over or click on a variable name

$
0
0

When I click on a variable name, the name is conveniently highlighted. I like this very much and have come to depend on it. But it doesn't always do this. It seems stop suddenly and randomly; for example when I change from one source file to another, or after a debug run. Sometimes it works on some tokens but not others; other times it works on all of them even in the same file. Sometimes I can close VS, fire it up again, and it will be working. But not always. I have come up with many hypotheses why it sometimes does not work--the token is not strong typed; it is declared only in a module; I am in the debugging process, etc. But nothing seems consistent.

When I hover over a variable name, a popup window conveniently shows the variable type. This I also like very much but it doesn't always work.

Sometimes one of these features works but not the other; sometimes both will work; sometimes neither.

As far as I can see, there is no documentation about either of these features. It would be a lot easier to "reverse engineer" the seemingly random behavior if I knew how/when they are SUPPOSED to work.

I assume everyone else must experience this, no? Can anyone help me understand what's going on?


Check INCLUDE paths [IFPROT]

$
0
0

In a subroutine I use the SYSTEM-function. For that I had to "USE IFPROT".
When I try to compile the subroutine, I get the error #7002: Error in opening the compiled module file. Check INCLUDE paths. [IFPROT]
 

 

Linker warnings LNK4006 and LNK4221

$
0
0

When I link my library I get many warnings LNK4006 "NULL_IMPORT_DESCRIPTOR already defined in kernel32.lib(KERNEL32.dll); will be ignored".

The warnings seem to come from user32.lib, gdi32.lib, winspool.lib, comdlg32.lib, advapi32.lib, shell32.lib ...

C calling Fortran where an argument is a derived type

$
0
0

I have a Fortran subroutine which I want to call from C.  One of the arguments is a derived type such as:

type :: pprop
  real*8 :: x1
  real*8 :: x2
  real*8 :: x3
  real*8 :: x4
end type pprop

On the C side, what can I map this to?  Will an array work as all the components are of the same type?  Or do I have to map to a struct?

Input data file with columns divided in blocks

$
0
0

Hello all,

I need to read a 62x14 table which is generated by an external program. However the external program splits the table in two parts, showing the first 10 columns and the remaining columns just below the first part. Is it possible to read such table in my Fortran code? What should be done?

 

Thanks,

 

Paulo

System and SystemQQ: what am I doing wrong?

$
0
0

Hi,

I want to do something that is quite simple (I reckon).  I must go up one folder level, chdir to another folder and then delete one existing file in this latter folder.  What I'm doing is the following:

         Logical :: I

         I = SystemQQ('cd ..\Data\')
         I = SystemQQ('del CPG.dat')

However, it seems that not even the first command works, I mean, I cannot go up one level and then into the Data folder.  The command System (by the way, in what it differs from SystemQQ?) doesn't work either.  Same result if I split the first command:

         I = SystemQQ('cd ..')
         I = SystemQQ('cd Dados')
         I = SystemQQ('del CPG.dat')

What am I doing wrong?  My system's specs are appended below.

Thanks a lot for any help.

Fausto

Windows 7

Microsoft Visual Studio 2005
Version 8.0.50727.867  (vsvista.050727-8600)
Microsoft .NET Framework
Version 2.0.50727 SP2

Fortran calling C++ stdcall DLL

$
0
0

Why can I link my Intel Fortran  dll (sum_if.dll)  to my Fortran (sum_test)  but not my C++ one (sum_cpp.dll)?     All are accepted as STDCAL DLLs by other software e.g. Excel VBA (in the attached .zip)

Fortran Linking to sum_if  works with any of:

  1. Linker | Input |  Additional Dependecies= sum_if.lib
  2. Adding.lib to project (e.g. sum_if.lib)
  3. Project Dependencies = sum_if

But for sum_cpp the dll is not found or accepted   i.e.

sum_test.obj : error LNK2019: unresolved external symbol __imp_sum referenced in function _MAIN__

Dependency Walker  shows function=sum on both. So hopefully it is not a "Decoration" issue?

I have attached the VS Community 2013 Solution, as I hope/ expect  the answer is hidden there. 

1. VS 2013 Solution= sumdll  Projects: = Win32

All sharing same ..\Output\Release and Debug directories.  The excel “double check”  lives in Debug. This helps simplify and clarify "finding" the DLL (I wanted to avoid full paths) 

1.1 Sum_if.dll contains:

function sum(a,b)
IMPLICIT NONE
  ! Expose subroutine ExcelDLL to users of this DLL
  !DEC$ATTRIBUTES STDCALL, DLLEXPORT, ALIAS: 'sum'	:: sum
  !DEC$ATTRIBUTES Value :: a,b
  ! Variables
  integer*4 a,b,sum
  ! Body of ExcelDLL
  sum=a+b
end function sum

1.2 Sum_cpp.dll 

//  Sum_cpp.cpp contains:
int _stdcall sum(int x, int y){
	return x+y;
}

// Sum_cpp.def contains:
LIBRARY	"sum_cpp""
	EXPORTS sum @

1.3 Sum_test

   Interface
      function sum(a,b)
        IMPLICIT NONE
        ! Expose subroutine ExcelDLL to users of this DLL
        !DEC$ ATTRIBUTES DLLIMPORT, ALIAS:'sum'	:: sum
        !DEC$ATTRIBUTES Value :: a,b
        ! Variables
        INTEGER*4 a,b,sum
      end function sum
    End Interface

    INTEGER*4  :: a_i4b, b_i4b, c_i4b,d_i4b, I, j
    print *, 'add integers'
    a_i4b=7
    b_i4b=43
    c_i4b=sum(a_i4b,b_i4b)
    write(*,'(I10,A,I10,A,I10)')  a_i4b," + ", b_i4b," = ",c_i4b
    end program vf_dll_test

2. Excel VBA Declares

' all work fine:' C++
Declare Function sumcpp Lib "sum_cpp.dll" Alias "sum" (ByVal i As Long, ByVal j As Long) As Long' Intel Fortran 10.1
Declare Function sumif Lib "sum_if.dll" Alias "sum" (ByVal a As Long, ByVal b As Long) As Long

Peter

 

AttachmentSize
Downloadsumdll.zip8.32 MB

Free Intel Visual Fortran for students!

$
0
0

Intel Fortran is now available under a free, non-commercial license for qualified students on Linux, OS X and WIndows. See https://software.intel.com/en-us/qualify-for-free-software/student for more details.

Note: If you don't already have a supported Microsoft Visuall Studio installed, you'll need to get one first as the student license doesn't include the VS Shell-based IDE. The free Visual Studio 2013 Community Edition will do.


Modules and subroutines

$
0
0

Hello everyone,

I am new to fortran.. I am facing difficulty in calling subroutine and module from main program. When I run the program , its gives error about line 95 d.

sometimes it gives error SALFORD RUN TIME ERROR-STACK OVER FLOW

Please check any mistake in the following code:

Regards,

Ali

  1. Module variables_m

 

  1. integer lon,lonmax,xx,yy     ! longitude
  1. integer lat,latmax     ! latitude
  2. integer yr,yrmax       ! year
  3. integer mon,monmax     ! month
  4. integer num            ! arbitral number
  5. integer i,j,k
  6. parameter (lonmax=320) ! num of grids (longitude)
  7. parameter (latmax=160) ! num of grids (latitude)
  8. parameter (yrmax=101)  ! num of years totally
  9. parameter (monmax=12)  ! num of months per year
  10. real:: idata(lonmax,latmax*monmax*yrmax)
  11. real data(lonmax,latmax,monmax,yrmax)
  1. real, dimension(1:10)::ave
  2. integer count,tt,sy,ey
  3. real:: summ

 

  1. end module variables_m
  1. module readbinaryfile_m
  2. use variables_m
  3. contains
  4. subroutine readbinaryfile()

 

 

 

 

 

  1. open(8,file='monthly_temperature_1900to2000.bin',access='direct',recl=lonmax*1)
  1. do num=1,latmax*monmax*yrmax
  1. do           lon=1,lonmax
  2. read(8,rec=num) idata(lon,num)
  3. end do
  4. enddo    
  5. close(8)
  6. end subroutine readbinaryfile    
  1. end module readbinaryfile_m
  1. module printallvalues_m
  2. use variables_m
  3. use readbinaryfile_m
  1. implicit none
  1. contains
  2. subroutine printallvalues()
  1. integer lon,lonmax,xx,yy     ! longitude
  2. integer lat,latmax     ! latitude
  3. integer yr,yrmax       ! year
  4. integer mon,monmax     ! month
  5. integer num            ! arbitral number
  6. integer i,j,k
  7. parameter (lonmax=320) ! num of grids (longitude)
  8. parameter (latmax=160) ! num of grids (latitude)
  9. parameter (yrmax=101)  ! num of years totally
  10. parameter (monmax=12)  ! num of months per year
  11. real:: idata(lonmax,latmax*monmax*yrmax)
  12. real data(lonmax,latmax,monmax,yrmax)
  1. real, dimension(1:10)::ave
  2. integer count,tt,sy,ey
  3. real:: summ
  1. open(9,file='all_values.csv',status='replace')
  2. num=1
  1. do yr=1,yrmax
  1. do mon=1,monmax
  2. do lat=1,latmax
  3. do lon=1,lonmax
  4. data(lon,lat,mon,yr)=idata(lon,num)
  5. write(9,*) data(lon,lat,mon,yr)
  6. end do
  7. num=num+1
  8. end do
  1. end do
  2. end do
  1. close(9)
  1. end subroutine printallvalues
  1. end module printallvalues_m
  1. module decadalmeantemperature_m
  2. use variables_m
  3. use readbinaryfile_m
  4. use printallvalues_m
  5. implicit none
  6. contains
  1. subroutine decadalmeantemperature()
  1. integer lon,lonmax,xx,yy     ! longitude
  2. integer lat,latmax     ! latitude
  3. integer yr,yrmax       ! year
  4. integer mon,monmax     ! month
  5. integer num            ! arbitral number
  6. integer i,j,k
  7. parameter (lonmax=320) ! num of grids (longitude)
  8. parameter (latmax=160) ! num of grids (latitude)
  9. parameter (yrmax=101)  ! num of years totally
  10. parameter (monmax=12)  ! num of months per year
  11. real:: idata(lonmax,latmax*monmax*yrmax)
  12. real data(lonmax,latmax,monmax,yrmax)
  1. real, dimension(1:10)::ave
  2. integer count,tt,sy,ey
  3. real:: summ
  1. open(10,file='10 Years average.csv',status='replace')
  2. write(10,*) 'Interval',',','Average Decadel Temp'
  1. sy=1
  2. ey=10  
  1. do k=1,10
    1. summ=0.0
    2. count=0
  2. do yr= sy,ey
  1. ave=0.0

.yy=1899+sy

  1. xx=1899+ey
  1. do           mon=1, 12
  2. do           lat=1,160
  3. do           lon=1,320
  4. summ =summ+ data(lon,lat,mon,yr)
  5. count=count+1
  1. end do
  2. end do
  3. end do
  4. end do
  1. sy=ey+1
  1. ey=ey+10
  2. if (ey==100) then
  3. ey=101
  4. end if
    1. ave(k) =summ/count
  5. write(10,*) yy,'-',xx,',', ave(k)
  1. end do
  1. close(10)
  1. end subroutine decadalmeantemperature
  2. end module decadalmeantemperature_m
  1. program envfluidmechanics
  1. use variables_m
  2. use readbinaryfile_m
  3. use printallvalues_m
  1. use decadalmeantemperature_m
  2. call decadalmeantemperature

 

 

  1. end program envfluidmechanics

 

Debugger jumps into memcpy.asm

$
0
0

I am just going through my program in debug mode. Currently I have the problem, that when a value is assigned to a variable, the debugger jumps into  memcpy.asm. I don't want to see this!

I think there's a project property set wrong, but which one?

!OMP SIMD useage

$
0
0

This useful new feature seams only possible on explicit do loops. Why was it not thought to be useful for implicit loops, i.e array assignment ? Is it too hard to implement ?

LNK2005 error when compiling for Debug x64 (mixed C++/Fortran)

$
0
0

Hi all, I'm attempting to recompile a mixed C++/Fortran project for a x64 platform / Debug configuration but keep running into a LNK2005 error. The Fortran code is compiled to a static library while the C++ code -- which calls the Fortran code -- is compiled to a dynamic library. The error occurs when I attempt to compile the C++ code:

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: atanf already defined in MyFortranLibrary.lib(atanf_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: atan2f already defined in MyFortranLibrary.lib(atan2f_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: sqrtf already defined in MyFortranLibrary.lib(sqrtf_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: cosf already defined in MyFortranLibrary.lib(cosf_stub.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: sinf already defined in MyFortranLibrary.lib(sinf_stub.obj)

Here, "MyFortranLibrary.lib" is the compiled Fortran library.

Things I've tried:

  • Added ..\Intel\Composer XE 2013 SP1\compiler\lib\intel64 directory to both projects' library directories
  • Set Runtime Library > Multithread Debug DLL for both projects
  • Cleaned and rebuilt projects

This seems to be the most prevalent solution (at least as far as I know), but doesn't seem to work in my case. I am able to compile for x32/Debug, x32/Release, and x64/Release. Please let me know if I've missed any information that may help diagnose the problem. Thanks!

Manifest Tool: Same option settings, different command line

$
0
0

In two projects I have the same property settings of the manifest tool. Nevertheless I get different command lines.
I have thought, the command line is just a summary of the settings. Am I wrong?

Viewing all 5691 articles
Browse latest View live


Latest Images

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