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

Change icon for console applications 2

$
0
0

This is a continuation of this topic: https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/276032

I had been using the code in that topic to change icons for a couple years but recently got a new computer/OS/VS/IVF and the code no longer works.  Initially when i opened the resource file (ci.rc) in visual studio i received an error that rcdll.dll could not be found in "C:\Program Files (x86)\Windows Kits\10\bin\x86", so i copied it from "C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86" to that location and the error went away.

I now have:

Windows 10 Pro

Microsoft Visual Studio Community 2017
Version 15.2 (26430.13) Release
VisualStudio.15.Release/15.2.0+26430.13
Microsoft .NET Framework
Version 4.6.01586

Visual C++ 2017   00369-60000-00001-AA511

Microsoft Visual C++ 2017

Intel® Advisor 2017 Update 3   

Intel® Advisor 2017 Update 3, (build 510716), Copyright © 2009-2017 Intel Corporation. All rights reserved.

Intel® Inspector 2017 Update 3   
Intel® Inspector 2017 Update 3, (build 510645), Copyright © 2009-2017 Intel Corporation. All rights reserved.

Intel® Parallel Studio XE 2017 Update 4 Composer Edition for C++ Windows*   Package ID: w_comp_lib_2017.4.210
Intel® Parallel Studio XE 2017 Update 4 Composer Edition for C++ Windows* Integration for Microsoft* Visual Studio* 2017, Version 17.0.76.15, Copyright © 2002-2017 Intel Corporation. All rights reserved.
* Other names and brands may be claimed as the property of others.

Intel® Parallel Studio XE 2017 Update 4 Composer Edition for Fortran Windows*   Package ID: w_comp_lib_2017.4.210
Intel® Parallel Studio XE 2017 Update 4 Composer Edition for Fortran Windows* Integration for Microsoft Visual Studio* 2017, Version 17.0.0047.15, Copyright © 2002-2017 Intel Corporation. All rights reserved.
* Other names and brands may be claimed as the property of others.

Here is the code:

SUBROUTINE ci(i)
! Interface to the SetConsoleIcon function
USE ISO_C_BINDING
USE IFWIN
IMPLICIT NONE

INTEGER(WORD), INTENT(IN) :: i										! index of ico to load
POINTER SetConsoleIcon

INTERFACE
INTEGER FUNCTION SetConsoleIcon(hIcon)
!DEC$ ATTRIBUTES DEFAULT, STDCALL :: SetConsoleIcon
USE ISO_C_BINDING
INTEGER(KIND=C_INTPTR_T) :: hIcon
ENDFUNCTION SetConsoleIcon
END INTERFACE

!----------------------------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------- begin define local variables ------------------------------------------------------------
INTEGER(KIND=HANDLE) :: hMainMod									! the handle of the executable
INTEGER(KIND=HANDLE) :: hIcon										! the handle of the icon
INTEGER(KIND=HANDLE) :: hLib										! the handle of the library that contains the function
INTEGER(KIND=HANDLE) :: SetConsoleIcon_Address						! the address of the function
INTEGER(KIND=HANDLE) ::	iResult
!------------------------------------------------------------ end define local variables ------------------------------------------------------------
!----------------------------------------------------------------------------------------------------------------------------------------------------

