FPT and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Reference Manual Home |
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).
Example:
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 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 2014 Software Validation Ltd. All rights reserved.