Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28383 Discussions

include the external common variables block into main code

Hoang_A_
Beginner
252 Views

 Hello, I am making the numerical simulation code by fortran. I made the common variables in an external file. All variables is called to main code and subroutines by INCLUDE "Variable.inc". But when compiled the program, I got these messages:

Error    1     error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: // / <IDENTIFIER>    C:\Users\Ledinhanh07\Documents\Visual Studio 2013\Projects\Console3\Console3\subcomMCMBLPC.inc    9    
Error    2     error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...    C:\Users\Ledinhanh07\Documents\Visual Studio 2013\Projects\Console3\Console3\subcomMCMBLPC.inc    10    
Error    3     error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...    C:\Users\Ledinhanh07\Documents\Visual Studio 2013\Projects\Console3\Console3\subcomMCMBLPC.inc    10    
Error    4     error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...    C:\Users\Ledinhanh07\Documents\Visual Studio 2013\Projects\Console3\Console3\subcomMCMBLPC.inc    11    
Error    5     error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: // / <IDENTIFIER>    C:\Users\Ledinhanh07\Documents\Visual Studio 2013\Projects\Console3\Console3\subcomMCMBLPC.inc    12
.....

My Variable.inc is as follows*:  

!C     ---------------------------------------------------------------
!C     File Name subcom.inc 
!c
      PARAMETER(NI=183,NJ=70)
      PARAMETER(NPHI=7,NPHI1=5,NPHI2=6)
      PARAMETER(NI1=51)
      IMPLICIT REAL*8 (A-H,O-Z)
      COMMON /BTVD/ AM1( NPHI,NPHI,NI,NJ)
      COMMON /BPHI/ PHI( NPHI,NI,NJ),
     &             PHIN( NPHI,NI,NJ),
     &             PHIM( NPHI,NI,NJ)
      COMMON /BVAR/   F( NPHI,NI,NJ),
     &                G( NPHI,NI,NJ),
     &                Q( NPHI,NI,NJ),
     &               EV( NPHI,NI,NJ),
     &               FL( NPHI,NI,NJ)
      COMMON /BSUB/ROU(NI,NJ),.....

Please tell me how to fix this problem!!!

Thank you !

 

 

0 Kudos
5 Replies
GVautier
New Contributor II
252 Views

Hello

It sounds like mixing fixed and free format sources.

Can you give the name and the content of the file where the include file is included?

Implicit declaration in include file may cause conflict with other implicit declaration where the file is included.

It would be better to use a module.

 

 

0 Kudos
andrew_4619
Honored Contributor II
252 Views

You need continuation "&" at the end of lines that are to be continued, the start & is optional and the continued line starts the character after the start &, useful where continuing strings. 

0 Kudos
Hoang_A_
Beginner
252 Views

Thank you, andrew_4619

I fixed the problem. I have one more question. I want to do calculation in parallel. In, Visua studio, I have set the Process OpenMP Directives: generate parallel code; Multi-processor Compilation to Yes. 

How can I chose how many processor for calculation? 

 

0 Kudos
Hoang_A_
Beginner
252 Views

Thank you, Vautier

I fixed the proplem!

0 Kudos
Kevin_D_Intel
Employee
252 Views

The property  Fortran > General > Multi-processor Compilation (/MP) controls compilation of multiple source files simultaneously. It does not enable multi-processor execution of the resulting executable.

The property  Fortran > Language > Process OpenMP Directives enables the compiler’s recognition of OpenMP directives within the source code. The assumption is that the programmer has added the necessary OpenMP directives to parallelize certain sections of their code. Under OpenMP you control the number of threads using the OMP_NUM_THREADS environment variable. The OpenMP run-time libraries allocate threads to available processors, and support methods for user control of thread placement.

For getting started with OpenMP, we have a small section in our Fortran User's Guide, https://software.intel.com/en-us/node/680084. There are also many good introductory and other resources available on the Web, and from http://www.openmp.org/.

If you have additional questions please start a specific new forum topic. There a many experienced OpenMP developers in the forum who can offer help.

Good luck!

0 Kudos
Reply