! Obtain the module handle; the icon handle, the library handle
hMainMod = GetModuleHandle(NULL)
!hIcon = LoadIcon(hMainMod, i)
hIcon = LoadIcon(hMainMod, MAKEINTRESOURCE(i))
hLib = LoadLibrary("Kernel32.dll"//C_NULL_CHAR)

! obtain the address to the function and obtain the function itself
SetConsoleIcon_Address = GetProcAddress(hLib, "SetConsoleIcon"//C_NULL_CHAR)
CALL C_F_PROCPOINTER(TRANSFER(SetConsoleIcon_Address, C_NULL_FUNPTR), SetConsoleIcon)

! display the console with the new icon
iResult = SetConsoleIcon(hIcon)

ENDSUBROUTINE ci

 

When i run it i don't get any errors, but the icon doesn't change anymore (like it did before the hardware/software changes).  Here are the LHS values at the end of this sub on my new machine:

        hMainMod    140699780251648    INTEGER(8)
        hIcon    40244361    INTEGER(8)
        hLib    140730640760832    INTEGER(8)
        SetConsoleIcon_Address    140730641171104    INTEGER(8)
        iResult    0    INTEGER(4)

And here they are on my old machine:

        hMainMod          5366677504         INTEGER(8)

        hIcon     -1977796927       INTEGER(8)

        hLib       2004287488         INTEGER(8)

        SetConsoleIcon_Address             2004552288         INTEGER(8)

        iResult  1              INTEGER(4)

 

It seems an iResult of 1 is success and 0 is failure.  The LHS values for some of the calls seem to be many orders of magnitude larger on the new machine than the old.  Maybe it's time to stop using 32bit stuff?  Any ideas?

thanks,

rob

Zone: 

Thread Topic: 

Help Me

Subroutine missing

$
0
0

hi, this maybe sound strange but im using a program developed by some scientists many years ago which means there aint any problems with the program itself. the problem i face in it is a subroutine that is missing in the original program yet when i run the program, the program calls that subroutine and makes the calculations and outputs the results. i checked if there was an external function defined in the program with that name but there isnt any. I dont understand how can the program make calculation for a missing subroutine. i hope these words describe the problem correctly.

im using CVF on windows

thnx

Zone: 

How to loop over derived type contents and print out as textfile

$
0
0

I am new to Fortran. I would like to develop a subroutine which prints assigned variable information to a large derived type in Fortran 95. To simplify, lets say we have a derived type declaration and assigmnent as follows:

type SubjectType
        character(20) :: genre
        character(20) :: maindude
end type SubjectType

type BookType
        character(20) :: title
        character(20) :: author
        type(SubjectType) :: subject

end type Booktype

type(Booktype) :: Book

Book%title = "Harry Potter"
Book%author = "JK Rowling"
Book%subject%genre = "Fantasy"
Book%subject%maindude = "Ron Weasley"

I would like the output of my program to be a text file as follows:

Book%title, Harry Potter 

Book%author, JK Rowling 

Book%subject%genre, Fantasy 

Book%subject%maindude, Ron Weasley

In order to achieve this I believe this is what I need to do:

 - Determine Number of fields in the derived type at each level. For instance number of fields in the `Booktype` would be 3. Number of fields in `Booktype%SubjectType` would be 2.
 - Find a way to relate the field 'number' to the name of the field (perhaps using pointers?)
 - loop over all the field numbers and get their names and values.

My question here is twofold. First is my approach correct/will it lead to the intended result? Second How do I accomplish step 1 of this procedure. Namely, how do I get the number of fields in the derived type at each level?

LNK1104: cannot open file 'x64\Release\Console1.exe'

Set Parameter To NaN

$
0
0

Is there anyway to use standard fortran to initialize a double precision parameter to a IEEE NaN. The following fails because the 

MODULE NaN_Value
  USE, INTRINSIC:: IEEE_ARITHMETIC, ONLY: IEEE_VALUE, IEEE_QUIET_NAN
  !
  DOUBLE PRECISION, PARAMETER:: NaN =  IEEE_VALUE(1D0, IEEE_QUIET_NAN)
  !
END MODULE

Ideally, I could have a global parameter value NaN that represents the FORTRAN NaN. I do not want to use the TRANSFER function with the integer that represents a NaN because that is not CPU/Platform independent.

thanks for your help

need help calling C from fortran

$
0
0

I have a fortran console application, and I'm having trouble calling a C function.  I am using visual studio 2010.  I made a simple fortran console program that does nothing more than call my C function, and that works fine.  But the console application that I really want to get working will not work.  I have exhaustively compared visual studio project settings, and I can't figure out why one runs and one doesn't.

Are there any likely culprits that would keep one from working?

 

Write to READONLY file error

$
0
0

Hi

I have simple parallel code(added in below (VS 2013 and intel xe 2017)). When i run it for one rank (mpiexec -n 1 c.exe) there is no problem. But when run it with 2 ranks (in one node) an error appear for second rank which is about writing to  READONLY file (text). But attributes of text file isn't read-only. In cmd i path to release folder that containing .exe file. what's wrong with the second rank? and is it right way to path for parallel running?

Thanks

AttachmentSize
Downloadapplication/rartest.rar203.14 KB
Downloadimage/jpegerror.jpg124.02 KB

Zone: 

Thread Topic: 

Question

Version stamp with resource file

$
0
0

Colleagues,

I need to begin stamping dates and version numbers into .exe files produced from our Fortran source.  I understand this is done with a resource file -- which in this case is just text file - that are in the resource fold in VS. Is there a template/standard/sample for this? I'm in VS 2015.

David


Fatal compilation error: Out of memory Asking for..

$
0
0

I have a program that has a large data module for which I am getting a fatal compilation error.  What makes my case especially curious is that, after investigation, I am finding that it compiles successfully simply by removing the comment lines.  This makes no sense to me, as comment lines aren't supposed to be compiled.  I have attached the example modules and compilation output.  

1. Successfully Compiled Routine: 30,570 lines

2. UNsuccessfully Compiled Routine: 66,198 lines

Again, the only difference is the comment lines in the code (i.e, there are approximately 36,000 more comment lines in the unsuccessful version).  This doesn't make sense to me given the files are only different because of the commented out lines (i.e, log of changes). Nevertheless, this is causing the problem as far as I can tell.

I have attached the routines, along with compilation logs in the zip file.  Again, the data themselves are identical in these fortran files, but just not the comment lines.  You are welcome to try these on your end to see if you successfully compile when my computer does not.  

Attachments: BER_Compile_Fail_to_Intel.zip, which includes

  1. BER_Data_HK.HK311_EPD.20170607.f90: HK3.1.1:  (unsuccessful compile)
  2. BER_Data_HK.HK311_ERG.20170519.f90: HK3.1.1:  (successful compile)
  3. BuildLog.Prj02ModuleData.BER_Data_HK.EPD.20170607.htm (IVF Release unsuccessful compile log)
  4. BuildLog.Prj02ModuleData.BER_Data_HK.ERG.20170509.htm (IVF Release successful compile log)
  5. Params.f90 (supporting module).

Thanks! 

Zone: 

Thread Topic: 

Help Me

How to import Pardiso.lib into Visual Studio 2013 (Fortran Compiler)?

$
0
0

Hi,

I am running a Fortran routine on Visual Studio which requires the paradiso library.

I already importet it as it is discribed via "Additional Includes Direcotires" and the "drag and drop" function into the source file. Nothing seems to work. When trying to compile the code I get an error that it is not possible to include the file.
Unfortunately the insturction from Pardiso was not helpful, either.

Thank you in advance.

 

 

Thread Topic: 

Help Me

Coarray bug with SYNC ALL

$
0
0

The code below works only if the stopped image is 1. In that case, the other images executing SYNC ALL get a non-zero error code and an appropriate message indicating that one of the images has stopped.

If the stopped image is 2 (or greater), then the code hangs forever.

PROGRAM MAIN
IMPLICIT NONE
INTEGER :: CODE
CHARACTER(LEN=100) :: MSG
IF (THIS_IMAGE()==1) STOP  ! This works.
!IF (THIS_IMAGE()==2) STOP  ! This will cause the code to hang forever.
SYNC ALL (STAT=CODE,ERRMSG=MSG)
WRITE(*,*) 'I am image ',THIS_IMAGE(),', CODE = ',CODE,' and  MSG = ',TRIM(MSG)
END PROGRAM MAIN

 

How to figure out what kind of fortran solution I have in Visual Studio

$
0
0

I am using Visual Studio 2012 with Intel Visual Fortran Composer 2013. When creating a new Intel Visual Fortran project, the user may select from the following Fortran project types:

  • Console Application
    • Empty Project
    • Main Program Code
  • Library
    • Dynamic-link Library
    • Dynamic-link Library with Sample Code
    • Static Library
  • QuickWin Application
    • QuickWin Application
    • Standard Graphics Application
  • Windowing Application
    • ActiveX Dialog Code
    • ActiveX MDI Code
    • ActiveX SDI Code
    • Dialog Code
    • Empty Project
    • MDI Code
    • SDI Code
  • COM Server
    • In-process Server (DLL)
    • Out-of-process Server (EXE)

My problem is that I have a large, complex, alread-existing solution provided to me by a 3rd party. I need to do a lot of work on this solution. I wish to determine what category of project from the above categories this solution is, since whoever created it must have selected one of the above options. What is a straightforward way of doing this? Does the software have a memory of what kind of project it is?

 

Module function interface gives syntax error in XE2017

$
0
0
module Fruit
   integer, parameter :: DP = 8
   interface
      real(DP) module function rasberry() result (ripple)
         implicit none
      end
   end interface
end module

Gives: error #6683: A kind type parameter must be a compile-time constant.   [DP]

If we move the declaration of rippple into the function then it compiles OK.

Q about debugging hassle

$
0
0

I have noticed that when my program crashes, for subscript out of range, for example, I dont get any symbolic information in that particular subroutine.

Also, there is no pointer to the source code where that occurs.

I do get a message in the output pane, though, saying where it occurred at least.

Is there a way around this ?

Otherwise I can debug with symbols as expected.

Configuring Visual Studio for Mixed-Language Applications


Module, subroutine and interface

$
0
0

hi all programmers
please i need a help
i have a project use 5 files "modules", there is no problem when i compile it , but without good results, and i think the problem is in the exchange of tables with this " modules'. so maybe i need to use the "interface"
the question is : it's necessairy to use the " interface " even if i use the " use" statement in the main program ?
when i use a " module " for interfaces , a number of problem appear

module variable
implicit none
………………………………………………..
all the variables that i need in the main program +
type :: atm_indice
sequence
integer::ind1,ind2,ind3,ind4
end type atm_indice

type (atm_indice), dimension(:), ALLOCATABLE :: cell_atm_indice1
………………………………………………………………………….
end module variable
MODULE position
contains
SUBROUTINE init_fcc(a,ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax,St_Summit,St_centre_f,St_centre_c,atype,rxi, ryi, rzi)
implicit none
integer,INTENT(in) ::ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min,& ncell_z_max,irefmin,irefmax
integer :: ix, iy, iz, iref
double precision,intent(in) :: a
character(len=2), INTENT(in) :: St_Summit,St_centre_f,St_centre_c
double precision , dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) , INTENT(out) :: rxi, ryi, rzi
double precision , dimension (irefmin:irefmax) :: rx, ry, rz

character(len=2), dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max,& ncell_z_min:ncell_z_max, irefmin:irefmax) ,INTENT(out) :: atype

