Download Convey Programmers Guide - Convey Computer Support

Transcript
Message
Routines
Allow coprocessor code to create a message that is printed when
the coprocessor routine returns to the host. Host versions also exist
that print the message immediately, allowing these routines to be
used within coprocessor regions.
The following interfaces allow simple message and variable output
from the coprocessor. The first argument (msg) is a string to
prepend to the message. The second argument (mlen) is the
number of characters of msg to prepend. The third argument (code)
is the value to be printed (using an appropriate format) after the
string msg.
C callable
The collection and display of data is enabled by setting the
environment variable CNY_SIMCALL_MSGTRACE=1. The routines store
the string/values to print in an internal buffer, and when the
dispatched coprocessor code finishes, the host writes the buffered
values to stdout.
These functions silently return if CNY_SIMCALL_MSGTRACE is not set.
void cny$mput (char *msg, int mlen) ;
void cny$mputi(char *msg, int mlen, int code) ;
void cny$mputl(char *msg, int mlen, long code) ;
void cny$mputf(char *msg, int mlen, float code) ;
void cny$mputd(char *msg, int mlen, double code) ;
void cny$mputv(char *msg, int mlen, long * code) ;
(mputv is like mputl, but takes an address)
Example:
int main() {
#pragma cny begin_coproc
cny$mput("cny$mput",8);
cny$mputi("cny$mputi",9,11);
cny$mputl("cny$mputl",9,12L);
cny$mputl("cny$mputv",9,13L);
cny$mputf("cny$mputf",9,12.1);
cny$mputd("cny$mputd",9,12.2);
#pragma cny end_coproc
printf ("Done\n");
return 0;
}
↑
Can be called
from host or
coprocessor
code
↓
Fortran
callable
For these Fortran versions of these routines, msg should be a
quoted string or a CHARACTER variable, and mlen must be an
integer value, the number of characters in msg.
Convey Programmers Guide v2.0
integer ival
integer*8 lval
real rval
real*8 dpval
…
call cny$mput(msg, mlen)
call cny$mputi(msg, mlen, ival)
call cny$mputl(msg, mlen, lval)
call cny$mputf(msg, mlen, rval)
call cny$mputd(msg, mlen, dpval)
77