intel-fortran

Variables being deleted in Fortran Arrays?

坚强是说给别人听的谎言 提交于 2019-12-12 19:15:33
问题 I have a following code, with an abstract type, inherited type and a short program, where I'm creating an object and storing it in an array. module m implicit none type :: container class(a), allocatable :: item end type container type, abstract :: a integer, public :: num end type a type, extends(a) :: b integer, public :: num2 end type b end module m program mwe use m implicit none class(a), allocatable :: o1 class(container), allocatable :: arr(:) o1 = b(1, 2) allocate(arr(2)) arr(1) =

Identify operating system

£可爱£侵袭症+ 提交于 2019-12-12 17:38:33
问题 My Fortran 90 code on Intel compiler depends on the operating system it is running on, e.g. if (OS=="win7") then do X else if (OS=="linux") then do y end if How do I do this programmatically? 回答1: You can use pre-processor directives for this task, see here and here for details: _WIN32 for Windows __linux for Linux __APPLE__ for Mac OSX Here is an example: program test #ifdef _WIN32 print *,'Windows' #endif #ifdef __linux print *,'Linux' #endif end program Make sure you enable the pre

Correctly setting random seeds for repeatability

让人想犯罪 __ 提交于 2019-12-12 13:23:10
问题 The method for setting random seeds using the Fortran 90 subroutine random_seed is quite straightforward. call random_seed( put=seed ) But I can't find any information about guidelines for setting the seed (which is absolutely necessary when you want repeatability). Folklore I've heard in the past suggested that scalar seeds should be large. E.g. 123456789 is a better seed than 123. The only support for this I can find on the web is that it is suggested for the ifort extension function ran()

How should multiple Fortran strings be passed to C?

回眸只為那壹抹淺笑 提交于 2019-12-12 12:49:10
问题 To pass a Fortran string to C, a hidden parameter is also passed with the variable's size. Here's a working fortran definition, and the C (actually C++/CLI) method: interface subroutine AppendExtension( + Filename) + bind(C, name="AppendExtension") character *1, intent(inout):: Filename end subroutine AppendExtension end interface and here's the C++/CLI that gets called: extern "C" { void __declspec(dllexport) __cdecl AppendExtension( char * name, int buffersize) { String^ clistr = gcnew

Autocomplete from directory in Fortran

你。 提交于 2019-12-12 04:49:35
问题 I have a little program written in Fortran which needs to read in a file. The filename is provided by the user during runtime. Now I want to emulate the bash behavior by autocompleting the filename, or cycle through available files by pressing [tab]. Since this will be only an extra bonus, and I don't have much time, I don't want to put a lot of time in such a feature. So is there may be an Ifort feature or such doing this automatically? Thanks. 回答1: I don't know any such feature in libraries

`No Source available` when debugging Intel Fortran in Visual Studio

丶灬走出姿态 提交于 2019-12-12 02:13:37
问题 I am debugging the following Fortran code on Microsoft Visual Studio 2012+Intel Visual Fortran: program customarray implicit none real, allocatable, dimension(:):: vector integer :: nelements, i real :: sum print *, 'enter how many values you have' read *, nelements allocate(vector(nelements)) print *, 'enter the values' sum = 0.0 do i=1,nelements read *, vector(i) sum = sum+vector(i) end do end program customarray As I step through the code using the debugger "step into" tool. Everything

Linking to modules in external directory Compaq Visual Fortran command prompt

不羁的心 提交于 2019-12-11 21:31:02
问题 I know that this question is VERY specific, but I am using "Compaq Visual Fortran Optimizing Compiler, Version 6.5" (Fortran 90). To compile, e.g., I use: f90 constants.f90 main.f90 /compile_only And I'm not sure how to link aside from using the command "DF", but as far as I understand, that compiles AND links AND outputs a .exe to be executed. My problem is that I have a few modules that I USE in my main program, and I want those modules to be in one folder and my main program to be in

How can I link MKL to compilation to get missing daxpy_?

寵の児 提交于 2019-12-11 15:26:27
问题 I use Ifort ( Intel Compilers 17 (a.k.a Intel® Parallel Studio XE 2017 (Update 4)) and Intel MKL version 11.1.0.080 ) to build old Fortran code using makefile. I work on claster NSC Thriolith. When I try to compile I get mistake. ipo: warning #11021: unresolved daxpy_ Referenced in /tmp/ipo_ifort1Ub0el.o It is clear to me because I loaded Intel MKL version 11.1.0.080, but it looks like compiler does not see MKL. 来源: https://stackoverflow.com/questions/48010018/how-can-i-link-mkl-to

How to link a .LIB in a MS Visual Studio / Intel Fortran project?

匆匆过客 提交于 2019-12-11 13:45:29
问题 I have Visual Studio 2005 integrated with Intel Fortran 11.0. I need to link my project to an existing library C:\mydir2\mydir1\mylib.lib . How do I do that? I added the path ( C:\mydir2\mydir1 ) to Linker/General/Additional Library Directories and the file name with its path ( C:\mydir2\mydir1\mylib.lib ) to Linker/Advanced/Import Library , to no avail. I'm missing something somewhere, but don't know what. Any ideas? Thanks. 回答1: You're not the first to think that "Import Library" is the

Fortran 90: reading a generic string with enclosed some “/” characters

試著忘記壹切 提交于 2019-12-11 12:36:18
问题 Hy everybody, I've found some problems in reading unformatted character strings in a simple file. When the first / is found, everything is missed after it. This is the example of the text I would like to read: after the first 18 character blocks that are fixed (from #Mod to Flow[kW]), there is a list of chemical species' names, that are variables (in this case 5) within the program I'm writing. #Mod ID Mod Name Type C. #Coll MF[kg/s] Pres.[Pa] Pres.[bar] Temp.[K] Temp.[C] Ent[kJ/kg K] Power