Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use -standard-semanics by default with Intel compilers #868

Closed
awvwgk opened this issue Apr 7, 2023 · 8 comments
Closed

Use -standard-semanics by default with Intel compilers #868

awvwgk opened this issue Apr 7, 2023 · 8 comments

Comments

@awvwgk
Copy link
Member

awvwgk commented Apr 7, 2023

Using this option would ensure that a more standard compliant mode is used with Intel compilers. Alternatively, this could be specified as an option in the Fortran table:

[fortran]
standard = "compiler-default"  # or "f2023", "f2018", ...

See also https://fortran-lang.discourse.group/t/5451/22

@perazz
Copy link
Contributor

perazz commented May 12, 2023

Relevant for #901. We need to turn standard-semantics on with ifort, because lhs reallocation is not enabled by default otherwise. That means that most of the code ought to be rewritten (allocatable character variaboles).

@ivan-pi
Copy link
Member

ivan-pi commented May 14, 2023

While written in the context of logical values and C interoperability, the Intel documentation states that:

If you are going to use LOGICAL types to interoperate with C, specify the option fpscomp[:]logicals to change the interpretation to be C-like. This is included when using the option standard-semantics, which is recommended for using Fortran 2003 (or later) features. [emphasis added]

@ivan-pi
Copy link
Member

ivan-pi commented May 14, 2023

Relevant for #901. We need to turn standard-semantics on with ifort, because lhs reallocation is not enabled by default otherwise. That means that most of the code ought to be rewritten (allocatable character variaboles).

To solve that issue you would need just the -assume realloc_lhs flag. It appears like there is no -nostandard-semantics flag. One needs to "opt in" to all of the non-standard behaviors using -assume..

@perazz
Copy link
Contributor

perazz commented Jun 17, 2023

This has been introduced in #901, should we close this issue @awvwgk?

@awvwgk
Copy link
Member Author

awvwgk commented Jun 18, 2023

This is resolved now

@awvwgk awvwgk closed this as completed Jun 18, 2023
@zoziha
Copy link
Contributor

zoziha commented Sep 15, 2023

@awvwgk @perazz

After my performance testing of several test codes, ifort/ifx with the /standard-semantics compiler option enabled, the compiled programs generally resulted in a performance degradation of about 15%~146% on Windows.
I think we should reconsider the scope of the /standard-semantics compiler option, and I suggest removing the use of the /standard-semantics compiler option from the fpm release profile.

For example, if you run code fortran-lang/benchmarks: poisson2d/optimized.f90 with M set to 128, ifort/ifx will run as:

> ifort /O3 /fp:precise /align:all /error-limit:1 /reentrancy:threaded /nogen-interfaces /assume:byterecl main.f90; ./main
   7.23437500000000            84198
> ifort /O3 /fp:precise /align:all /error-limit:1 /reentrancy:threaded /nogen-interfaces /assume:byterecl /standard-semantics main.f90; ./main
 13.1562500000000 84198
> ifx /O3 /fp:precise /align:all /error-limit:1 /reentrancy:threaded /nogen-interfaces /assume:byterecl main.f90; ./main
   10.3437500000000            84198
> ifx /O3 /fp:precise /align:all /error-limit:1 /reentrancy:threaded /nogen-interfaces /assume:byterecl /standard-semantics main.f90; ./main
 16.7968750000000 84198

The performance of ifort/ifx with /standard-semantics drops by 82%/62% respectively. It can also be seen that the default table control format with /standard-semantics enabled is different.

@perazz
Copy link
Contributor

perazz commented Sep 15, 2023

@zoziha without /standard-semantics, fpm does not build, see #898 #901

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants