Previous | Contents | Index |
Table 12-4 describes each of the Compaq Fortran 3hpf routines contained in the HPF_LOCAL_LIBRARY library. These routines are valid only on Tru64 UNIX systems.
Name | Reference Page | Description |
---|---|---|
abstract_to_physical | abstract_to_physical(3hpf) | Returns processor identification for the physical processor associated with a specified abstract processor relative to a global actual argument array. |
physical_to_abstract | physical_to_abstract(3hpf) | Returns coordinates for an abstract processor, relative to a global actual argument array, corresponding to a specified physical processor. |
get_hpf_my_node | get_hpf_my_node(3hpf) | Returns an integer value in the range 0 to number_of_processors -1. This is the unique process number on which an instance of an extrinsic(hpf_local) is executing; on a scalar computer system the value is the constant 0. |
get_hpf_numnodes | get_hpf_numnodes(3hpf) | Returns the number of peers on which the program is executing. |
global_alignment | global_alignment(3hpf) | Returns information about the global HPF array actual argument associated with an array local dummy argument; has the same behavior and interface as the subroutine HPF_ALIGNMENT. |
global_bounds | global_bounds(3hpf) | Returns the upper and lower bounds of the actual argument associated with an assumed shape local dummy array. |
global_distribution | global_distribution(3hpf) | Returns information about the global HPF array actual argument associated with an array local dummy argument; has the same behavior and interface as the subroutine HPF_DISTRIBUTION. |
global_template | global_template(3hpf) | Returns information about the global HPF array actual argument associated with an array local dummy argument; has the same behavior and interface as the subroutine HPF_TEMPLATE. |
local_to_global | local_to_global(3hpf) | Converts a set of local coordinates within a local dummy array to an equivalent set of global coordinates within the associated global HPF actual argument array. |
global_to_local | global_to_local(3hpf) | Converts a set of global coordinates within a global HPF actual argument array to an equivalent set of local coordinates within the associated local dummy array. |
global_to_physical | global_to_physical(3hpf) | Converts a global reference to an array element in the HPF global actual array argument. The argument must be associated with an assumed-shape local dummy array into the number of the process to which the element is mapped and the subscripts to access that element using the associated assumed shape array dummy argument on that process. |
hpf_synch | hpf_synch(3hpf) | Synchronizes execution of all peers. |
Example 12-1 shows the use of the shcom_connect 3f routine (TU*X ONLY).
Example 12-1 Using the 3f Routine shcom_connect |
---|
C C FILE: shared_data.f - Example of initialized common data. C BLOCK DATA shared_block_data INTEGER*8 init_data REAL operand, result COMMON /shared_data/ init_data, operand, result DATA init_data/42/, operand/0.0/, result/0.0/ END C C FILE: compute_agent.f - Example Fortran program C PROGRAM compute_agent INCLUDE '../include/shcom.f' INTEGER*8 init_data REAL operand, result COMMON /shared_data/ init_data, operand, result INTEGER shcom_connenct, stat EXTERNAL shcom_connenct stat = shcom_connect(init_data, '/tmp/shcom_demo') IF (stat .EQ. SHCOM_SUCCESS) THEN result = SQRT(operand) ELSE TYPE *, 'shcom_connect() failed, error = ', stat ENDIF STOP END /* * FILE ui_agent.c - Example of initialized common data written in C. */ #include "shcom.h" typedef struct { long init_data; float operand; float result; } demo_t; extern demo_t shared_data_; main() { int stat; printf("shared_data_.init_data = %d\n", shared_data_.init_data); stat = shcom_connect(&shared_data_, "/tmp/shcom_demo"); if (stat == SHCOM_SUCCESS) { shared_data_.operand = 2.0; shared_data_.result = 0.0; system("compute_agent"); printf("shared_data_.result = %f\n", shared_data_.result); } else { printf("shcom_connect() failed, error = %d\n", stat); } } # # FILE: Makefile - Builds shared common example. # FC = f90 CFLAGS = -g -I../include FFLAGS = -g LDFLAGS = -g LIBS = ../lib/libshcom.a all: ui_agent compute_agent ui_agent: ui_agent.o shared_data.so cc ${CFLAGS} -o ui_agent ui_agent.o shared_data.so ${LIBS} compute_agent: compute_agent.o shared_data.so f90 ${FFLAGS} -o compute_agent compute_agent.o shared_data.so ${LIBS} shared_data.so: shared_data.o ld ${LDFLAGS} -shared -o shared_data.so shared_data.o -lc test: shared_data.so ui_agent compute_agent LD_LIBRARY_PATH=.; export LD_LIBRARY_PATH; ui_agent clean: -rm -f ui_agent compute_agent -rm -f *.o shared_data.so -rm -f /tmp/shcom_demo so_locations |
To compile and link this program, type the following:
% make all |
To run this program, type the following:
% make test |
The output from the program is as follows:
shared_data_.init_data = 42 shared_data_.result = 1.414214 |
Example 12-2 shows the use of the irand and qsort 3f routines.
Example 12-2 Using the 3f Routines irand and qsort |
---|
PROGRAM EXAMPLE ! ! This is an example of calling the IRAND(3F) and QSORT(3F) entries. ! EXTERNAL IRAND, QSORT, SUBSORT INTEGER (KIND=4) :: IRAND, SUBSORT INTEGER (KIND=4) :: IARRAY(10), I WRITE(6,100) ! ! Initialize the array using the IRAND(3F) routine. ! DO I=1,10 IARRAY(I) = IRAND(0) END DO WRITE(6,120) 'IRAND(3F)', IARRAY ! ! Now to sort the array using QSORT(3F) ! CALL QSORT( IARRAY, 10, 4, SUBSORT) WRITE(6,120) 'QSORT(3F)', IARRAY ! ! Define FORMAT statements ! 100 FORMAT ('0Start of EXAMPLE'//) 120 FORMAT ('0Array contents after ',A,' call:'/, 10(/T20,I) //) STOP END PROGRAM EXAMPLE ! ! Subroutine called by QSORT(3F) ! INTEGER (KIND=4) FUNCTION SUBSORT (A,B) INTEGER (KIND=4) :: A,B SUBSORT = 1 IF ( A == B ) SUBSORT = 0 IF ( A < B ) SUBSORT = -1 RETURN END FUNCTION SUBSORT |
To compile and link this program, type the following:
% f90 -o example example.for |
To run this program (named example ) and redirect its output from stdout to the file example.out , type the following:
% example > example.out |
The output from the program example contains the contents of the array before and after sorting, as follows:
0Start of EXAMPLE 0Array contents after IRAND(3F) call: 16838 5758 10113 17515 31051 5627 23010 7419 16212 4086 0Array contents after QSORT(3F) call: 4086 5627 5758 7419 10113 16212 16838 17515 23010 31051 |
The Compaq Extended Math Library (CXML), formerly known as the DIGITAL Extended Math Library (DXML), provides a comprehensive set of mathematical library routines callable from Fortran and other languages. CXML contains a set of over 1500 high-performance mathematical subprograms designed for use in many different types of scientific and engineering applications.
CXML is included with Compaq Fortran for Tru64 UNIX Systems (Version 5.3 or later) and can be installed using the instructions in the Compaq Fortran Installation Guide for Tru64 UNIX Systems.
CXML is available as a separate download item for Linux Alpha systems. For more information, use an Internet browser to read information at the following URL:
http://www.compaq.com/linux |
Online documentation is provided for CXML. When you install CXML, you should also install the online reference documentation. It enables you to quickly find details on the purpose and use of any library routine. You should also view the CXML readme file and release notes. When CXML is installed on Tru64 UNIX systems, subsets containing the manpages in both traditional and HTML format can be installed. When CXML is installed on Linux systems, the manpages are available in HTML format and are placed in a /usr/doc subdirectory during installation.
This chapter contains the following topics about CXML:
CXML routines include those for basic linear algebra (BLAS), signal processing, sparse linear system solution, linear algebra (LAPACK), and utilities related to random numbers, vector math, and sorting. The routines are described in Table 13-1.
Name | Description |
---|---|
Basic Linear Algebra | The Basic Linear Algebra Subprograms (BLAS) library includes the industry-standard Basic Linear Algebra Subprograms for Level 1 (vector-vector, BLAS1), Level 2 (matrix-vector, BLAS2), and Level 3 (matrix-matrix, BLAS3). Also included are subprograms for BLAS Level 1 Extensions, and Sparse BLAS Level 1. |
Signal Processing | The Signal Processing library provides a basic set of signal processing functions. Included are one-, two-, and three-dimensional Fast Fourier Transforms (FFT), group FFTs, Cosine/Sine Transforms (FCT/FST), Convolution, Correlation, and Digital Filters. |
Sparse Linear System | The Sparse Linear System library provides both direct and iterative sparse linear system solvers. The direct solver package supports both symmetric and nonsymmetric sparse matrices stored using the skyline storage scheme. The iterative solver package contains a basic set of storage schemes, preconditioners, and iterative solvers. |
LAPACK | LAPACK is an industry-standard subprogram package offering an extensive set of linear system and eigenproblem solvers. LAPACK uses blocked algorithms that are better suited to most modern architectures, particularly ones with memory hierarchies. |
Utility subprograms | Utility subprograms include random number generation, vector math functions, and sorting subprograms. |
Where appropriate, each subprogram has a version to support each
combination of real or complex and single or double precision
arithmetic. In addition, selected key CXML routines are available in
parallel form as well as serial form on Compaq Tru64 UNIX systems.
13.2 Using CXML from Fortran
To use CXML, you need to make the CXML routines and their interfaces available to your program and specify the appropriate libraries when linking. To specify the CXML routines library when linking, use the -lcxml option. To compile and link a Fortran program that contains calls to CXML routines on Tru64 UNIX or Linux Alpha systems, use one of the following commands:
Operating System | Command |
---|---|
Tru64 UNIX | f90 my_prog.f90 -lcxml |
Linux | fort my_prog.f -lcxml |
For example, to link a Fortran 90 program with the serial CXML library on a Tru64 UNIX system, you would give this command:
% f90 my_prog.f90 -lcxml |
On Tru64 UNIX systems, selected key CXML routines have been
parallelized using OpenMP. To link with the parallel version of the
CXML library, use
-lcxmlp
instead of
-lcxml
.
13.3 CXML Program Example
The free-form Fortran example program below invokes the function SAXPY from the BLAS portion of the CXML Libraries. The SAXPY function computes a*x+y.
PROGRAM example ! ! This free-form example demonstrates how to call ! CXML routines from Fortran. ! REAL(KIND=4) :: a(10) REAL(KIND=4) :: x(10) REAL(KIND=4) :: alpha INTEGER(KIND=4) :: n INTEGER(KIND=4) :: incx INTEGER(KIND=4) :: incy n = 5 ; incx = 1 ; incy = 1 ; alpha = 3.0 DO i = 1,n a(i) = FLOAT(i) x(i) = FLOAT(2*i) ENDDO PRINT 98, (a(i),i=1,n) PRINT 98, (x(i),i=1,n) 98 FORMAT(' Input = ',10F7.3) CALL saxpy( n, alpha, a, incx, x, incy ) PRINT 99, (x(i),I=1,n) 99 FORMAT(/,' Result = ',10F7.3) STOP END PROGRAM example |
For more information about CXML, refer to the following online documentation:
This appendix provides compatibility information for those porting Compaq Fortran 77 and Compaq Fortran applications from other Compaq systems and for those designing applications for portability to multiple platforms. It discusses the following topics:
Table A-1 summarizes the compatibility of Compaq Fortran for Compaq Tru64 UNIX and Linux Alpha systems with Compaq Fortran on OpenVMS Alpha Systems, Compaq Fortran 77 on other platforms (architecture/operating system pairs), and Compaq Visual Fortran for Windows NT (x86 and Alpha systems) and Windows 95/98 x86 systems.
Compaq Fortran 77 (CF77) or Compaq Fortran (CF90) for ... Systems | |||||||
---|---|---|---|---|---|---|---|
Language Feature | CF90 UNIX Alpha | CF90 Linux Alpha | CF77 UNIX Alpha | CF90 Windows X86 and Alpha | CF90 OpenVMS Alpha | CF77 OpenVMS Alpha | CF77 OpenVMS VAX |
Linking against static and shared libraries | X | X | X | X | X | X | X |
Create code for shared libraries | X | X | X | X | X | X | X |
Recursive code support | X | X | X | X | X | X | X |
AUTOMATIC and STATIC statements | X | X | X | X | X | X | X |
STRUCTURE and RECORD declarations | X | X | X | X | X | X | X |
INTEGER*1, *2, *4 | X | X | X | X | X | X | X |
LOGICAL*1, *2, *4 | X | X | X | X | X | X | X |
INTEGER*8 and LOGICAL*8 | X | X | X | X 1 | X | X | |
REAL*4, *8 | X | X | X | X | X | X | X |
REAL*16 2 | X | X | X | X | X | X | |
COMPLEX*8, *16 | X | X | X | X | X | X | X |
COMPLEX*32 3 | X | X | X | ||||
POINTER (CRAY-style) | X | X | X | X | X | X | X |
INCLUDE statements | X | X | X | X | X | X | X |
IMPLICIT NONE statements | X | X | X | X | X | X | X |
Data initialization in type declarations | X | X | X | X | X | X | X |
Automatic arrays | X | X | X | X | X | X | |
VOLATILE statements | X | X | X | X | X | X | X |
NAMELIST-directed I/O | X | X | X | X | X | X | X |
31-character names including $ and _ | X | X | X | X | X | X | X |
Source listing with machine code | X | X | X | X | X | X | X |
Debug statements in source | X | X | X | X | X | X | X |
Bit constants to initialize data and use in arithmetic | X | X | X | X | X | X | X |
DO WHILE and END DO statements | X | X | X | X | X | X | X |
Built-in functions %LOC, %REF, %VAL | X | X | X | X | X | X | X |
SELECT CASE construct | X | X | X | X | X | X | |
EXIT and CYCLE statements | X | X | X | X | X | X | |
Variable FORMAT expressions (VFEs) | X | X | X | X | X | X | X |
! marks end-of-line comment | X | X | X | X | X | X | X |
Optional run-time bounds checking for arrays and substrings | X | X | X | X | X | X | X |
Binary (unformatted) I/O in IEEE big endian, IEEE little endian, VAX, IBM®, and CRAY® floating-point formats | X | X | X | X | X | X | X |
Fortran 95/90 standards checking | X | X | X | X | |||
FORTRAN-77 standards checking | X | X | X | X | |||
IEEE exception handling | X | X | X | X | X | X | |
VAX floating data type in memory | X | X | X | ||||
IEEE floating data type in memory | X | X | X | X | X | X | |
CDD/Repository DICTIONARY support | X | X | |||||
KEYED access and INDEXED files | X | X | X | ||||
Parallel decomposition | X 4,5 | X 4,5 | 5 | 5 | 5 | 5 | X |
OpenMP parallel directives | X | ||||||
Conditional compilation using IF...DEF constructs | X | X | X | X | |||
Vector code support | X | ||||||
Direct inlining of Basic Linear Algebra Subroutines (BLAS) | 6 | 6 | 6 | 6 | 6 | 6 | X |
DATE_AND_TIME returns 4-digit year | X | X | X | X | X | X | X |
FORALL statement and construct | X | X | X | X | |||
Automatic deallocation of ALLOCATABLE arrays | X | X | X | X | |||
Dim argument to MAXLOC and MINLOC | X | X | X | X | |||
PURE user-defined subprograms | X | X | X | X | |||
ELEMENTAL user-defined subprograms | X | X | X | X | |||
Pointer initialization (initial value) | X | X | X | X | |||
The NULL intrinsic to nullify a pointer | X | X | X | X | |||
Derived-type structure initialization | X | X | X | X | |||
CPU_TIME intrinsic subroutine | X | X | X | X | |||
Kind argument to CEILING and FLOOR intrinsics | X | X | X | X | |||
Nested WHERE constructs, masked ELSEWHERE statement, and named WHERE constructs | X | X | X | X | |||
Comments allowed in namelist input | X | X | X | X | |||
Generic identifier in END INTERFACE statements | X | X | X | X | |||
Minimal FORMAT edit descriptor field width | X | X | X | X | |||
Detection of Obsolescent and/or Deleted features 7 | X | X | X | X |
Previous | Next | Contents | Index |