Skip to content

Instantly share code, notes, and snippets.

@jjhursey
Created April 11, 2022 16:23
Show Gist options
  • Save jjhursey/07933aacb76de9419902f53c4e7d74f7 to your computer and use it in GitHub Desktop.
Save jjhursey/07933aacb76de9419902f53c4e7d74f7 to your computer and use it in GitHub Desktop.
Breakdown the size of the pmix_value_t structure as part of the PMIx ABI investigation
/*
* Josh Hursey (IBM)
* Breakdown the size of the pmix_value_t structure as part of the PMIx ABI
* investigation.
*/
#include <stdio.h>
#include <pmix.h>
#define XLIST(xmacro) \
xmacro("flag", flag) \
xmacro("byte", byte) \
xmacro("string", string) \
xmacro("size", size) \
xmacro("pid", pid) \
xmacro("integer", integer) \
xmacro("int8", int8) \
xmacro("int16", int16) \
xmacro("int32", int32) \
xmacro("int64", int64) \
xmacro("uint", uint) \
xmacro("uint8", uint8) \
xmacro("uint16", uint16) \
xmacro("uint32", uint32) \
xmacro("uint64", uint64) \
xmacro("fval", fval) \
xmacro("dval", dval) \
xmacro("tv", tv) \
xmacro("time", time) \
xmacro("status", status) \
xmacro("rank", rank) \
xmacro("nspace", nspace) \
xmacro("proc", proc) \
xmacro("bo", bo) \
xmacro("persist", persist) \
xmacro("scope", scope) \
xmacro("range", range) \
xmacro("state", state) \
xmacro("pinfo", pinfo) \
xmacro("darray", darray) \
xmacro("ptr", ptr) \
xmacro("adir", adir) \
xmacro("envar", envar) \
xmacro("coord", coord) \
xmacro("linkstate", linkstate) \
xmacro("jstate", jstate) \
xmacro("topo", topo) \
xmacro("cpuset", cpuset) \
xmacro("locality", locality) \
xmacro("geometry", geometry) \
xmacro("devtype", devtype) \
xmacro("devdist", devdist) \
xmacro("endpoint", endpoint) \
xmacro("dbuf", dbuf) \
xmacro("pstats", pstats) \
xmacro("dkstats", dkstats) \
xmacro("netstats", netstats) \
xmacro("ndstats", ndstats)
int main() {
pmix_value_t v;
pmix_envar_t e;
int i;
printf("pmix_value_t : %2zu\n", sizeof(pmix_value_t));
printf("-------------:-------\n");
printf("pmix_value_t : %2zu type\n", sizeof(v.type));
printf("pmix_value_t : %2zu data\n", sizeof(v.data));
printf("-------------:-------\n");
#define xmacro(name, field) printf("pmix_value_t : %2zu (.%s)\n", sizeof(v.data. field), name);
XLIST(xmacro);
#undef xmacro
printf("-------------:-------\n");
printf("pmix_envar_t : %2zu\n", sizeof(pmix_envar_t));
printf("-------------:-------\n");
printf("pmix_envar_t : %2zu (.envar)\n", sizeof(e.envar));
printf("pmix_envar_t : %2zu (.value)\n", sizeof(e.value));
printf("pmix_envar_t : %2zu (.separator)\n", sizeof(e.separator));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment