fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
SCALARISE
Syntax:
[DO NOT] SCALARISE
[DO NOT] SCALARIZE
[DO NOT] CHANGE ARRAY REFERENCES TO SCALARS
Function:
Subscripted array references with constant indices are systematically replaced by scalar variables. Declarations for the scalar variables are inserted and the variables are declared by EQUIVALENCE statements to occupy the same memory locations as the array elements.
This command is used to prepare code for execution on machines with novel architectures. Please see "APPRASE: Automatic parallelisation of Fortran to run on an FPGA" Farrimond B.T., Collins J. and Sharma A. 2008, Paper presented at The Summer Conference of the Society for Computer Simulation, Edinburgh, Scotland, June 2008. The conversion of arrays to scalar variables is a step in optimisation for a fine-grain parallel computer architecture. However, unexpected speed improvements have been observed when this change is made to some Fortran codes. The command is used in combination with the commands:
Where to Use this Command
Operating system command line | Yes |
Configuration file, config.fsp | Yes |
Specification (fsp) files, *.fsp | Yes |
Interactively, to FPT> prompt | Yes |
Interactive command files | Yes |
Embedded in the Fortran code | Yes |
Default
This change is not made by default (Note that defaults may be modified in the configuration file).
Examples
The code fragment shown below does not contain array references with constant bounds:
REAL*8 a(4),rsum rsum = 0 DO i=1,4 rsum = rsum + a(i) ENDDO
This code is modified by unwinding the DO loop. The command (written in an fsp script) is:
% unwind all loops
REAL*8 a(4),rsum ! rsum=0 ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=1 ! rsum=rsum+a(1) ! fpt ENDDO ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=2 ! rsum=rsum+a(2) ! fpt ENDDO ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=3 ! rsum=rsum+a(3) ! fpt ENDDO ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=4 ! rsum=rsum+a(4) ! fpt ENDDO ! ! ****************************************************************************
The code may now be scalarised. The original code is processed with the two commands:
% unwind all loops % scalarise
The code is converted to:
REAL*8 a(4),rsum REAL*8 a_1 EQUIVALENCE (a_1,a(1)) REAL*8 a_2 EQUIVALENCE (a_2,a(2)) REAL*8 a_3 EQUIVALENCE (a_3,a(3)) REAL*8 a_4 EQUIVALENCE (a_4,a(4)) ! rsum=0 ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=1 ! rsum=rsum+a_1 !--------------------^--------------------------------------------------------- fpt - 3487 Array reference with literal indices replaced by scalar !------------------------------------------------------------------------------ ! fpt ENDDO ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=2 ! rsum=rsum+a_2 !--------------------^--------------------------------------------------------- fpt - 3487 Array reference with literal indices replaced by scalar !------------------------------------------------------------------------------ ! fpt ENDDO ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=3 ! rsum=rsum+a_3 !--------------------^--------------------------------------------------------- fpt - 3487 Array reference with literal indices replaced by scalar !------------------------------------------------------------------------------ ! fpt ENDDO ! ! **************************************************************************** ! ! fpt DO i=1,4 ! ! fpt i=4 ! rsum=rsum+a_4 !--------------------^--------------------------------------------------------- fpt - 3487 Array reference with literal indices replaced by scalar !------------------------------------------------------------------------------ ! fpt ENDDO ! ! ****************************************************************************
Copyright ©1995 to 2025 Software Validation Ltd. All rights reserved.