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

Any option to show run time error if variables are used without being initialized?

Zhanghong_T_
Novice
696 Views

Dear all,

I need the program give run time error if variables are used without being initialized. Is there any such option? I only found related ones

/Qzero, /Qtrapuv

But they are not what I wanted.

Thanks,

Zhanghong Tang

0 Kudos
1 Solution
andrew_4619
Honored Contributor III
696 Views
0 Kudos
4 Replies
Zhanghong_T_
Novice
696 Views

BTW, how to understand options about floating point operation?

The difference between /fp:precise, /fp:source, /fp:strict, /fp:fast=2 and any suggestion to use the options?

The difference between /fp:except, /fp:except- and any suggestion to use the options?

The difference between /fpconstant, No and any suggestion to use the options?

and so on.

How to use these options together for a better precision calculation? How to use these options together for a faster speed without loss precision?

 

Thanks,

Zhanghong Tang

0 Kudos
andrew_4619
Honored Contributor III
697 Views

/check:uninit 

0 Kudos
Zhanghong_T_
Novice
696 Views

Hi app4619,

Thanks for your kindly reply.

Could you please also give me some suggestion on how to use the options about floating point operation?

Thanks

0 Kudos
TimP
Honored Contributor III
696 Views

/fp:precise and source are the same for ifort, similar to /fp:source for icl  This option includes the effect of /Qprec-div /Qprec-sqrt /Qftz- /assume:protect_parens or, according to current help file, /Qimf-precision=high

Recent Intel host (but not MIC) CPUs perform well with /Qprec-div /Qprec-sqrt /Qftz-. The performance problem with precise or strict is that simd optimization of sum, dot product, or max/min reduction will then occur only with use of !$omp simd reduction (but not with Fortran intrinsics sum, dot_product, maxval, miinval, maxloc, minloc)

If it were not for this problem with reductions, I would recommend /fp:source for host CPUs.  It's a quick test to perform in any case where there may be numerical issue, as it removes all optimizations which are expected to bring differences with vectorization and alignment.

/standard-semantics includes /assume:protect_parens, which is usually desirable, and some additional options for f95 and f2003 compliance.  The few performance problems with standard-semantics seem to have been addressed in latest compilers, so that option may be preferred in the future.

/fp:strict is required for full implementation of use ieee_arithmetic. /fp:except is somewhere between precise and strict.

fp:fast=2 sets /complex-limited-range, which I would prefer to set by itself when it is wanted, as well as /Qimf-domain-exclusion, whose primary purpose is faster divide on MIC by not handling some exception cases.

Without complex-limited-range, single precision complex is promoted to double where required, and double uses careful slow arithmetic. to protect against unexpected over/underflow.  The careful arithmetic defeats simd optimization, even though opt-report doesn't tell about it.

/fp:fast and precise were originally invented by Microsoft, but Microsoft /fp:fast is like Intel /tp:source, and Microsoft takes precise as the default.

As to /check:uninit, I think it has to be used without /Qopenmp.  I filed a problem report about that a few years ago and never got an answer.

fpconstant is an option to violate the Fortran standard when using a default precision constant in double precision expressions; a scheme which some people preferred 30 years ago due to the difficulty back then of changing correctly between single and double precision.  Look up what Steve Lionel has said about it.  Use a kind suffix on your constants e.g. 3.141592653597932_wp if you want to make them easy to change in a way which won't break when you change compilers or forget your options.

0 Kudos
Reply