B Frequently Asked Questions

This appendix lists some problems that people often encounter. If you do not find enough information in this section, you can always contact PGI by email or by phone.

email: trs@pgroup.com
telephone: (503) 682-0696
fax: (503) 682-2637

Non-HPF Directives

Q. The pghpf compiler strips away all comments in the HPF source code, including non-HPF directives. Is there any way around this?

A. There is currently no way to supply non-HPF directives that are passed through to the Fortran 77 compiler. This limitation should be eliminated in future versions of pghpf.

Heterogeneous Systems

Q. I'd like to run an HPF program on a network of systems that include different CPUs, for example, an SGI workstation and a SPARC workstation. Can I do this using pghpf?

A. The current pghpf compilation system does not support heterogeneous runtime environments. Future versions of pghpf may support this type of a system.

Passing Arrays

Q. Why do I get the error message:

pghpf_copy_in: scalar passed to array

A. Sometimes when converting Fortran 77 code, an indexed array element that is passed as a parameter to a subroutine. In Fortran 77 code the address of that element is passed and can be used as the starting address for an assumed size array.

In HPF, the compiler treats it as a *scalar* that is element A(1,1) is a scalar. You can fix this by passing an array section instead of the scalar

Compiler Options

Q. I've found an option to my underlying F77 compiler that isn't recognized by pghpf. How can I pass it through:

A1. Yes, there are several ways to pass options through.

The easiest is to use the command line option:

-W0,option

For example

-W0,-q1

If you need to use an argument you need quotes for example:

-W0,"option1 word1"

A2. If you have the file permissions to modify the driver configuration file for your system and you can create a "pass through". Appendix C, Driver Configuration describes how to modify the driver, for a driver pass thru, the instructions are repeated below. Note that this driver configuration command will need to be added to your driver configuration file. For example, on a system of type xarch, this file would be found in the directory /usr/pgi/xarch//xarchbin/xarchrc.

The passthru statement allows a command with optional or required arguments to be "passed through" to the compiler and linker passes. This switch is used by the pghpf driver to pass switches directly to another Fortran f77 compiler.

When using the -help option, the driver sorts and merges the passthru defined switches with the list of switches embedded into the driver.

The passthru PGIRC statement has either of the following forms:

passthru "-switch";="help description"

passthru "-switch",="help description"

where the switch is the switch to pass through. The ';' indicates an optional argument follows the switch. The ',' indicates a required argument follows the switch.

For example,

passthru "-p"="a p switch with no arguments"

passthru "-g";="a g switch with an optional argument"

passthru "-ko",="a ko switch with one argument"

Security

Q. I'm working in a secure environment and I need to use a secure shell to spawn remote processes. How do I do this?

A The -rsh runtime option and the PGHPF_RSH environment variable specifies the name of the remote shell to be used for creating remote proceses. The value is normally "rsh". If your want to change to a protected remote shell such as "ksh", the command would be:

a.out -pghpf -rsh ksh

Fortran 77 Compilation Fails

Q. The compilation of my HPF program is failing during the Fortran 77 compilation phase. How do I work around this problem.

A. This problem may indicate a coding error in the HPF program, or a compiler code generation error. In this case, you will need to contact PGI with for further support (email to trs@pgroup.com)

Debugging HPF Programs

Q. How do I go about debugging an HPF program?

A. Debugging programs developed under pghpf 1.3 can be difficult. No HPF debugger is currently provided. However, if necessary the programmer can debug the generated SPMD F77 program on each node using multiple X windows. This can be particularly useful in obtaining a traceback on a program that is crashing unexpectedly.

To prepare an HPF program for debugging, use the -Mg compile-time option to pghpf. The generated F77 output will be saved and the node F77 compiler will be invoked with the -g compile-time option to provide symbolic information in the image file. If you wish to execute the program on only a single processor, use the -Mrpm1 compiler option when linking the program. You can then use a standard debugger on the image file.

If you need to execute the program on multiple processors, the following sequence is useful:

(1) Create a shell script, say xdbg, that spawns a debugger in an X window. For example:
#!/bin/sh
exec xterm -e dbx $1

(2) Set the environment variable PGHPF_DEBUGGER to the name of the script; make sure the script is in your path or that you use the full pathname:

% setenv PGHPF_DEBUGGER xdbg

(3) Execute the HPF program using the -pghpf -g all options. For example:

a.out -pghpf -np 2 -g all

will create two xterm windows running dbx on the program.

Similar functionality is possible using PVM.

HPF Runtime Messages

Q. I'm getting the following messge when I execute my program:


0: setdistr: block size too small

A. When specifying a general distribution with BLOCK(n) in a DISTRIBUTE directive, block of size n are assigned to a unique processor. There needs to be enough processors to hand the data distributed in a BLOCK(n) fashion. For example:

INTEGER, DIMENSION(4) :: A
!HPF DISTRIBUTE (BLOCK(1)) :: A

would require at least 4 processors.

Q. I'm getting the following messge when I execute my program:


KOPY_IN: actual arg rank differs from dummy

This message may indicate a problem with storage association. If you are converting a Fortran program (either Fortran 77 or Fortran 90( to HPF, you could try to make the passed variables sequential using the HPF sequence directive, or using the command line option -Msequence. Alternatively, you could convert the program to an HPF style program. This is just one possible cause and solution for this runtime message.

pghpf Runtime Errors

Q. I'm getting an error message from the pghpf runtime. How do I determine which subroutine is causing the error?

A. Compile using -Hrpm1 and using a single processor (any PROCESSORS directives must be set to 1) start execution under the debugger. Set a breakpoint at __hpf_abort. Run the program. The program should break in __hpf_abort before printing the error message. A where command will give a traceback and indicate the user subroutine from which the error is originating.

Extrinsic Compilation

Q. I want to use an extrinsic Fortran 77 routine; how do I write and compile it?

A. Writing an extrinsic for a routine using distributed data involves to writing a message passing routine using the PGI runtime library, and the routines described in Chapter 8, Extrinsics, of the pghpf User's Guide.

HPF Profiling

Q. Is there any way to find out how much time is spent in the communications portion of a program, as opposed to the computation portion?

A. You can see the number of communication calls, and the number of bytes transferred, and the entire time spent in a given statement. However, currently pghpf does not provide tools showing the total communications versus computation performed during a program's execution. Refer to the -Mprof and -Mstatspghpf option, and the -stat runtime option described in Chapters Two and Three of the pghpf User's Guide for more information on using these options.

pghpf Input/Output - Implementation

The pghpf implementation supports full Fortran 90 I/O semantics. This includes non-advancing I/O, namelist I/O, and I/O of array sections. There are no restrictions on using mapped arrays in list directed, formatted, or unformatted I/O statements. For example:

INTEGER, DIMENSION(N,N) :: A,B
!HPF$ DISTRIBUTE (BLOCK,BLOCK) :: A,B
FORALL(I=1:N,J=1:N) A(I,J) = B(J,I)
PRINT *, A,B
END

Variables used in namelist groups (NAMELIST) may not be mapped; the compiler issues a warning message if an attempt is made to map a variable in a namelist group:

PGHPF-W-0311-Non-replicated mapping for namelist
array, name, ignored (test1.hpf:4)

Currently input and output is serialized. One processor reads or writes the data and sends or receives it to or from the other processors owning the data. Performance of I/O on mapped arrays is comparable to the I/O performance of a single-processor Fortran 90 compiler.

Random Number Generation

The random number used in the 2.0 release now generates a 46 bit lagged fibonacci pseudo-random sequence with a short lag of 5 and a long lag of 17. For a given seed, including the default seed, the sequence generated is independent of the platform and number of processors. Due to limitations of some platforms' default integer type, the seed vector is of size 34. Only the least significant 23 bits of each element of the seed array are used, thus a seed array returned or used is portable between platforms. For non-degenerate seed arrays, the period of this generator is (217 - 1) * 245.
If all the odd elements of the seed array are even, the period will be shorter.

The algorithm used for pghpf RANDOM_NUMBER implementation is based on and described in the paper, Requirements for a Parallel Pseudorandom Number Generator, by Michael Mascagni (mascagni@super.org) and David H. Bailey (dbailey@nas.nasa.gov).

The best performance on distributed arrays is for block distributions. The higher the order of the first distributed dimension, the better the performance will be.