You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jeff Squyres edited this page Sep 7, 2015
·
7 revisions
Using the proper escape codes for printf()-like functions
Here is a list of the format types you should use for various types common in Open MPI.
Open MPI now requires a C99 compiler, in which <inttypes.h> is required. As such, all the escape sequences below are guaranteed to be available.
[If the format is in quotes (for example, "%d") it can be included directly in the format string, but if it is not (PRId32, it should be concatenated by the preprocessor, with a leading "%". For example:
#include<inttypes.h>uint32_tfoo=1;
longbar=1;
printf("foo: %"PRIu32", bar: %ld\n", foo, bar);
type
format
notes
int32_t
PRId32
uint32_t
PRIu32
int64_t
PRId64
uint64_t
PRIu64 / PRIx64
use u if an unsigned variable, x if a remote address