intel-fortran

Fortran dynamic libraries, load at runtime?

℡╲_俬逩灬. 提交于 2019-12-19 03:59:10
问题 Is it possible to have a Fortran program load a Fortran library at run time? If so, would it be possible to modify a function and recompile only the library to have the originally-compiled program call the modified function in the library at run time? If anyone can provide a minimal working example of how this could be achieved that would be great. 回答1: Here are some few links that can be helpfull: This page on rosettacode.org which gives complete example with details and discuss

Cannot detect file existing or not

半城伤御伤魂 提交于 2019-12-18 09:39:21
问题 In a program I am improving, I noticed that Fortran does not detect file existing or not. This led to a logic error which has not been fixed. I highly appreciate if you could point out the problems or errors and give me your corrections. open(unit=nhist,file=history,iostat=ierr)!This setting cannot exit program if file does not exist because ierr is always 0 if (ierr /=0) then write(*,*)'!!! error#',ierr,'- Dump file not found' stop endif !I used below statement, the program exits even though

About using Fortran function in C with iso_c_binding

限于喜欢 提交于 2019-12-18 09:34:54
问题 I learn Fortran's C interoperability for a few days to call a Fortran function DLL from C. Here I found this link: Use Fortran-code in C I try to create a Fortran DLL like this and my compiler is Intel Fortran compiler: module integration implicit none contains function Integrate(func, a,b, intsteps) result(integral) !DEC$ ATTRIBUTES DLLEXPORT :: Integrate interface real function func(x) real, intent(in) :: x end function func end interface real :: integral, a, b integer :: intsteps intent(in

Pointers in pure functions

你说的曾经没有我的故事 提交于 2019-12-18 08:32:30
问题 In order to traverse a linked list in Fortran, I use a pointer to the current element that is moved to the next one inside a loop. Trying to apply this inside a pure function that operates on said linked list results in an error. Example: module list implicit none ! Node type n_list integer :: val type(n_list),pointer :: next => NULL() end type ! Linked list type t_list type(n_list),pointer :: head end type contains pure function in_list( list, val ) result(res) implicit none class(t_list)

Run Fortran DLL with Visual Studio

让人想犯罪 __ 提交于 2019-12-17 19:55:29
问题 I develop a website with Visual Studio 2010. I want to run a Fortran DLL. I used Intel Visual Fortran to create a .dll and to test how to use it. My code is: SUBROUTINE SIMPSON (N,H,I) !DEC$ ATTRIBUTES DLLEXPORT, DECORATE, ALIAS : "SIMPSON" :: SIMPSON !DEC$ ATTRIBUTES REFERENCE::N !DEC$ ATTRIBUTES REFERENCE::H !DEC$ ATTRIBUTES REFERENCE::I INTEGER N,H,I I=N+H RETURN END which practically takes two integers, adds them and return the result. Now I have the .dll I don't know how to run it with

Allocatable array valued function. gfortran vs ifort

一个人想着一个人 提交于 2019-12-17 07:56:25
问题 Why is there different behavior between ifort and gfortran here? Compiled with ifort it returns false and with gfortran true. I ran into this problem before in my own code and decided to use a subroutine instead, but a recent question made me question this behavior. function allocateArray(size) integer, allocatable, dimension(:) :: allocateArray integer size allocate(allocateArray(size)) end function allocateArray From the main program integer, allocatable, dimension(:) :: a a = allocateArray

old Fortran “shared” feature in open() causing open file failure

六眼飞鱼酱① 提交于 2019-12-13 21:19:21
问题 I am using a code which is written in very old Fortran language. There are some lines using the shared option in the open() routine. E.g.: OPEN(UNIT=17,STATUS='OLD',FORM='UNFORMATTED',READONLY,SHARED) The compilation is ok. When running on one machine, it is ok. But later I moved to another machine, it gives the error: forrtl: Function not implemented forrtl: severe (30): open failure, unit 17, file The compiler I use is the Linux version of intel Fortran 14.0.3 on both of the machine. When

Does the abstract Fortran interface of a C callback function require bind(C) attribute?

谁都会走 提交于 2019-12-13 16:12:15
问题 Consider the following Fortran code, where the C-interoperable subroutine runFoo4C(...) bind(C, name="runFoo") in module Foo_mod takes a C-callback function pointer getLogFuncFromC() as an argument, module CallbackInterface_mod abstract interface function getLogFunc4C_proc(ndim,Point) result(logFunc) ! bind(C) use, intrinsic :: iso_c_binding, only : c_int32_t, c_double, c_int integer(c_int32_t), intent(in) :: ndim real(c_double), intent(in) :: Point(ndim) real(c_double) :: logFunc end

Use HDF5 from intel fortran on windows

别等时光非礼了梦想. 提交于 2019-12-13 02:16:44
问题 I would like to create a HDF5 dataset from a fortran90 program compiled with intel fortran 2011 on Windows 7 using Visual Studio 2010 Can I use prebuilt binaries or how do I build new ones 回答1: I build from source, the available built binaries use the MS C/C++ compiler while I want to build with the Intel compiler, and they are built with Intel Fortran v12.x while I'm using v14.x. I won't say that you can't use the binaries, but I've had enough of a struggle in the past to persuade me to

Enable buffered I/O to stdout with Intel ifort compiler

一世执手 提交于 2019-12-12 20:23:51
问题 I've read the Intel docs about enabling buffered I/O with ifort (using -assume buffered_io or FORT_BUFFERED=true ), and this works for output directly to files. However, we have large applications that are writing to stdout (e.g. write(*,*) or write(stdout,*) ), which is redirected to a file. Neither of the buffering techniques work in this case. Other than refactoring the code to write directly to files, is there a method to enable buffered I/O on stdout with ifort? This is enabled by