..... other specification statements .....
......... executable statements ..........
return
end SUBROUTINE init_fcc
SUBROUTINE fcc_spin(atype,ncell_x_min,ncell_x_max,ncell_y_min,ncell_y_max,ncell_z_min,ncell_z_max,irefmin,irefmax,St_Summit,St_centre_f,St_centre_c,S_Summit,S_centre_f,S_centre_c,spin)
implicit none
integer, intent(in) :: ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax
character(len=2), INTENT(in) :: St_centre_f,St_Summit,St_centre_c
double precision,intent(in) :: S_Summit,S_centre_f,S_centre_c
character(len=2), dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max,& ncell_z_min:ncell_z_max, irefmin:irefmax) , INTENT(in) :: atype
double precision, dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax),intent(out):: spin
integer:: i,j,k,ir

..... other specification statements .....
......... executable statements ..........

end SUBROUTINE fcc_spin

end MODULE position

module source1
use variable
contains
subroutine atmcont(atype,type_atm,ncell_x_min,ncell_x_max,ncell_y_min,& ncell_y_max,ncell_z_min, ncell_z_max,irefmin, irefmax,nbre_atm)
implicit none
character(len=2),dimension(ncell_x_min:ncell_x_max,ncell_y_min:ncell_y_max,ncell_z_min:ncell_z_max,irefmin:irefmax) , INTENT(in) :: atype
character(len=2) , INTENT(in) ::type_atm
integer,intent(in):: ncell_x_min, ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin, irefmax
integer,intent(out)::nbre_atm
integer:: i,j,k,ir

..... other specification statements .....
......... executable statements ..........

end subroutine atmcont

subroutine atmindice(atype,type_atm,ncell_x_min,ncell_x_max,ncell_y_min,& ncell_y_max,ncell_z_min, ncell_z_max,irefmin, irefmax,cell_atm_indice,nbre_atm)
implicit none
integer,intent(in):: ncell_x_min, ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin, irefmax
character(len=2) , INTENT(in) ::type_atm
integer,intent(in)::nbre_atm
character(len=2),dimension(ncell_x_min:ncell_x_max,ncell_y_min:ncell_y_max,ncell_z_min:ncell_z_max,irefmin:irefmax) , INTENT(in) :: atype
integer::erreur

type (atm_indice), dimension(nbre_atm), intent(out) :: cell_atm_indice
integer:: i,j,k,ir,ind

..... other specification statements .....
......... executable statements ..........

end subroutine atmindice
end module source1

module read_type
use variable
contains
subroutine read_file(unit)
implicit none
integer,intent(in) :: unit

..... other specification statements .....
......... executable statements ..........
end subroutine read_file

subroutine read_screen(unit)
implicit none
integer,intent(in) :: unit

..... other specification statements .....
......... executable statements ..........

end subroutine read_screen

subroutine write_file(unit)
implicit none
integer,intent(in) :: unit
end subroutine write_file

end module read_type

module dopage_display
use variable
contains
subroutine dopage(atype,spin,type_atm,percent_dop,type_atm_dop,spin_dop,cell_atm_indice,nbre_atm)
implicit none
character(len=2), dimension(:,:,:,:) , INTENT(inout) :: atype
double precision, dimension(:,:,:,:), INTENT(inout) :: spin
character(len=2),intent(in) :: type_atm_dop,type_atm
double precision, INTENT(in) :: spin_dop,percent_dop
integer,intent(in)::nbre_atm
integer:: cn,natm_D1,i,j,k,ir,ii,erreur
double precision:: qdrn1
type (atm_indice),dimension(nbre_atm), intent(in) :: cell_atm_indice

..... other specification statements .....
......... executable statements ..........

end subroutine dopage
end module dopage_display

module interface_source

interface posi
SUBROUTINE init_fcc(a,ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax,St_Summit,St_centre_f,St_centre_c,atype,rxi, ryi, rzi)
integer,INTENT(in) ::ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax
character(len=2), INTENT(in) :: St_Summit,St_centre_f,St_centre_c
double precision,intent(in) :: a
double precision , dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) , INTENT(out) :: rxi, ryi, rzi
character(len=2), dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) ,INTENT(out) :: atype
end subroutine
end interface posi

interface count
subroutine atmcont(atype,type_atm,ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin, irefmax,nbre_atm)
character(len=2), dimension(ncell_x_min:ncell_x_max,ncell_y_min:ncell_y_max,ncell_z_min:ncell_z_max,irefmin:irefmax) , INTENT(in) :: atype
character(len=2) , INTENT(in) ::type_atm
integer,intent(in):: ncell_x_min, ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin, irefmax
integer,intent(out)::nbre_atm
interface posi
SUBROUTINE init_fcc(a,ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax,St_Summit,St_centre_f,St_centre_c,atype,rxi, ryi, rzi)
integer,INTENT(in) ::ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax
character(len=2), INTENT(in) :: St_Summit,St_centre_f,St_centre_c
double precision,intent(in) :: a
double precision , dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) , INTENT(out) :: rxi, ryi, rzi
character(len=2), dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) ,INTENT(out) :: atype
end subroutine
end interface posi
end subroutine
end interface count

interface spincnofig
SUBROUTINE fcc_spin(atype,ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax,St_Summit,St_centre_f,St_centre_c,S_Summit,S_centre_f,S_centre_c,spin)
integer, intent(in) :: ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax
character(len=2), INTENT(in) :: St_centre_f,St_Summit,St_centre_c
double precision,intent(in) :: S_Summit,S_centre_f,S_centre_c
character(len=2), dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) , INTENT(in) :: atype
double precision, dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax),intent(out):: spin
interface posi
SUBROUTINE init_fcc(a,ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax,St_Summit,St_centre_f,St_centre_c,atype,rxi, ryi, rzi)
integer,INTENT(in) ::ncell_x_min,ncell_x_max,ncell_y_min, ncell_y_max,ncell_z_min, ncell_z_max,irefmin,irefmax
character(len=2), INTENT(in) :: St_Summit,St_centre_f,St_centre_c
double precision,intent(in) :: a
double precision , dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) , INTENT(out) :: rxi, ryi, rzi
character(len=2), dimension(ncell_x_min:ncell_x_max, ncell_y_min:ncell_y_max, ncell_z_min:ncell_z_max, irefmin:irefmax) ,INTENT(out) :: atype
end subroutine
end interface posi
end subroutine
end interface spincnofig
end module interface_source

the main program :

program simulation
use variable
use read_type
use position
use dopage_display
use source1
use interface_source
implicit none
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!allocation variables!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
allocate ( angle_t1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ) ,&
angle_p1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ), stat=erreur )
IF(erreur /= 0 ) THEN
WRITE(*,*) "erreur allocation angle "
STOP
END IF
allocate ( itype1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ) , stat=erreur )
IF(erreur /= 0 ) THEN
WRITE(*,*) "erreur allocation itype1 "
STOP
END IF

allocate ( spin1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ) , stat=erreur )
IF(erreur /= 0 ) THEN
WRITE(*,*) "erreur allocation spin1"
STOP
END IF

allocate ( spin2( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ) , stat=erreur )
IF(erreur /= 0 ) THEN
WRITE(*,*) "erreur allocation spin2"
STOP
END IF
allocate ( rxi1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ),&
ryi1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ),&
rzi1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ) , stat=erreur )
IF(erreur /= 0 ) THEN
WRITE(*,*) "erreur allocation rxi1,ryi1,rzi1"
STOP
END IF
allocate ( atype1( ncell_x_min1:ncell_x_max1,ncell_y_min1:ncell_y_max1,ncell_z_min1:ncell_z_max1,irefmin1:irefmax1 ) , stat=erreur )
IF(erreur /= 0 ) THEN
WRITE(*,*) "erreur allocation atype1 "
STOP
END IF

..... other specification statements .....
......... executable statements ..........

call init_fcc(a1,ncell_x_min1,ncell_x_max1,ncell_y_min1, ncell_y_max1,ncell_z_min1, ncell_z_max1,irefmin1,irefmax1,St_Summit1,St_centre_f1,St_centre_c1,atype1, rxi1, ryi1, rzi1)

call init_fcc(a1,ncell_x_min2,ncell_x_max2,ncell_y_min2, ncell_y_max2,ncell_z_min2, ncell_z_max2,irefmin1,irefmax1,St_Summit1,St_centre_f1,St_centre_c1,atype2, rxi1, ryi1, rzi1)

call fcc_spin(atype1,ncell_x_min1,ncell_x_max1,ncell_y_min1, ncell_y_max1,ncell_z_min1, ncell_z_max1,irefmin1,irefmax1,St_Summit1,St_centre_f1,St_centre_c1,S_Summit1,S_centre_f1,S_centre_c1,spin1)

call fcc_spin(atype2,ncell_x_min2,ncell_x_max2,ncell_y_min2, ncell_y_max2,ncell_z_min2, ncell_z_max2,irefmin1,irefmax1,St_Summit1,St_centre_f1,St_centre_c1,S_Summit1,S_centre_f1,S_centre_c1,spin2)

call atmcont(atype2,type_atm1,ncell_x_min2,ncell_x_max2,ncell_y_min2, ncell_y_max2,ncell_z_min2, ncell_z_max2,irefmin1, irefmax1,nbre_atm_s)
allocate ( cell_atm_indice1(nbre_atm_s) , stat=erreur )
IF(erreur /= 0 ) THEN
WRITE(*,*) "erreur allocation cell_atm_indice 1"
STOP
END IF

call atmindice(atype2,type_atm1,ncell_x_min2,ncell_x_max2,ncell_y_min2, ncell_y_max2,ncell_z_min2, ncell_z_max2,irefmin1, irefmax1,cell_atm_indice1,nbre_atm_s)

call dopage(atype2,spin2,type_atm1,percent_dop1,type_atm_dop1,spin_dop1,cell_atm_indice1,nbre_atm_s)

deallocate(cell_atm_indice1)

