|
Sun Studio 12 Performance Library Questions
Q:
I'm trying to call Performance Library routines from F95 code using the generic interfaces, but I keep getting unresolved externals.
A:
Make sure you include the USE SUNPERF statement in the source that is making calls to the Performance Library from F95. The USE statement must
appear after the PROGRAM statement and before any other statement (aside from other USE statements).
PROGRAM MyProgram Q: I'm trying to call Performance Library routines from F95 code using the generic interfaces, but I keep getting an error "No specific match can be found for the generic subprogram call."
A:
This error is caused when an attempt is made to call one of the
Performance Library routines through the F95 generic interfaces but the
parameter list used does not match any of the interfaces provided. F95
implements polymorphism with a technique known as "ad-hoc" polymorphism.
This means that while it appears that a given routine is being called
through a common interface, what is actually happening is that a number
of interfaces are created and the compiler matches the calling sequence
with one of the existing interfaces. The error described above indicates
that the parameter list used in calling one of the supported routines is
different from any parameter list in the sunperf.mod file.
SUBROUTINE CAXPY(N,ALPHA,X,INCX,Y,INCY) Supported calling sequences:
CALL AXPY(N,ALPHA,X,INCX,Y,INCY) ! Rule #1 fully specified
note: The first letter of the routine name is left off since the routine type is controlled by the type of the ALPHA, X, and Y parameters. There is no support for interfaces that mix floating point or complex type parameters in the same parameter list (i.e., you may not call AXPY with an ALPHA of type REAL*4 and an X or Y type of REAL * 8). Example 2: SUBROUTINE DGELQF(M,N,A,LDA,TAU,WORK,LDWORK,INFO) Supported calling sequences:
CALL GELQF(M,N,A,LDA,TAU,WORK,LDWORK,INFO) ! Rule #1
note: Once a parameter is omitted, successive parameters must use the "pass-by-name" convention for correct function. Parameter names match those listed in the corresponding man pages. Q: I am trying to call the Performance Library routines from a C source file and I keep getting unsatisfied externals that begin with __f90.
A:
The Performance Library has been compiled with the Sun F95 compiler to take advantage of many of the F95 language features. Because of this, the
Performance Library makes calls to the F90 runtime system. When linking an C code with the Performance Library, you can get rid of the unsatisfied
symbols in one of two ways:
cc -c faq_c.c -dalign
cc -o faq_c faq_c.c -lsunperf -lfsu -lfui -lsunmath
Q: Where is the include file for the C interfaces to the Performance Library?
A:
The name of the include file for the Performance Library routines is
sunperf.h and is in the compiler include directory.Example: If you installed your compilers at /opt/SUNWspro then the include file will
have been installed at/opt/SUNWspro/prod/include/cc/sunperf.h.However, unless you've performed a non-standard installation, the cc compiler driver should be able to find this file without using the -I compiler flag. Q: How do I use the 64-bit Performance Library routines when compiling my application for the V9 or x86_64 architecture?
A:
The V9 and x86_64 versions of the Performance Library contain both 32 and 64-bit interfaces to the supported computational routines. If the 32-bit
interface is called, integer parameters are converted to 64-bit integers and the 64-bit routine is called. This means that there is a slight
performance penalty for calling the 32-bit interfaces when linking with the 64-bit versions of the Performance Library. The 64-bit interfaces can
be called directly by appending _64 to the desired routine name.
Example 1:
INTEGER*4 N, INCX, INCY CALL When linked to the 64-bit library, this will result in a call to a wrapper routine that will convert N, INCX, and INCY to 64-bit integers, followed by a call to the CAXPY_64 routine with the promoted parameters. Example 2:
INTEGER*8 N, INCX, INCY This call will directly call the 64-bit CAXPY routine when linked with the 64-bit version of the Performance Library. NOTE: This interface does not exist in the V8 or V8PLUS versions of the Performance Library, so if you try this while compiling for those architectures you will get unsatisfied external references when linking. Example 3:
INTEGER N, INCX, INCY This will directly call the 64-bit CAXPY routine when linked with the 64-bit version of the Performance Library. If you call the _64 interfaces without explicitly promoting the integer parameters, you will need to compile with the compiler flag -xtypemap=integer:64 or you will get undefined results. This is due to the fact that the 64-bit routines expect 64-bit integer parameters. For more information on the interaction between the 32 and 64-bit interfaces and how to use F95 modules to call the right entry points seamlessly, see Using F95 Interfaces to Customize Access to the Sun Performance Library. Q: Calls to Performance Library routines cause segmentation faults.
A1:
Calling a 64-bit routine (see question #5 above) with 32-bit integer
parameters can cause undefined behavior. Make sure this isn't the problem.
A2:
You may be experiencing stack overflow in your program. There are two types
of stack space that need to be addressed.
First, there is the stack space allocated to a process. This is controlled by the limit command. Try unlimiting your process stack by saying: % unlimit stacksize Secondly, if your program is multi-threaded each thread must have its own stack space. This is controlled by the environment variable. The units are in KB so saying: % setenv STACKSIZE 8000 In the c-shell, or
% set STACKSIZE=8000
In the bin shell sets each thread's stack size to 8 MB. This is the minimum value that Performance Library requires, so make sure that is set to at least 8000. You may need to increase this value if your program uses large stack based variables. |
Sun Tech Days
Advance your development skills and shape your future. Coming to a city near you.
Uncontrollable Urge to Share
Reduce the cost & complexity of managing your data center's IT services with a new idea of community.
Save Big: Upgrade
Upgrade to a Sun Fire E6900 or E25K server with UltraSPARC IV+ processors, and the server chassis is free!
|
|
| ||||||||||||