Next: Non-SMPlib Routines
Up: Application Programming Interface
Previous: Data Reduction
int SMP_Debug(int newflag);
INTEGER FUNCTION SMP_DEBUG(NEWFLAG)
INTEGER NEWFLAG
- resets the debug flag (0, 1 or 2) and returns the previous value.
This function overwrites the value defined by the environment variable
SMP_DEBUG.
int SMP_Errcode(void);
INTEGER FUNCTION SMP_ERRCODE()
- returns the current error code (see Section 5 for a list).
char *SMP_Errstring(int errcode);
SUBROUTINE SMP_ERRSTRING(ERRCODE, ERRSTR)
INTEGER ERRCODE
CHARACTER ERRSTR*(*)
- returns a string defined for errcode
(see Section 5 for a list). The Fortran version copies
the string to ERRSTR.
int SMP_Getoption(char *sopt, char *svalue, int lvalue);
SUBROUTINE SMP_GETOPTION(SOPT, SVALUE, IFLAG)
CHARACTER SOPT*(*), SVALUE*(*)
INTEGER IFLAG
- gets option value(s) for a given SMPlib option (sopt).
Value(s) is returned as a string into svalue with a maximum
size of lvalue. The function returns a positive flag
(to IFLAG in Fortran) on success and a non-positive (≤0)
value on failure. A list of supported options
is implementation dependent, but see
SMP_Setoption for minimum
requirements.
- error code:
SMP_ERR_OPTION, SMP_ERR_MALLOC
int SMP_Myid(void);
INTEGER FUNCTION SMP_MYID()
- returns the rank of the current process.
int SMP_Numprocs(void);
INTEGER FUNCTION SMP_NUMPROCS()
- returns the number of processes, including the master.
void SMP_Perror(char *msg);
SUBROUTINE SMP_PERROR(MSG)
CHARACTER MSG*(*)
- prints the current error message to
<stderr>. If the current
error condition (errcode) is SMP_NO_ERR,
no message will be printed.
If msg is given, a prefix ``msg:'' will be included.
void SMP_Pinit_flag(int pinit, int pinit_step, int flag);
SUBROUTINE SMP_PINIT_FLAG(PINIT, PINIT_STEP, FLAG)
INTEGER PINIT, PINIT_STEP, FLAG
- sets the pinit flags beside those from the environment
variable
SMP_PINIT. If flag > 0, this function
overwrites those values defined by SMP_PINIT;
if flag ≤ 0,
the function adds offsets to the corresponding values defined by
SMP_PINIT.
In order to have the desired effect, SMP_Pinit_flag() must be
called before SMP_Fork(), SMP_Forkthread(),
SMP_Pinit(), or SMP_Pinit_thread()
(the last two are non-API functions described in
Section 4).
int SMP_Setoption(char *sopt, char *svalue);
SUBROUTINE SMP_SETOPTION(SOPT, SVALUE, IFLAG)
CHARACTER SOPT*(*), SVALUE*(*)
INTEGER IFLAG
- sets option value(s) for a given SMPlib option (sopt).
Value(s) is given as a string in svalue and multiple values
are colon (:) separated.
The function returns a positive flag (to IFLAG in Fortran)
on success and a non-positive (≤0) value on failure.
The function is intended to replace other option setting
functions (such as
SMP_Debug, SMP_Pinit_flag).
A list of supported options is implementation dependent, but to
the minimum, the following options are defined:
- sopt="DEBUG" -- the debug flag
- sopt="PINIT" -- the pinit flags
"<pinit>[:<pinit_step>:<flag>]".
- error code:
SMP_ERR_OPTION,
SMP_ERR_VALUE, SMP_ERR_MALLOC
void SMP_Version(char **verno, char **vdate);
SUBROUTINE SMP_VERSION(VERNO, VDATE)
CHARACTER VERNO*(*), VDATE*(*)
- returns the SMPlib version number and date.
double SMP_Wtime(void);
DOUBLE PRECISION FUNCTION SMP_WTIME()
- gets wallclock time in seconds.
The following routines define a set of timers besides
the SMP_Wtime() function.
Maximum number of timers is 64.
The ``timer" field is from 1 to 64.
The timer routines are not thread-safe.
void SMP_Timer_init(int timer);
SUBROUTINE SMP_TIMER_INIT(TIMER)
INTEGER TIMER
- initializes a timer (if
timer > 0) or all timers
(if timer==0).
SMP_Init() initializes all timers.
This function is used to reset a timer (to zero).
- error code:
SMP_ERR_TIMER
void SMP_Timer_start(int timer);
SUBROUTINE SMP_TIMER_START(TIMER)
INTEGER TIMER
- starts a timer.
- error code:
SMP_ERR_TIMER, SMP_ERR_TSTOP
void SMP_Timer_stop(int timer);
SUBROUTINE SMP_TIMER_STOP(TIMER)
INTEGER TIMER
- stops a timer.
- error code:
SMP_ERR_TIMER, SMP_ERR_TSTART
double SMP_Timer_read(int timer);
DOUBLE PRECISION FUNCTION SMP_TIMER_READ(TIMER)
INTEGER TIMER
- returns the current value of a timer in seconds.
The timer will be stopped first if it has not.
- error code:
SMP_ERR_TIMER
void SMP_Timer_string(int timer, char *str);
SUBROUTINE SMP_TIMER_STRING(TIMER, STR)
INTEGER TIMER
CHARACTER STR*(*)
- defines a string for a timer.
The string is used by
SMP_Timer_print().
- error code:
SMP_ERR_TIMER
void SMP_Timer_print(int timer);
SUBROUTINE SMP_TIMER_PRINT(TIMER)
INTEGER TIMER
- prints a timer (if
timer > 0) or all timers
(if timer==0).
- error code:
SMP_ERR_TIMER
Next: Non-SMPlib Routines
Up: Application Programming Interface
Previous: Data Reduction
Haoqiang Jin
2005-08-10