..... other specification statements .....
......... executable statements ..........

deallocate(itype1,spin1,teta1,phi1,dEn1,angle_t1,angle_p1,rxi1,ryi1,rzi1,atype1)
end program simulation

Thread Topic: 

Question

Trying to implement code example for derived type IO with no success

$
0
0

I'm trying to learn more about derived type IO. To start off with I am using examples from this page: https://software.intel.com/en-us/node/678729

I have created a Visual Studio solution and copied the contents of example1 into a source file. When I run the solution I get errors:

Error	9	Compilation Aborted (code 1)	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	1
Error	7	 error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [TYPES]	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	51
Error	4	 error #6546: A required END statement for the interface-body is missing.	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	14
Error	8	 error #6457: This derived type name has not been declared.   [T]	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	52
Error	5	 error #6268: The keyword ASSIGNMENT or OPERATOR was expected in this context   [WRITE]	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	12
Error	6	 error #6268: The keyword ASSIGNMENT or OPERATOR was expected in this context   [READ]	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	8
Error	3	 error #5082: Syntax error, found IDENTIFIER 'UDIO_WRITE_ARRAY' when expecting one of: <END-OF-STATEMENT> ;	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	13
Error	1	 error #5082: Syntax error, found IDENTIFIER 'FORMATTED' when expecting one of: * .NOT. . + - /) ** / // .LT. < .LE. <= .EQ. == .NE. /= .GT. > ...	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	8
Error	2	 error #5082: Syntax error, found IDENTIFIER 'FORMATTED' when expecting one of: * .NOT. . + - /) ** / // .LT. < .LE. <= .EQ. == .NE. /= .GT. > ...	D:\TEMP\FortranTest\Console1\Console1\Source1.f90	12

I know I'm allowed to have modules in the same file as the main executing program because the below code:

module mymod
    contains
        subroutine hello
            print *, "hello"
        end subroutine hello
    end module mymod

program test
    use mymod
    call hello

    end program test

compiles, runs and outputs correct output.

Why are none of the examples from the provided link working? I feel like they should since they come from the main intel website and I am using intel products.

Linking Abaqus and Fortran compiler

$
0
0

Dear all

I am trying to link Abaqus 6.14-2 and Intel® Parallel Studio XE 2015 Update 6 and Microsoft Visual Studio 2013. I followed up an instruction then I got this message in command window (attached to this message). Does it mean I could link them successfully? 
If so, why do I still get this error ("Problem during compilation") when I add a subroutine file to my model? What could possibly cause the problem?

Any idea or similar experience would be appreciated. 

 

Thanks,

Abraham

 

AttachmentSize
Downloadimage/pngUntitled.png37.91 KB

Fill Fortran Module Data in C

$
0
0

I have a Fortran library with following structure:

module data
implicit none
real(8), allocatable :: x(:)
end module data

subroutine ff(y)
use data

do some stuff with x
end subroutine

the reason for introduce the module data is that x is large and there are more subroutines use x.

Usually, call this lib in Fortran is nothing but allocate x first then call ff. Now I want to call this lib from C, it is easy to use ISO_C_BINDING to call ff from C, but I don't know how to allocate and fill value for module data x in C, a working solution is that use a wrapper function, that reads C data and allocate x in Fortran, something like

subroutine cif(carray, n) bind(c)
use iso_c_binding, only: c_double, c_int
use data
implicit none
integer(c_int), intent(in) :: n
real(c_double), intent(in) :: carray(n)
X = carray
end subrountine

I think this wrapper function will allocate the global data x with size n and fill values stored in carray, but since x is large, here we essentially double store the same array, that is, in C, it is carray, and in Fortran is x, I wonder whether I can directly put the address of carray to x with a wrapper function, since I can not modify the Fortran lib.

Thread Topic: 

Question

remark #7960: The floating overflow condition was detected while evaluating this operation; the result is an infinity.

$
0
0

I need to define a very large constant for the cases that I need infinity; but I noticed this warning:

remark #7960: The floating overflow condition was detected while evaluating this operation; the result is an infinity.

Now I wonder if there is a standard way to define +infinity or -infinity?
 

Viewing all 5691 articles
Browse latest View live