hexsha
stringlengths
40
40
repo
stringlengths
5
105
path
stringlengths
3
173
license
sequence
language
stringclasses
1 value
identifier
stringlengths
1
438
return_type
stringlengths
1
106
original_string
stringlengths
21
40.7k
original_docstring
stringlengths
18
13.4k
docstring
stringlengths
11
3.24k
docstring_tokens
sequence
code
stringlengths
14
20.4k
code_tokens
sequence
short_docstring
stringlengths
0
4.36k
short_docstring_tokens
sequence
comment
sequence
parameters
list
docstring_params
dict
462d14f56db6c7bb78b6b455d441b7faa8945671
kalyanam-FMTGA/ray-original
src/meta/sort.c
[ "BSD-3-Clause-LBNL" ]
C
pmergesort
void
void pmergesort( /* merge sorted files with list */ FILE *fi[], /* array of input files */ int nf, /* number of input files */ PLIST *pl, /* sorted list */ int (*pcmp)(), /* comparison function, takes primitive handles */ FILE *ofp /* output file */ ) { PRIMITIVE *plp; /* position in list */ PRIMITIVE *pp[NFILES]; /* input primitives */ int minf = 0; PRIMITIVE *minp; register int i; if (pl == NULL) plp = NULL; /* initialize list */ else plp = pl->ptop; for (i = 0; i < nf; i++) { /* initialize input files */ if ((pp[i] = palloc()) == NULL) error(SYSTEM, "memory exhausted in pmergesort"); readp(pp[i], fi[i]); } for ( ; ; ) { if (plp != NULL && isprim(plp->com)) minp = plp; else minp = NULL; for (i = 0; i < nf; i++) if (isprim(pp[i]->com) && (minp == NULL || (*pcmp)(&pp[i], &minp) < 0)) minp = pp[minf=i]; if (minp == NULL) break; writep(minp, ofp); if (minp == plp) plp = plp->pnext; else { fargs(pp[minf]); readp(pp[minf], fi[minf]); } } if (plp != NULL && plp->com != PEOF) writep(plp, ofp); for (i = 0; i < nf; i++) { if (pp[i]->com != PEOF) writep(pp[i], ofp); pfree(pp[i]); } }
/* * The following routine merges up to NFILES sorted primitive files * with 0 or 1 primitive lists. Each set of primitives can end with * 0 or 1 global commands. */
The following routine merges up to NFILES sorted primitive files with 0 or 1 primitive lists. Each set of primitives can end with 0 or 1 global commands.
[ "The", "following", "routine", "merges", "up", "to", "NFILES", "sorted", "primitive", "files", "with", "0", "or", "1", "primitive", "lists", ".", "Each", "set", "of", "primitives", "can", "end", "with", "0", "or", "1", "global", "commands", "." ]
void pmergesort( FILE *fi[], int nf, PLIST *pl, int (*pcmp)(), FILE *ofp ) { PRIMITIVE *plp; PRIMITIVE *pp[NFILES]; int minf = 0; PRIMITIVE *minp; register int i; if (pl == NULL) plp = NULL; else plp = pl->ptop; for (i = 0; i < nf; i++) { if ((pp[i] = palloc()) == NULL) error(SYSTEM, "memory exhausted in pmergesort"); readp(pp[i], fi[i]); } for ( ; ; ) { if (plp != NULL && isprim(plp->com)) minp = plp; else minp = NULL; for (i = 0; i < nf; i++) if (isprim(pp[i]->com) && (minp == NULL || (*pcmp)(&pp[i], &minp) < 0)) minp = pp[minf=i]; if (minp == NULL) break; writep(minp, ofp); if (minp == plp) plp = plp->pnext; else { fargs(pp[minf]); readp(pp[minf], fi[minf]); } } if (plp != NULL && plp->com != PEOF) writep(plp, ofp); for (i = 0; i < nf; i++) { if (pp[i]->com != PEOF) writep(pp[i], ofp); pfree(pp[i]); } }
[ "void", "pmergesort", "(", "FILE", "*", "fi", "[", "]", ",", "int", "nf", ",", "PLIST", "*", "pl", ",", "int", "(", "*", "pcmp", ")", "(", ")", ",", "FILE", "*", "ofp", ")", "{", "PRIMITIVE", "*", "plp", ";", "PRIMITIVE", "*", "pp", "[", "NFILES", "]", ";", "int", "minf", "=", "0", ";", "PRIMITIVE", "*", "minp", ";", "register", "int", "i", ";", "if", "(", "pl", "==", "NULL", ")", "plp", "=", "NULL", ";", "else", "plp", "=", "pl", "->", "ptop", ";", "for", "(", "i", "=", "0", ";", "i", "<", "nf", ";", "i", "++", ")", "{", "if", "(", "(", "pp", "[", "i", "]", "=", "palloc", "(", ")", ")", "==", "NULL", ")", "error", "(", "SYSTEM", ",", "\"", "\"", ")", ";", "readp", "(", "pp", "[", "i", "]", ",", "fi", "[", "i", "]", ")", ";", "}", "for", "(", ";", ";", ")", "{", "if", "(", "plp", "!=", "NULL", "&&", "isprim", "(", "plp", "->", "com", ")", ")", "minp", "=", "plp", ";", "else", "minp", "=", "NULL", ";", "for", "(", "i", "=", "0", ";", "i", "<", "nf", ";", "i", "++", ")", "if", "(", "isprim", "(", "pp", "[", "i", "]", "->", "com", ")", "&&", "(", "minp", "==", "NULL", "||", "(", "*", "pcmp", ")", "(", "&", "pp", "[", "i", "]", ",", "&", "minp", ")", "<", "0", ")", ")", "minp", "=", "pp", "[", "minf", "=", "i", "]", ";", "if", "(", "minp", "==", "NULL", ")", "break", ";", "writep", "(", "minp", ",", "ofp", ")", ";", "if", "(", "minp", "==", "plp", ")", "plp", "=", "plp", "->", "pnext", ";", "else", "{", "fargs", "(", "pp", "[", "minf", "]", ")", ";", "readp", "(", "pp", "[", "minf", "]", ",", "fi", "[", "minf", "]", ")", ";", "}", "}", "if", "(", "plp", "!=", "NULL", "&&", "plp", "->", "com", "!=", "PEOF", ")", "writep", "(", "plp", ",", "ofp", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "nf", ";", "i", "++", ")", "{", "if", "(", "pp", "[", "i", "]", "->", "com", "!=", "PEOF", ")", "writep", "(", "pp", "[", "i", "]", ",", "ofp", ")", ";", "pfree", "(", "pp", "[", "i", "]", ")", ";", "}", "}" ]
The following routine merges up to NFILES sorted primitive files with 0 or 1 primitive lists.
[ "The", "following", "routine", "merges", "up", "to", "NFILES", "sorted", "primitive", "files", "with", "0", "or", "1", "primitive", "lists", "." ]
[ "/* merge sorted files with list */", "/* array of input files */", "/* number of input files */", "/* sorted list */", "/* comparison function, takes primitive handles */", "/* output file */", "/* position in list */", "/* input primitives */", "/* initialize list */", "/* initialize input files */" ]
[ { "param": "fi", "type": "FILE" }, { "param": "nf", "type": "int" }, { "param": "pl", "type": "PLIST" }, { "param": "pcmp", "type": "int" }, { "param": "ofp", "type": "FILE" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fi", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nf", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pl", "type": "PLIST", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pcmp", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ofp", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f99d18665c99d1d24bc3a29f01e30960229a9ac6
kalyanam-FMTGA/ray-original
src/cv/nff2rad.c
[ "BSD-3-Clause-LBNL" ]
C
view
void
void view(void) { static FILE *fp = NULL; float from[3], at[3], up[3], angle; if (scanf(" from %f %f %f", &from[0], &from[1], &from[2]) != 3) goto fmterr; if (scanf(" at %f %f %f", &at[0], &at[1], &at[2]) != 3) goto fmterr; if (scanf(" up %f %f %f", &up[0], &up[1], &up[2]) != 3) goto fmterr; if (scanf(" angle %f", &angle) != 1) goto fmterr; scanf(" hither %*f"); scanf(" resolution %*d %*d"); if (viewfile != NULL) { if (fp == NULL && (fp = fopen(viewfile, "a")) == NULL) { perror(viewfile); exit(1); } fprintf(fp, "VIEW= -vp %g %g %g -vd %g %g %g -vu %g %g %g -vh %g -vv %g\n", from[0], from[1], from[2], at[0]-from[0], at[1]-from[1], at[2]-from[2], up[0], up[1], up[2], angle, angle); } return; fmterr: fprintf(stderr, "%s: view syntax error\n", progname); exit(1); }
/*************************************************** Viewpoint location. Description: "v" "from" Fx Fy Fz "at" Ax Ay Az "up" Ux Uy Uz "angle" angle "hither" hither "resolution" xres yres Format: v from %g %g %g at %g %g %g up %g %g %g angle %g hither %g resolution %d %d The parameters are: From: the eye location in XYZ. At: a position to be at the center of the image, in XYZ world coordinates. A.k.a. "lookat". Up: a vector defining which direction is up, as an XYZ vector. Angle: in degrees, defined as from the center of top pixel row to bottom pixel row and left column to right column. Resolution: in pixels, in x and in y. Note that no assumptions are made about normalizing the data (e.g. the from-at distance does not have to be 1). Also, vectors are not required to be perpendicular to each other. For all databases some viewing parameters are always the same: Yon is "at infinity." Aspect ratio is 1.0. A view entity must be defined before any objects are defined (this requirement is so that NFF files can be used by hidden surface machines). ***************/
Viewpoint location. The parameters are. the eye location in XYZ. At: a position to be at the center of the image, in XYZ world coordinates. Note that no assumptions are made about normalizing the data . Also, vectors are not required to be perpendicular to each other. For all databases some viewing parameters are always the same: Yon is "at infinity." Aspect ratio is 1.0. A view entity must be defined before any objects are defined (this requirement is so that NFF files can be used by hidden surface machines).
[ "Viewpoint", "location", ".", "The", "parameters", "are", ".", "the", "eye", "location", "in", "XYZ", ".", "At", ":", "a", "position", "to", "be", "at", "the", "center", "of", "the", "image", "in", "XYZ", "world", "coordinates", ".", "Note", "that", "no", "assumptions", "are", "made", "about", "normalizing", "the", "data", ".", "Also", "vectors", "are", "not", "required", "to", "be", "perpendicular", "to", "each", "other", ".", "For", "all", "databases", "some", "viewing", "parameters", "are", "always", "the", "same", ":", "Yon", "is", "\"", "at", "infinity", ".", "\"", "Aspect", "ratio", "is", "1", ".", "0", ".", "A", "view", "entity", "must", "be", "defined", "before", "any", "objects", "are", "defined", "(", "this", "requirement", "is", "so", "that", "NFF", "files", "can", "be", "used", "by", "hidden", "surface", "machines", ")", "." ]
void view(void) { static FILE *fp = NULL; float from[3], at[3], up[3], angle; if (scanf(" from %f %f %f", &from[0], &from[1], &from[2]) != 3) goto fmterr; if (scanf(" at %f %f %f", &at[0], &at[1], &at[2]) != 3) goto fmterr; if (scanf(" up %f %f %f", &up[0], &up[1], &up[2]) != 3) goto fmterr; if (scanf(" angle %f", &angle) != 1) goto fmterr; scanf(" hither %*f"); scanf(" resolution %*d %*d"); if (viewfile != NULL) { if (fp == NULL && (fp = fopen(viewfile, "a")) == NULL) { perror(viewfile); exit(1); } fprintf(fp, "VIEW= -vp %g %g %g -vd %g %g %g -vu %g %g %g -vh %g -vv %g\n", from[0], from[1], from[2], at[0]-from[0], at[1]-from[1], at[2]-from[2], up[0], up[1], up[2], angle, angle); } return; fmterr: fprintf(stderr, "%s: view syntax error\n", progname); exit(1); }
[ "void", "view", "(", "void", ")", "{", "static", "FILE", "*", "fp", "=", "NULL", ";", "float", "from", "[", "3", "]", ",", "at", "[", "3", "]", ",", "up", "[", "3", "]", ",", "angle", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "from", "[", "0", "]", ",", "&", "from", "[", "1", "]", ",", "&", "from", "[", "2", "]", ")", "!=", "3", ")", "goto", "fmterr", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "at", "[", "0", "]", ",", "&", "at", "[", "1", "]", ",", "&", "at", "[", "2", "]", ")", "!=", "3", ")", "goto", "fmterr", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "up", "[", "0", "]", ",", "&", "up", "[", "1", "]", ",", "&", "up", "[", "2", "]", ")", "!=", "3", ")", "goto", "fmterr", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "angle", ")", "!=", "1", ")", "goto", "fmterr", ";", "scanf", "(", "\"", "\"", ")", ";", "scanf", "(", "\"", "\"", ")", ";", "if", "(", "viewfile", "!=", "NULL", ")", "{", "if", "(", "fp", "==", "NULL", "&&", "(", "fp", "=", "fopen", "(", "viewfile", ",", "\"", "\"", ")", ")", "==", "NULL", ")", "{", "perror", "(", "viewfile", ")", ";", "exit", "(", "1", ")", ";", "}", "fprintf", "(", "fp", ",", "\"", "\\n", "\"", ",", "from", "[", "0", "]", ",", "from", "[", "1", "]", ",", "from", "[", "2", "]", ",", "at", "[", "0", "]", "-", "from", "[", "0", "]", ",", "at", "[", "1", "]", "-", "from", "[", "1", "]", ",", "at", "[", "2", "]", "-", "from", "[", "2", "]", ",", "up", "[", "0", "]", ",", "up", "[", "1", "]", ",", "up", "[", "2", "]", ",", "angle", ",", "angle", ")", ";", "}", "return", ";", "fmterr", ":", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}" ]
Viewpoint location.
[ "Viewpoint", "location", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f99d18665c99d1d24bc3a29f01e30960229a9ac6
kalyanam-FMTGA/ray-original
src/cv/nff2rad.c
[ "BSD-3-Clause-LBNL" ]
C
light
void
void light(void) { static int nlights = 0; register int c; float x, y, z; if (scanf("%f %f %f",&x, &y, &z) != 3) { fprintf(stderr, "%s: light source syntax error\n", progname); exit(1); } while ((c = getchar()) != EOF && c != '\n') ; printf("\nlight sphere l%d \n", ++nlights); printf("0\n0\n4 %g %g %g .01\n", x, y, z); }
/******************************** Positional light. A light is defined by XYZ position. Description: "l" X Y Z Format: l %g %g %g All light entities must be defined before any objects are defined (this requirement is so that NFF files can be used by hidden surface machines). Lights have a non-zero intensity of no particular value [this definition may change soon, with the addition of an intensity and/or color]. **************************/
Positional light. A light is defined by XYZ position. Description: "l" X Y Z All light entities must be defined before any objects are defined (this requirement is so that NFF files can be used by hidden surface machines). Lights have a non-zero intensity of no particular value [this definition may change soon, with the addition of an intensity and/or color].
[ "Positional", "light", ".", "A", "light", "is", "defined", "by", "XYZ", "position", ".", "Description", ":", "\"", "l", "\"", "X", "Y", "Z", "All", "light", "entities", "must", "be", "defined", "before", "any", "objects", "are", "defined", "(", "this", "requirement", "is", "so", "that", "NFF", "files", "can", "be", "used", "by", "hidden", "surface", "machines", ")", ".", "Lights", "have", "a", "non", "-", "zero", "intensity", "of", "no", "particular", "value", "[", "this", "definition", "may", "change", "soon", "with", "the", "addition", "of", "an", "intensity", "and", "/", "or", "color", "]", "." ]
void light(void) { static int nlights = 0; register int c; float x, y, z; if (scanf("%f %f %f",&x, &y, &z) != 3) { fprintf(stderr, "%s: light source syntax error\n", progname); exit(1); } while ((c = getchar()) != EOF && c != '\n') ; printf("\nlight sphere l%d \n", ++nlights); printf("0\n0\n4 %g %g %g .01\n", x, y, z); }
[ "void", "light", "(", "void", ")", "{", "static", "int", "nlights", "=", "0", ";", "register", "int", "c", ";", "float", "x", ",", "y", ",", "z", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "x", ",", "&", "y", ",", "&", "z", ")", "!=", "3", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}", "while", "(", "(", "c", "=", "getchar", "(", ")", ")", "!=", "EOF", "&&", "c", "!=", "'", "\\n", "'", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\"", ",", "++", "nlights", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "x", ",", "y", ",", "z", ")", ";", "}" ]
Positional light.
[ "Positional", "light", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f99d18665c99d1d24bc3a29f01e30960229a9ac6
kalyanam-FMTGA/ray-original
src/cv/nff2rad.c
[ "BSD-3-Clause-LBNL" ]
C
fill
void
void fill(void) { float r, g, b, d, s, p, t, n; char colname[50]; double cvec[3]; if (scanf("%s", colname) != 1) { fprintf(stderr,"%s: fill syntax error\n",progname);exit(1); } if(LookupColorByName(colname,cvec)==1){ r=cvec[0];g=cvec[1];b=cvec[2]; }else{ if(sscanf(colname,"%f",&r)!=1 || scanf("%f %f", &g, &b) !=2) { fprintf(stderr, "%s: fill syntax error\n", progname); exit(1); } } if (scanf("%f %f %f %f %f", &d, &s, &p, &t, &n) != 5) { fprintf(stderr, "%s: fill material syntax error\n", progname); exit(1); } if (p > 1.) p = 1./p; if (t > .001) { /* has transmission */ if (n > 1.1) { /* has index of refraction */ printf("\nvoid dielectric fill\n"); printf("0\n0\n5 %g %g %g %g 0\n", r, g, b, n); } else { /* transmits w/o refraction */ printf("\nvoid trans fill\n"); printf("0\n0\n7 %g %g %g %g 0 %g 1\n", r*d, g*d, b*d, s, t); } } else { /* no transmission */ printf("\nvoid plastic fill\n"); printf("0\n0\n5 %g %g %g %g %g\n", r*d, g*d, b*d, s, p); } }
/**************************************************** Fill color and shading parameters. Description: "f" red green blue Kd Ks Shine T index_of_refraction Format: f %g %g %g %g %g %g %g %g RGB is in terms of 0.0 to 1.0. Kd is the diffuse component, Ks the specular, Shine is the Phong cosine power for highlights, T is transmittance (fraction of light passed per unit). Usually, 0 <= Kd <= 1 and 0 <= Ks <= 1, though it is not required that Kd + Ks == 1. Note that transmitting objects ( T > 0 ) are considered to have two sides for algorithms that need these (normally objects have one side). The fill color is used to color the objects following it until a new color is assigned. *********************/
Fill color and shading parameters. Description: "f" red green blue Kd Ks Shine T index_of_refraction Kd is the diffuse component, Ks the specular, Shine is the Phong cosine power for highlights, T is transmittance (fraction of light passed per unit). The fill color is used to color the objects following it until a new color is assigned.
[ "Fill", "color", "and", "shading", "parameters", ".", "Description", ":", "\"", "f", "\"", "red", "green", "blue", "Kd", "Ks", "Shine", "T", "index_of_refraction", "Kd", "is", "the", "diffuse", "component", "Ks", "the", "specular", "Shine", "is", "the", "Phong", "cosine", "power", "for", "highlights", "T", "is", "transmittance", "(", "fraction", "of", "light", "passed", "per", "unit", ")", ".", "The", "fill", "color", "is", "used", "to", "color", "the", "objects", "following", "it", "until", "a", "new", "color", "is", "assigned", "." ]
void fill(void) { float r, g, b, d, s, p, t, n; char colname[50]; double cvec[3]; if (scanf("%s", colname) != 1) { fprintf(stderr,"%s: fill syntax error\n",progname);exit(1); } if(LookupColorByName(colname,cvec)==1){ r=cvec[0];g=cvec[1];b=cvec[2]; }else{ if(sscanf(colname,"%f",&r)!=1 || scanf("%f %f", &g, &b) !=2) { fprintf(stderr, "%s: fill syntax error\n", progname); exit(1); } } if (scanf("%f %f %f %f %f", &d, &s, &p, &t, &n) != 5) { fprintf(stderr, "%s: fill material syntax error\n", progname); exit(1); } if (p > 1.) p = 1./p; if (t > .001) { if (n > 1.1) { printf("\nvoid dielectric fill\n"); printf("0\n0\n5 %g %g %g %g 0\n", r, g, b, n); } else { printf("\nvoid trans fill\n"); printf("0\n0\n7 %g %g %g %g 0 %g 1\n", r*d, g*d, b*d, s, t); } } else { printf("\nvoid plastic fill\n"); printf("0\n0\n5 %g %g %g %g %g\n", r*d, g*d, b*d, s, p); } }
[ "void", "fill", "(", "void", ")", "{", "float", "r", ",", "g", ",", "b", ",", "d", ",", "s", ",", "p", ",", "t", ",", "n", ";", "char", "colname", "[", "50", "]", ";", "double", "cvec", "[", "3", "]", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "colname", ")", "!=", "1", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}", "if", "(", "LookupColorByName", "(", "colname", ",", "cvec", ")", "==", "1", ")", "{", "r", "=", "cvec", "[", "0", "]", ";", "g", "=", "cvec", "[", "1", "]", ";", "b", "=", "cvec", "[", "2", "]", ";", "}", "else", "{", "if", "(", "sscanf", "(", "colname", ",", "\"", "\"", ",", "&", "r", ")", "!=", "1", "||", "scanf", "(", "\"", "\"", ",", "&", "g", ",", "&", "b", ")", "!=", "2", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}", "}", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "d", ",", "&", "s", ",", "&", "p", ",", "&", "t", ",", "&", "n", ")", "!=", "5", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}", "if", "(", "p", ">", "1.", ")", "p", "=", "1.", "/", "p", ";", "if", "(", "t", ">", ".001", ")", "{", "if", "(", "n", ">", "1.1", ")", "{", "printf", "(", "\"", "\\n", "\\n", "\"", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "r", ",", "g", ",", "b", ",", "n", ")", ";", "}", "else", "{", "printf", "(", "\"", "\\n", "\\n", "\"", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "r", "*", "d", ",", "g", "*", "d", ",", "b", "*", "d", ",", "s", ",", "t", ")", ";", "}", "}", "else", "{", "printf", "(", "\"", "\\n", "\\n", "\"", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "r", "*", "d", ",", "g", "*", "d", ",", "b", "*", "d", ",", "s", ",", "p", ")", ";", "}", "}" ]
Fill color and shading parameters.
[ "Fill", "color", "and", "shading", "parameters", "." ]
[ "/* has transmission */", "/* has index of refraction */", "/* transmits w/o refraction */", "/* no transmission */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f99d18665c99d1d24bc3a29f01e30960229a9ac6
kalyanam-FMTGA/ray-original
src/cv/nff2rad.c
[ "BSD-3-Clause-LBNL" ]
C
cone
void
void cone(void) { static int ncs = 0; int invert; float x0, y0, z0, x1, y1, z1, r0, r1; if (scanf("%f %f %f %f %f %f %f %f", &x0, &y0, &z0, &r0, &x1, &y1, &z1, &r1) != 8) { fprintf(stderr, "%s: cylinder or cone syntax error\n", progname); exit(1); } if ( (invert = r0 < 0.) ) { r0 = -r0; r1 = -r1; } if (r0-r1 < .001 && r1-r0 < .001) { /* cylinder */ printf("\nfill %s c%d \n", invert?"tube":"cylinder", ++ncs); printf("0\n0\n7\n"); printf("\t%g\t%g\t%g\n", x0, y0, z0); printf("\t%g\t%g\t%g\n", x1, y1, z1); printf("\t%g\n", r0); } else { /* cone */ printf("\nfill %s c%d \n", invert?"cup":"cone", ++ncs); printf("0\n0\n8\n"); printf("\t%g\t%g\t%g\n", x0, y0, z0); printf("\t%g\t%g\t%g\n", x1, y1, z1); printf("\t%g\t%g\n", r0, r1); } }
/***************************************************** Cylinder or cone. A cylinder is defined as having a radius and an axis defined by two points, which also define the top and bottom edge of the cylinder. A cone is defined similarly, the difference being that the apex and base radii are different. The apex radius is defined as being smaller than the base radius. Note that the surface exists without endcaps. The cone or cylinder description: "c" base.x base.y base.z base_radius apex.x apex.y apex.z apex_radius Format: c %g %g %g %g %g %g %g %g A negative value for both radii means that only the inside of the object is visible (objects are normally considered one sided, with the outside visible). Note that the base and apex cannot be coincident for a cylinder or cone. ************************/
Cylinder or cone. A cylinder is defined as having a radius and an axis defined by two points, which also define the top and bottom edge of the cylinder. A cone is defined similarly, the difference being that the apex and base radii are different. The apex radius is defined as being smaller than the base radius. Note that the surface exists without endcaps. The cone or cylinder description. A negative value for both radii means that only the inside of the object is visible (objects are normally considered one sided, with the outside visible). Note that the base and apex cannot be coincident for a cylinder or cone.
[ "Cylinder", "or", "cone", ".", "A", "cylinder", "is", "defined", "as", "having", "a", "radius", "and", "an", "axis", "defined", "by", "two", "points", "which", "also", "define", "the", "top", "and", "bottom", "edge", "of", "the", "cylinder", ".", "A", "cone", "is", "defined", "similarly", "the", "difference", "being", "that", "the", "apex", "and", "base", "radii", "are", "different", ".", "The", "apex", "radius", "is", "defined", "as", "being", "smaller", "than", "the", "base", "radius", ".", "Note", "that", "the", "surface", "exists", "without", "endcaps", ".", "The", "cone", "or", "cylinder", "description", ".", "A", "negative", "value", "for", "both", "radii", "means", "that", "only", "the", "inside", "of", "the", "object", "is", "visible", "(", "objects", "are", "normally", "considered", "one", "sided", "with", "the", "outside", "visible", ")", ".", "Note", "that", "the", "base", "and", "apex", "cannot", "be", "coincident", "for", "a", "cylinder", "or", "cone", "." ]
void cone(void) { static int ncs = 0; int invert; float x0, y0, z0, x1, y1, z1, r0, r1; if (scanf("%f %f %f %f %f %f %f %f", &x0, &y0, &z0, &r0, &x1, &y1, &z1, &r1) != 8) { fprintf(stderr, "%s: cylinder or cone syntax error\n", progname); exit(1); } if ( (invert = r0 < 0.) ) { r0 = -r0; r1 = -r1; } if (r0-r1 < .001 && r1-r0 < .001) { printf("\nfill %s c%d \n", invert?"tube":"cylinder", ++ncs); printf("0\n0\n7\n"); printf("\t%g\t%g\t%g\n", x0, y0, z0); printf("\t%g\t%g\t%g\n", x1, y1, z1); printf("\t%g\n", r0); } else { printf("\nfill %s c%d \n", invert?"cup":"cone", ++ncs); printf("0\n0\n8\n"); printf("\t%g\t%g\t%g\n", x0, y0, z0); printf("\t%g\t%g\t%g\n", x1, y1, z1); printf("\t%g\t%g\n", r0, r1); } }
[ "void", "cone", "(", "void", ")", "{", "static", "int", "ncs", "=", "0", ";", "int", "invert", ";", "float", "x0", ",", "y0", ",", "z0", ",", "x1", ",", "y1", ",", "z1", ",", "r0", ",", "r1", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "x0", ",", "&", "y0", ",", "&", "z0", ",", "&", "r0", ",", "&", "x1", ",", "&", "y1", ",", "&", "z1", ",", "&", "r1", ")", "!=", "8", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}", "if", "(", "(", "invert", "=", "r0", "<", "0.", ")", ")", "{", "r0", "=", "-", "r0", ";", "r1", "=", "-", "r1", ";", "}", "if", "(", "r0", "-", "r1", "<", ".001", "&&", "r1", "-", "r0", "<", ".001", ")", "{", "printf", "(", "\"", "\\n", "\\n", "\"", ",", "invert", "?", "\"", "\"", ":", "\"", "\"", ",", "++", "ncs", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ")", ";", "printf", "(", "\"", "\\t", "\\t", "\\t", "\\n", "\"", ",", "x0", ",", "y0", ",", "z0", ")", ";", "printf", "(", "\"", "\\t", "\\t", "\\t", "\\n", "\"", ",", "x1", ",", "y1", ",", "z1", ")", ";", "printf", "(", "\"", "\\t", "\\n", "\"", ",", "r0", ")", ";", "}", "else", "{", "printf", "(", "\"", "\\n", "\\n", "\"", ",", "invert", "?", "\"", "\"", ":", "\"", "\"", ",", "++", "ncs", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ")", ";", "printf", "(", "\"", "\\t", "\\t", "\\t", "\\n", "\"", ",", "x0", ",", "y0", ",", "z0", ")", ";", "printf", "(", "\"", "\\t", "\\t", "\\t", "\\n", "\"", ",", "x1", ",", "y1", ",", "z1", ")", ";", "printf", "(", "\"", "\\t", "\\t", "\\n", "\"", ",", "r0", ",", "r1", ")", ";", "}", "}" ]
Cylinder or cone.
[ "Cylinder", "or", "cone", "." ]
[ "/* cylinder */", "/* cone */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f99d18665c99d1d24bc3a29f01e30960229a9ac6
kalyanam-FMTGA/ray-original
src/cv/nff2rad.c
[ "BSD-3-Clause-LBNL" ]
C
sphere
void
void sphere(void) { static int nspheres = 0; float x, y, z, r; if (scanf("%f %f %f %f", &x, &y, &z, &r) != 4) { fprintf(stderr, "%s: sphere syntax error\n", progname); exit(1); } if (r < 0.) { printf("\nfill bubble s%d \n", ++nspheres); printf("0\n0\n4 %g %g %g %g\n", x, y, z, -r); } else { printf("\nfill sphere s%d \n", ++nspheres); printf("0\n0\n4 %g %g %g %g\n", x, y, z, r); } }
/***************************************** Sphere. A sphere is defined by a radius and center position: "s" center.x center.y center.z radius Format: s %g %g %g %g If the radius is negative, then only the sphere's inside is visible (objects are normally considered one sided, with the outside visible). ******************/
Sphere. A sphere is defined by a radius and center position: "s" center.x center.y center.z radius If the radius is negative, then only the sphere's inside is visible (objects are normally considered one sided, with the outside visible).
[ "Sphere", ".", "A", "sphere", "is", "defined", "by", "a", "radius", "and", "center", "position", ":", "\"", "s", "\"", "center", ".", "x", "center", ".", "y", "center", ".", "z", "radius", "If", "the", "radius", "is", "negative", "then", "only", "the", "sphere", "'", "s", "inside", "is", "visible", "(", "objects", "are", "normally", "considered", "one", "sided", "with", "the", "outside", "visible", ")", "." ]
void sphere(void) { static int nspheres = 0; float x, y, z, r; if (scanf("%f %f %f %f", &x, &y, &z, &r) != 4) { fprintf(stderr, "%s: sphere syntax error\n", progname); exit(1); } if (r < 0.) { printf("\nfill bubble s%d \n", ++nspheres); printf("0\n0\n4 %g %g %g %g\n", x, y, z, -r); } else { printf("\nfill sphere s%d \n", ++nspheres); printf("0\n0\n4 %g %g %g %g\n", x, y, z, r); } }
[ "void", "sphere", "(", "void", ")", "{", "static", "int", "nspheres", "=", "0", ";", "float", "x", ",", "y", ",", "z", ",", "r", ";", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "x", ",", "&", "y", ",", "&", "z", ",", "&", "r", ")", "!=", "4", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}", "if", "(", "r", "<", "0.", ")", "{", "printf", "(", "\"", "\\n", "\\n", "\"", ",", "++", "nspheres", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "x", ",", "y", ",", "z", ",", "-", "r", ")", ";", "}", "else", "{", "printf", "(", "\"", "\\n", "\\n", "\"", ",", "++", "nspheres", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "x", ",", "y", ",", "z", ",", "r", ")", ";", "}", "}" ]
Sphere.
[ "Sphere", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f99d18665c99d1d24bc3a29f01e30960229a9ac6
kalyanam-FMTGA/ray-original
src/cv/nff2rad.c
[ "BSD-3-Clause-LBNL" ]
C
poly
void
void poly(void) { static int npolys = 0; int ispatch; int nverts; float x, y, z; ispatch = getchar(); if (ispatch != 'p') { ungetc(ispatch, stdin); ispatch = 0; } if (scanf("%d", &nverts) != 1) goto fmterr; printf("\nfill polygon p%d \n", ++npolys); printf("0\n0\n%d\n", 3*nverts); while (nverts-- > 0) { if (scanf("%f %f %f", &x, &y, &z) != 3) goto fmterr; if (ispatch) scanf("%*f %*f %*f"); printf("\t%g\t%g\t%g\n", x, y, z); } return; fmterr: fprintf(stderr, "%s: polygon or patch syntax error\n", progname); exit(1); }
/********************************************* Polygon. A polygon is defined by a set of vertices. With these databases, a polygon is defined to have all points coplanar. A polygon has only one side, with the order of the vertices being counterclockwise as you face the polygon (right-handed coordinate system). The first two edges must form a non-zero convex angle, so that the normal and side visibility can be determined. Description: "p" total_vertices vert1.x vert1.y vert1.z [etc. for total_vertices vertices] Format: p %d [ %g %g %g ] <-- for total_vertices vertices -------- Polygonal patch. A patch is defined by a set of vertices and their normals. With these databases, a patch is defined to have all points coplanar. A patch has only one side, with the order of the vertices being counterclockwise as you face the patch (right-handed coordinate system). The first two edges must form a non-zero convex angle, so that the normal and side visibility can be determined. Description: "pp" total_vertices vert1.x vert1.y vert1.z norm1.x norm1.y norm1.z [etc. for total_vertices vertices] Format: pp %d [ %g %g %g %g %g %g ] <-- for total_vertices vertices *******************/
Polygon. A polygon is defined by a set of vertices. With these databases, a polygon is defined to have all points coplanar. A polygon has only one side, with the order of the vertices being counterclockwise as you face the polygon (right-handed coordinate system). The first two edges must form a non-zero convex angle, so that the normal and side visibility can be determined. Description. Polygonal patch. A patch is defined by a set of vertices and their normals. With these databases, a patch is defined to have all points coplanar. A patch has only one side, with the order of the vertices being counterclockwise as you face the patch (right-handed coordinate system). The first two edges must form a non-zero convex angle, so that the normal and side visibility can be determined. Description.
[ "Polygon", ".", "A", "polygon", "is", "defined", "by", "a", "set", "of", "vertices", ".", "With", "these", "databases", "a", "polygon", "is", "defined", "to", "have", "all", "points", "coplanar", ".", "A", "polygon", "has", "only", "one", "side", "with", "the", "order", "of", "the", "vertices", "being", "counterclockwise", "as", "you", "face", "the", "polygon", "(", "right", "-", "handed", "coordinate", "system", ")", ".", "The", "first", "two", "edges", "must", "form", "a", "non", "-", "zero", "convex", "angle", "so", "that", "the", "normal", "and", "side", "visibility", "can", "be", "determined", ".", "Description", ".", "Polygonal", "patch", ".", "A", "patch", "is", "defined", "by", "a", "set", "of", "vertices", "and", "their", "normals", ".", "With", "these", "databases", "a", "patch", "is", "defined", "to", "have", "all", "points", "coplanar", ".", "A", "patch", "has", "only", "one", "side", "with", "the", "order", "of", "the", "vertices", "being", "counterclockwise", "as", "you", "face", "the", "patch", "(", "right", "-", "handed", "coordinate", "system", ")", ".", "The", "first", "two", "edges", "must", "form", "a", "non", "-", "zero", "convex", "angle", "so", "that", "the", "normal", "and", "side", "visibility", "can", "be", "determined", ".", "Description", "." ]
void poly(void) { static int npolys = 0; int ispatch; int nverts; float x, y, z; ispatch = getchar(); if (ispatch != 'p') { ungetc(ispatch, stdin); ispatch = 0; } if (scanf("%d", &nverts) != 1) goto fmterr; printf("\nfill polygon p%d \n", ++npolys); printf("0\n0\n%d\n", 3*nverts); while (nverts-- > 0) { if (scanf("%f %f %f", &x, &y, &z) != 3) goto fmterr; if (ispatch) scanf("%*f %*f %*f"); printf("\t%g\t%g\t%g\n", x, y, z); } return; fmterr: fprintf(stderr, "%s: polygon or patch syntax error\n", progname); exit(1); }
[ "void", "poly", "(", "void", ")", "{", "static", "int", "npolys", "=", "0", ";", "int", "ispatch", ";", "int", "nverts", ";", "float", "x", ",", "y", ",", "z", ";", "ispatch", "=", "getchar", "(", ")", ";", "if", "(", "ispatch", "!=", "'", "'", ")", "{", "ungetc", "(", "ispatch", ",", "stdin", ")", ";", "ispatch", "=", "0", ";", "}", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "nverts", ")", "!=", "1", ")", "goto", "fmterr", ";", "printf", "(", "\"", "\\n", "\\n", "\"", ",", "++", "npolys", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "3", "*", "nverts", ")", ";", "while", "(", "nverts", "--", ">", "0", ")", "{", "if", "(", "scanf", "(", "\"", "\"", ",", "&", "x", ",", "&", "y", ",", "&", "z", ")", "!=", "3", ")", "goto", "fmterr", ";", "if", "(", "ispatch", ")", "scanf", "(", "\"", "\"", ")", ";", "printf", "(", "\"", "\\t", "\\t", "\\t", "\\n", "\"", ",", "x", ",", "y", ",", "z", ")", ";", "}", "return", ";", "fmterr", ":", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "progname", ")", ";", "exit", "(", "1", ")", ";", "}" ]
Polygon.
[ "Polygon", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
15497465f432024bb2dbac3d0fc81bb60f6ff8db
mekleo/libyang
src/printer_yin.c
[ "BSD-3-Clause" ]
C
yin_print_close
void
static void yin_print_close(struct lyout *out, int level, const char *elem_prefix, const char *elem_name, int endflag) { if (endflag) { if (elem_prefix) { ly_print(out, "%*s</%s:%s>\n", LEVEL, INDENT, elem_prefix, elem_name); } else { ly_print(out, "%*s</%s>\n", LEVEL, INDENT, elem_name); } } else { ly_print(out, "/>\n"); } }
/* * endflag: * 0: /> - closing empty element * 1: </elem_name> - closing element with children */
/> - closing empty element 1: - closing element with children
[ "/", ">", "-", "closing", "empty", "element", "1", ":", "-", "closing", "element", "with", "children" ]
static void yin_print_close(struct lyout *out, int level, const char *elem_prefix, const char *elem_name, int endflag) { if (endflag) { if (elem_prefix) { ly_print(out, "%*s</%s:%s>\n", LEVEL, INDENT, elem_prefix, elem_name); } else { ly_print(out, "%*s</%s>\n", LEVEL, INDENT, elem_name); } } else { ly_print(out, "/>\n"); } }
[ "static", "void", "yin_print_close", "(", "struct", "lyout", "*", "out", ",", "int", "level", ",", "const", "char", "*", "elem_prefix", ",", "const", "char", "*", "elem_name", ",", "int", "endflag", ")", "{", "if", "(", "endflag", ")", "{", "if", "(", "elem_prefix", ")", "{", "ly_print", "(", "out", ",", "\"", "\\n", "\"", ",", "LEVEL", ",", "INDENT", ",", "elem_prefix", ",", "elem_name", ")", ";", "}", "else", "{", "ly_print", "(", "out", ",", "\"", "\\n", "\"", ",", "LEVEL", ",", "INDENT", ",", "elem_name", ")", ";", "}", "}", "else", "{", "ly_print", "(", "out", ",", "\"", "\\n", "\"", ")", ";", "}", "}" ]
endflag: 0: /> - closing empty element 1: </elem_name> - closing element with children
[ "endflag", ":", "0", ":", "/", ">", "-", "closing", "empty", "element", "1", ":", "<", "/", "elem_name", ">", "-", "closing", "element", "with", "children" ]
[]
[ { "param": "out", "type": "struct lyout" }, { "param": "level", "type": "int" }, { "param": "elem_prefix", "type": "char" }, { "param": "elem_name", "type": "char" }, { "param": "endflag", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "struct lyout", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "level", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elem_prefix", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "elem_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "endflag", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
15497465f432024bb2dbac3d0fc81bb60f6ff8db
mekleo/libyang
src/printer_yin.c
[ "BSD-3-Clause" ]
C
yin_print_extcomplex_flags
void
static void yin_print_extcomplex_flags(struct lyout *out, int level, const struct lys_module *module, struct lys_ext_instance_complex *ext, LY_STMT stmt, const char *val1_str, const char *val2_str, uint16_t val1, uint16_t val2, int *content) { const char *str; uint16_t *flags; flags = lys_ext_complex_get_substmt(stmt, ext, NULL); if (!flags) { return; } if (val1 & *flags) { str = val1_str; } else if (val2 & *flags) { str = val2_str; } else if (lys_ext_iter(ext->ext, ext->ext_size, 0, (LYEXT_SUBSTMT)stmt) != -1) { /* flag not set, but since there are some extension, we are going to print the default value */ str = val1_str; } else { return; } yin_print_close_parent(out, content); yin_print_substmt(out, level, (LYEXT_SUBSTMT)stmt, 0, str, module, ext->ext, ext->ext_size); }
/* val1 is supposed to be the default value */
val1 is supposed to be the default value
[ "val1", "is", "supposed", "to", "be", "the", "default", "value" ]
static void yin_print_extcomplex_flags(struct lyout *out, int level, const struct lys_module *module, struct lys_ext_instance_complex *ext, LY_STMT stmt, const char *val1_str, const char *val2_str, uint16_t val1, uint16_t val2, int *content) { const char *str; uint16_t *flags; flags = lys_ext_complex_get_substmt(stmt, ext, NULL); if (!flags) { return; } if (val1 & *flags) { str = val1_str; } else if (val2 & *flags) { str = val2_str; } else if (lys_ext_iter(ext->ext, ext->ext_size, 0, (LYEXT_SUBSTMT)stmt) != -1) { str = val1_str; } else { return; } yin_print_close_parent(out, content); yin_print_substmt(out, level, (LYEXT_SUBSTMT)stmt, 0, str, module, ext->ext, ext->ext_size); }
[ "static", "void", "yin_print_extcomplex_flags", "(", "struct", "lyout", "*", "out", ",", "int", "level", ",", "const", "struct", "lys_module", "*", "module", ",", "struct", "lys_ext_instance_complex", "*", "ext", ",", "LY_STMT", "stmt", ",", "const", "char", "*", "val1_str", ",", "const", "char", "*", "val2_str", ",", "uint16_t", "val1", ",", "uint16_t", "val2", ",", "int", "*", "content", ")", "{", "const", "char", "*", "str", ";", "uint16_t", "*", "flags", ";", "flags", "=", "lys_ext_complex_get_substmt", "(", "stmt", ",", "ext", ",", "NULL", ")", ";", "if", "(", "!", "flags", ")", "{", "return", ";", "}", "if", "(", "val1", "&", "*", "flags", ")", "{", "str", "=", "val1_str", ";", "}", "else", "if", "(", "val2", "&", "*", "flags", ")", "{", "str", "=", "val2_str", ";", "}", "else", "if", "(", "lys_ext_iter", "(", "ext", "->", "ext", ",", "ext", "->", "ext_size", ",", "0", ",", "(", "LYEXT_SUBSTMT", ")", "stmt", ")", "!=", "-1", ")", "{", "str", "=", "val1_str", ";", "}", "else", "{", "return", ";", "}", "yin_print_close_parent", "(", "out", ",", "content", ")", ";", "yin_print_substmt", "(", "out", ",", "level", ",", "(", "LYEXT_SUBSTMT", ")", "stmt", ",", "0", ",", "str", ",", "module", ",", "ext", "->", "ext", ",", "ext", "->", "ext_size", ")", ";", "}" ]
val1 is supposed to be the default value
[ "val1", "is", "supposed", "to", "be", "the", "default", "value" ]
[ "/* flag not set, but since there are some extension, we are going to print the default value */" ]
[ { "param": "out", "type": "struct lyout" }, { "param": "level", "type": "int" }, { "param": "module", "type": "struct lys_module" }, { "param": "ext", "type": "struct lys_ext_instance_complex" }, { "param": "stmt", "type": "LY_STMT" }, { "param": "val1_str", "type": "char" }, { "param": "val2_str", "type": "char" }, { "param": "val1", "type": "uint16_t" }, { "param": "val2", "type": "uint16_t" }, { "param": "content", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "struct lyout", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "level", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "module", "type": "struct lys_module", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ext", "type": "struct lys_ext_instance_complex", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stmt", "type": "LY_STMT", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val1_str", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val2_str", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val1", "type": "uint16_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val2", "type": "uint16_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "content", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d8356695fecc069f37ba37f28071af0bc1722034
mekleo/libyang
src/parser_yang_lex.c
[ "BSD-3-Clause" ]
C
yy_get_previous_state
yy_state_type
static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { yy_state_type yy_current_state; char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 672 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; }
/* yy_get_previous_state - get the state just before the EOB char was reached */
get the state just before the EOB char was reached
[ "get", "the", "state", "just", "before", "the", "EOB", "char", "was", "reached" ]
static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { yy_state_type yy_current_state; char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 672 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; }
[ "static", "yy_state_type", "yy_get_previous_state", "(", "yyscan_t", "yyscanner", ")", "{", "yy_state_type", "yy_current_state", ";", "char", "*", "yy_cp", ";", "struct", "yyguts_t", "*", "yyg", "=", "(", "struct", "yyguts_t", "*", ")", "yyscanner", ";", "yy_current_state", "=", "yyg", "->", "yy_start", ";", "for", "(", "yy_cp", "=", "yyg", "->", "yytext_ptr", "+", "YY_MORE_ADJ", ";", "yy_cp", "<", "yyg", "->", "yy_c_buf_p", ";", "++", "yy_cp", ")", "{", "YY_CHAR", "yy_c", "=", "(", "*", "yy_cp", "?", "yy_ec", "[", "YY_SC_TO_UI", "(", "*", "yy_cp", ")", "]", ":", "1", ")", ";", "if", "(", "yy_accept", "[", "yy_current_state", "]", ")", "{", "yyg", "->", "yy_last_accepting_state", "=", "yy_current_state", ";", "yyg", "->", "yy_last_accepting_cpos", "=", "yy_cp", ";", "}", "while", "(", "yy_chk", "[", "yy_base", "[", "yy_current_state", "]", "+", "yy_c", "]", "!=", "yy_current_state", ")", "{", "yy_current_state", "=", "(", "int", ")", "yy_def", "[", "yy_current_state", "]", ";", "if", "(", "yy_current_state", ">=", "672", ")", "yy_c", "=", "yy_meta", "[", "yy_c", "]", ";", "}", "yy_current_state", "=", "yy_nxt", "[", "yy_base", "[", "yy_current_state", "]", "+", "yy_c", "]", ";", "}", "return", "yy_current_state", ";", "}" ]
yy_get_previous_state - get the state just before the EOB char was reached
[ "yy_get_previous_state", "-", "get", "the", "state", "just", "before", "the", "EOB", "char", "was", "reached" ]
[]
[ { "param": "yyscanner", "type": "yyscan_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "yyscanner", "type": "yyscan_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9f401f8aaf263731c3f5591b305dce98806b6af7
mekleo/libyang
src/parser.c
[ "BSD-3-Clause" ]
C
lyp_check_import
int
int lyp_check_import(struct lys_module *module, const char *value, struct lys_import *imp) { int i; struct lys_module *dup = NULL; struct ly_ctx *ctx = module->ctx; /* check for importing a single module in multiple revisions */ for (i = 0; i < module->imp_size; i++) { if (!module->imp[i].module) { /* skip the not yet filled records */ continue; } if (ly_strequal(module->imp[i].module->name, value, 1)) { /* check revisions, including multiple revisions of a single module is error */ if (imp->rev[0] && (!module->imp[i].module->rev_size || strcmp(module->imp[i].module->rev[0].date, imp->rev))) { /* the already imported module has * - no revision, but here we require some * - different revision than the one required here */ LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, "import"); LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Importing multiple revisions of module \"%s\".", value); return -1; } else if (!imp->rev[0]) { /* no revision, remember the duplication, but check revisions after loading the module * because the current revision can be the same (then it is ok) or it can differ (then it * is error */ dup = module->imp[i].module; break; } /* there is duplication, but since prefixes differs (checked in caller of this function), * it is ok */ imp->module = module->imp[i].module; return 0; } } /* circular import check */ if (lyp_check_circmod(module, value, 1)) { return -1; } /* load module - in specific situations it tries to get the module from the context */ imp->module = (struct lys_module *)ly_ctx_load_sub_module(module->ctx, NULL, value, imp->rev[0] ? imp->rev : NULL, module->ctx->models.flags & LY_CTX_ALLIMPLEMENTED ? 1 : 0, NULL); /* check the result */ if (!imp->module) { LOGERR(ctx, LY_EVALID, "Importing \"%s\" module into \"%s\" failed.", value, module->name); return -1; } if (imp->rev[0] && imp->module->rev_size && strcmp(imp->rev, imp->module->rev[0].date)) { LOGERR(ctx, LY_EVALID, "\"%s\" import of module \"%s\" in revision \"%s\" not found.", module->name, value, imp->rev); return -1; } if ((module->version < 2) && imp->rev[0] && (imp->module->version == 2)) { LOGERR(ctx, LY_EVALID, "YANG 1.0 module \"%s\" import with revision of YANG 1.1 module \"%s\".", module->name, imp->module->name); return -1; } if (dup) { /* check the revisions */ if ((dup != imp->module) || (dup->rev_size != imp->module->rev_size && (!dup->rev_size || imp->module->rev_size)) || (dup->rev_size && strcmp(dup->rev[0].date, imp->module->rev[0].date))) { /* - modules are not the same * - one of modules has no revision (except they both has no revision) * - revisions of the modules are not the same */ LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, "import"); LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Importing multiple revisions of module \"%s\".", value); return -1; } else { LOGWRN(ctx, "Module \"%s\" is imported by \"%s\" multiple times with different prefixes.", dup->name, module->name); } } return 0; }
/* returns: * 0 - imp successfully filled * -1 - error, imp not cleaned */
imp successfully filled -1 - error, imp not cleaned
[ "imp", "successfully", "filled", "-", "1", "-", "error", "imp", "not", "cleaned" ]
int lyp_check_import(struct lys_module *module, const char *value, struct lys_import *imp) { int i; struct lys_module *dup = NULL; struct ly_ctx *ctx = module->ctx; for (i = 0; i < module->imp_size; i++) { if (!module->imp[i].module) { continue; } if (ly_strequal(module->imp[i].module->name, value, 1)) { if (imp->rev[0] && (!module->imp[i].module->rev_size || strcmp(module->imp[i].module->rev[0].date, imp->rev))) { LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, "import"); LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Importing multiple revisions of module \"%s\".", value); return -1; } else if (!imp->rev[0]) { dup = module->imp[i].module; break; } imp->module = module->imp[i].module; return 0; } } if (lyp_check_circmod(module, value, 1)) { return -1; } imp->module = (struct lys_module *)ly_ctx_load_sub_module(module->ctx, NULL, value, imp->rev[0] ? imp->rev : NULL, module->ctx->models.flags & LY_CTX_ALLIMPLEMENTED ? 1 : 0, NULL); if (!imp->module) { LOGERR(ctx, LY_EVALID, "Importing \"%s\" module into \"%s\" failed.", value, module->name); return -1; } if (imp->rev[0] && imp->module->rev_size && strcmp(imp->rev, imp->module->rev[0].date)) { LOGERR(ctx, LY_EVALID, "\"%s\" import of module \"%s\" in revision \"%s\" not found.", module->name, value, imp->rev); return -1; } if ((module->version < 2) && imp->rev[0] && (imp->module->version == 2)) { LOGERR(ctx, LY_EVALID, "YANG 1.0 module \"%s\" import with revision of YANG 1.1 module \"%s\".", module->name, imp->module->name); return -1; } if (dup) { if ((dup != imp->module) || (dup->rev_size != imp->module->rev_size && (!dup->rev_size || imp->module->rev_size)) || (dup->rev_size && strcmp(dup->rev[0].date, imp->module->rev[0].date))) { LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, "import"); LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Importing multiple revisions of module \"%s\".", value); return -1; } else { LOGWRN(ctx, "Module \"%s\" is imported by \"%s\" multiple times with different prefixes.", dup->name, module->name); } } return 0; }
[ "int", "lyp_check_import", "(", "struct", "lys_module", "*", "module", ",", "const", "char", "*", "value", ",", "struct", "lys_import", "*", "imp", ")", "{", "int", "i", ";", "struct", "lys_module", "*", "dup", "=", "NULL", ";", "struct", "ly_ctx", "*", "ctx", "=", "module", "->", "ctx", ";", "for", "(", "i", "=", "0", ";", "i", "<", "module", "->", "imp_size", ";", "i", "++", ")", "{", "if", "(", "!", "module", "->", "imp", "[", "i", "]", ".", "module", ")", "{", "continue", ";", "}", "if", "(", "ly_strequal", "(", "module", "->", "imp", "[", "i", "]", ".", "module", "->", "name", ",", "value", ",", "1", ")", ")", "{", "if", "(", "imp", "->", "rev", "[", "0", "]", "&&", "(", "!", "module", "->", "imp", "[", "i", "]", ".", "module", "->", "rev_size", "||", "strcmp", "(", "module", "->", "imp", "[", "i", "]", ".", "module", "->", "rev", "[", "0", "]", ".", "date", ",", "imp", "->", "rev", ")", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "\"", "\"", ")", ";", "LOGVAL", "(", "ctx", ",", "LYE_SPEC", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"", "\\\"", "\\\"", "\"", ",", "value", ")", ";", "return", "-1", ";", "}", "else", "if", "(", "!", "imp", "->", "rev", "[", "0", "]", ")", "{", "dup", "=", "module", "->", "imp", "[", "i", "]", ".", "module", ";", "break", ";", "}", "imp", "->", "module", "=", "module", "->", "imp", "[", "i", "]", ".", "module", ";", "return", "0", ";", "}", "}", "if", "(", "lyp_check_circmod", "(", "module", ",", "value", ",", "1", ")", ")", "{", "return", "-1", ";", "}", "imp", "->", "module", "=", "(", "struct", "lys_module", "*", ")", "ly_ctx_load_sub_module", "(", "module", "->", "ctx", ",", "NULL", ",", "value", ",", "imp", "->", "rev", "[", "0", "]", "?", "imp", "->", "rev", ":", "NULL", ",", "module", "->", "ctx", "->", "models", ".", "flags", "&", "LY_CTX_ALLIMPLEMENTED", "?", "1", ":", "0", ",", "NULL", ")", ";", "if", "(", "!", "imp", "->", "module", ")", "{", "LOGERR", "(", "ctx", ",", "LY_EVALID", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "value", ",", "module", "->", "name", ")", ";", "return", "-1", ";", "}", "if", "(", "imp", "->", "rev", "[", "0", "]", "&&", "imp", "->", "module", "->", "rev_size", "&&", "strcmp", "(", "imp", "->", "rev", ",", "imp", "->", "module", "->", "rev", "[", "0", "]", ".", "date", ")", ")", "{", "LOGERR", "(", "ctx", ",", "LY_EVALID", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "module", "->", "name", ",", "value", ",", "imp", "->", "rev", ")", ";", "return", "-1", ";", "}", "if", "(", "(", "module", "->", "version", "<", "2", ")", "&&", "imp", "->", "rev", "[", "0", "]", "&&", "(", "imp", "->", "module", "->", "version", "==", "2", ")", ")", "{", "LOGERR", "(", "ctx", ",", "LY_EVALID", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "module", "->", "name", ",", "imp", "->", "module", "->", "name", ")", ";", "return", "-1", ";", "}", "if", "(", "dup", ")", "{", "if", "(", "(", "dup", "!=", "imp", "->", "module", ")", "||", "(", "dup", "->", "rev_size", "!=", "imp", "->", "module", "->", "rev_size", "&&", "(", "!", "dup", "->", "rev_size", "||", "imp", "->", "module", "->", "rev_size", ")", ")", "||", "(", "dup", "->", "rev_size", "&&", "strcmp", "(", "dup", "->", "rev", "[", "0", "]", ".", "date", ",", "imp", "->", "module", "->", "rev", "[", "0", "]", ".", "date", ")", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "\"", "\"", ")", ";", "LOGVAL", "(", "ctx", ",", "LYE_SPEC", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"", "\\\"", "\\\"", "\"", ",", "value", ")", ";", "return", "-1", ";", "}", "else", "{", "LOGWRN", "(", "ctx", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "dup", "->", "name", ",", "module", "->", "name", ")", ";", "}", "}", "return", "0", ";", "}" ]
returns: 0 - imp successfully filled -1 - error, imp not cleaned
[ "returns", ":", "0", "-", "imp", "successfully", "filled", "-", "1", "-", "error", "imp", "not", "cleaned" ]
[ "/* check for importing a single module in multiple revisions */", "/* skip the not yet filled records */", "/* check revisions, including multiple revisions of a single module is error */", "/* the already imported module has\n * - no revision, but here we require some\n * - different revision than the one required here */", "/* no revision, remember the duplication, but check revisions after loading the module\n * because the current revision can be the same (then it is ok) or it can differ (then it\n * is error */", "/* there is duplication, but since prefixes differs (checked in caller of this function),\n * it is ok */", "/* circular import check */", "/* load module - in specific situations it tries to get the module from the context */", "/* check the result */", "/* check the revisions */", "/* - modules are not the same\n * - one of modules has no revision (except they both has no revision)\n * - revisions of the modules are not the same */" ]
[ { "param": "module", "type": "struct lys_module" }, { "param": "value", "type": "char" }, { "param": "imp", "type": "struct lys_import" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module", "type": "struct lys_module", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "imp", "type": "struct lys_import", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9f401f8aaf263731c3f5591b305dce98806b6af7
mekleo/libyang
src/parser.c
[ "BSD-3-Clause" ]
C
lyp_rfn_apply_ext
int
int lyp_rfn_apply_ext(struct lys_module *module) { int i, k, a = 0; struct lys_node *root, *nextroot, *next, *node; struct lys_node *target; struct lys_node_uses *uses; struct lys_refine *rfn; struct ly_set *extset; /* refines in uses */ LY_TREE_FOR_SAFE(module->data, nextroot, root) { /* go through the data tree of the module and all the defined augments */ LY_TREE_DFS_BEGIN(root, next, node) { if (node->nodetype == LYS_USES) { uses = (struct lys_node_uses *)node; for (i = 0; i < uses->refine_size; i++) { if (!uses->refine[i].ext_size) { /* no extensions in refine */ continue; } rfn = &uses->refine[i]; /* shortcut */ /* get the target node */ target = NULL; resolve_descendant_schema_nodeid(rfn->target_name, uses->child, LYS_NO_RPC_NOTIF_NODE | LYS_ACTION | LYS_NOTIF, 0, (const struct lys_node **)&target); if (!target) { /* it should always succeed since the target_name was already resolved at least * once when the refine itself was being resolved */ LOGINT(module->ctx);; return EXIT_FAILURE; } /* extensions */ extset = ly_set_new(); k = -1; while ((k = lys_ext_iter(rfn->ext, rfn->ext_size, k + 1, LYEXT_SUBSTMT_SELF)) != -1) { ly_set_add(extset, rfn->ext[k]->def, 0); } for (k = 0; (unsigned int)k < extset->number; k++) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_SELF, (struct lys_ext *)extset->set.g[k])) { ly_set_free(extset); return EXIT_FAILURE; } } ly_set_free(extset); /* description */ if (rfn->dsc && lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_DESCRIPTION, NULL)) { return EXIT_FAILURE; } /* reference */ if (rfn->ref && lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_REFERENCE, NULL)) { return EXIT_FAILURE; } /* config, in case of notification or rpc/action{notif, the config is not applicable * (there is no config status) */ if ((rfn->flags & LYS_CONFIG_MASK) && (target->flags & LYS_CONFIG_MASK)) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_CONFIG, NULL)) { return EXIT_FAILURE; } } /* default value */ if (rfn->dflt_size && lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_DEFAULT, NULL)) { return EXIT_FAILURE; } /* mandatory */ if (rfn->flags & LYS_MAND_MASK) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_MANDATORY, NULL)) { return EXIT_FAILURE; } } /* presence */ if ((target->nodetype & LYS_CONTAINER) && rfn->mod.presence) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_PRESENCE, NULL)) { return EXIT_FAILURE; } } /* min/max */ if (rfn->flags & LYS_RFN_MINSET) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_MIN, NULL)) { return EXIT_FAILURE; } } if (rfn->flags & LYS_RFN_MAXSET) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_MAX, NULL)) { return EXIT_FAILURE; } } /* must and if-feature contain extensions on their own, not needed to be solved here */ if (target->ext_size) { /* the allocated target's extension array can be now longer than needed in case * there is less refine substatement's extensions than in original. Since we are * going to reduce or keep the same memory, it is not necessary to test realloc's result */ target->ext = realloc(target->ext, target->ext_size * sizeof *target->ext); } } } #if defined(TYPES_COMPATIBLE) LY_TREE_DFS_END(root, next, node) #else LY_SCHEMA_TREE_DFS_END(root, next, node) #endif } if (!nextroot && a < module->augment_size) { nextroot = module->augment[a].child; a++; } } return EXIT_SUCCESS; }
/* * apply extension instances defined under refine's substatements. * It cannot be done immediately when applying the refine because there can be * still unresolved data (e.g. type) and mainly the targeted extension instances. */
apply extension instances defined under refine's substatements. It cannot be done immediately when applying the refine because there can be still unresolved data and mainly the targeted extension instances.
[ "apply", "extension", "instances", "defined", "under", "refine", "'", "s", "substatements", ".", "It", "cannot", "be", "done", "immediately", "when", "applying", "the", "refine", "because", "there", "can", "be", "still", "unresolved", "data", "and", "mainly", "the", "targeted", "extension", "instances", "." ]
int lyp_rfn_apply_ext(struct lys_module *module) { int i, k, a = 0; struct lys_node *root, *nextroot, *next, *node; struct lys_node *target; struct lys_node_uses *uses; struct lys_refine *rfn; struct ly_set *extset; LY_TREE_FOR_SAFE(module->data, nextroot, root) { LY_TREE_DFS_BEGIN(root, next, node) { if (node->nodetype == LYS_USES) { uses = (struct lys_node_uses *)node; for (i = 0; i < uses->refine_size; i++) { if (!uses->refine[i].ext_size) { continue; } rfn = &uses->refine[i]; target = NULL; resolve_descendant_schema_nodeid(rfn->target_name, uses->child, LYS_NO_RPC_NOTIF_NODE | LYS_ACTION | LYS_NOTIF, 0, (const struct lys_node **)&target); if (!target) { LOGINT(module->ctx);; return EXIT_FAILURE; } extset = ly_set_new(); k = -1; while ((k = lys_ext_iter(rfn->ext, rfn->ext_size, k + 1, LYEXT_SUBSTMT_SELF)) != -1) { ly_set_add(extset, rfn->ext[k]->def, 0); } for (k = 0; (unsigned int)k < extset->number; k++) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_SELF, (struct lys_ext *)extset->set.g[k])) { ly_set_free(extset); return EXIT_FAILURE; } } ly_set_free(extset); if (rfn->dsc && lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_DESCRIPTION, NULL)) { return EXIT_FAILURE; } if (rfn->ref && lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_REFERENCE, NULL)) { return EXIT_FAILURE; } if ((rfn->flags & LYS_CONFIG_MASK) && (target->flags & LYS_CONFIG_MASK)) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_CONFIG, NULL)) { return EXIT_FAILURE; } } if (rfn->dflt_size && lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_DEFAULT, NULL)) { return EXIT_FAILURE; } if (rfn->flags & LYS_MAND_MASK) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_MANDATORY, NULL)) { return EXIT_FAILURE; } } if ((target->nodetype & LYS_CONTAINER) && rfn->mod.presence) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_PRESENCE, NULL)) { return EXIT_FAILURE; } } if (rfn->flags & LYS_RFN_MINSET) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_MIN, NULL)) { return EXIT_FAILURE; } } if (rfn->flags & LYS_RFN_MAXSET) { if (lyp_rfn_apply_ext_(rfn, target, LYEXT_SUBSTMT_MAX, NULL)) { return EXIT_FAILURE; } } if (target->ext_size) { target->ext = realloc(target->ext, target->ext_size * sizeof *target->ext); } } } #if defined(TYPES_COMPATIBLE) LY_TREE_DFS_END(root, next, node) #else LY_SCHEMA_TREE_DFS_END(root, next, node) #endif } if (!nextroot && a < module->augment_size) { nextroot = module->augment[a].child; a++; } } return EXIT_SUCCESS; }
[ "int", "lyp_rfn_apply_ext", "(", "struct", "lys_module", "*", "module", ")", "{", "int", "i", ",", "k", ",", "a", "=", "0", ";", "struct", "lys_node", "*", "root", ",", "*", "nextroot", ",", "*", "next", ",", "*", "node", ";", "struct", "lys_node", "*", "target", ";", "struct", "lys_node_uses", "*", "uses", ";", "struct", "lys_refine", "*", "rfn", ";", "struct", "ly_set", "*", "extset", ";", "LY_TREE_FOR_SAFE", "(", "module", "->", "data", ",", "nextroot", ",", "root", ")", "", "{", "LY_TREE_DFS_BEGIN", "(", "root", ",", "next", ",", "node", ")", "", "{", "if", "(", "node", "->", "nodetype", "==", "LYS_USES", ")", "{", "uses", "=", "(", "struct", "lys_node_uses", "*", ")", "node", ";", "for", "(", "i", "=", "0", ";", "i", "<", "uses", "->", "refine_size", ";", "i", "++", ")", "{", "if", "(", "!", "uses", "->", "refine", "[", "i", "]", ".", "ext_size", ")", "{", "continue", ";", "}", "rfn", "=", "&", "uses", "->", "refine", "[", "i", "]", ";", "target", "=", "NULL", ";", "resolve_descendant_schema_nodeid", "(", "rfn", "->", "target_name", ",", "uses", "->", "child", ",", "LYS_NO_RPC_NOTIF_NODE", "|", "LYS_ACTION", "|", "LYS_NOTIF", ",", "0", ",", "(", "const", "struct", "lys_node", "*", "*", ")", "&", "target", ")", ";", "if", "(", "!", "target", ")", "{", "LOGINT", "(", "module", "->", "ctx", ")", ";", ";", "return", "EXIT_FAILURE", ";", "}", "extset", "=", "ly_set_new", "(", ")", ";", "k", "=", "-1", ";", "while", "(", "(", "k", "=", "lys_ext_iter", "(", "rfn", "->", "ext", ",", "rfn", "->", "ext_size", ",", "k", "+", "1", ",", "LYEXT_SUBSTMT_SELF", ")", ")", "!=", "-1", ")", "{", "ly_set_add", "(", "extset", ",", "rfn", "->", "ext", "[", "k", "]", "->", "def", ",", "0", ")", ";", "}", "for", "(", "k", "=", "0", ";", "(", "unsigned", "int", ")", "k", "<", "extset", "->", "number", ";", "k", "++", ")", "{", "if", "(", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_SELF", ",", "(", "struct", "lys_ext", "*", ")", "extset", "->", "set", ".", "g", "[", "k", "]", ")", ")", "{", "ly_set_free", "(", "extset", ")", ";", "return", "EXIT_FAILURE", ";", "}", "}", "ly_set_free", "(", "extset", ")", ";", "if", "(", "rfn", "->", "dsc", "&&", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_DESCRIPTION", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "if", "(", "rfn", "->", "ref", "&&", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_REFERENCE", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "if", "(", "(", "rfn", "->", "flags", "&", "LYS_CONFIG_MASK", ")", "&&", "(", "target", "->", "flags", "&", "LYS_CONFIG_MASK", ")", ")", "{", "if", "(", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_CONFIG", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "}", "if", "(", "rfn", "->", "dflt_size", "&&", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_DEFAULT", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "if", "(", "rfn", "->", "flags", "&", "LYS_MAND_MASK", ")", "{", "if", "(", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_MANDATORY", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "}", "if", "(", "(", "target", "->", "nodetype", "&", "LYS_CONTAINER", ")", "&&", "rfn", "->", "mod", ".", "presence", ")", "{", "if", "(", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_PRESENCE", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "}", "if", "(", "rfn", "->", "flags", "&", "LYS_RFN_MINSET", ")", "{", "if", "(", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_MIN", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "}", "if", "(", "rfn", "->", "flags", "&", "LYS_RFN_MAXSET", ")", "{", "if", "(", "lyp_rfn_apply_ext_", "(", "rfn", ",", "target", ",", "LYEXT_SUBSTMT_MAX", ",", "NULL", ")", ")", "{", "return", "EXIT_FAILURE", ";", "}", "}", "if", "(", "target", "->", "ext_size", ")", "{", "target", "->", "ext", "=", "realloc", "(", "target", "->", "ext", ",", "target", "->", "ext_size", "*", "sizeof", "*", "target", "->", "ext", ")", ";", "}", "}", "}", "#if", "defined", "(", "TYPES_COMPATIBLE", ")", "\n", "LY_TREE_DFS_END", "(", "root", ",", "next", ",", "node", ")", "", "#else", "LY_SCHEMA_TREE_DFS_END", "(", "root", ",", "next", ",", "node", ")", "", "#endif", "}", "if", "(", "!", "nextroot", "&&", "a", "<", "module", "->", "augment_size", ")", "{", "nextroot", "=", "module", "->", "augment", "[", "a", "]", ".", "child", ";", "a", "++", ";", "}", "}", "return", "EXIT_SUCCESS", ";", "}" ]
apply extension instances defined under refine's substatements.
[ "apply", "extension", "instances", "defined", "under", "refine", "'", "s", "substatements", "." ]
[ "/* refines in uses */", "/* go through the data tree of the module and all the defined augments */", "/* no extensions in refine */", "/* shortcut */", "/* get the target node */", "/* it should always succeed since the target_name was already resolved at least\n * once when the refine itself was being resolved */", "/* extensions */", "/* description */", "/* reference */", "/* config, in case of notification or rpc/action{notif, the config is not applicable\n * (there is no config status) */", "/* default value */", "/* mandatory */", "/* presence */", "/* min/max */", "/* must and if-feature contain extensions on their own, not needed to be solved here */", "/* the allocated target's extension array can be now longer than needed in case\n * there is less refine substatement's extensions than in original. Since we are\n * going to reduce or keep the same memory, it is not necessary to test realloc's result */" ]
[ { "param": "module", "type": "struct lys_module" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module", "type": "struct lys_module", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e7e8100062ec144d311182f82862ac42ec6bacf7
mekleo/libyang
src/parser_json.c
[ "BSD-3-Clause" ]
C
json_skip_unknown
int
static int json_skip_unknown(struct ly_ctx *ctx, struct lyd_node *parent, const char *data, unsigned int *len) { int qstr = 0; int objects = 0; int arrays = 0; while (data[*len]) { switch (data[*len]) { case '\"': if (qstr) { if (data[(*len) - 1] != '\\') { qstr = 0; } } else if (data[(*len) - 1] != '\\') { qstr = 1; } else { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_LYD, parent, "JSON data (missing quotation mark for a string data) "); return -1; } break; case '[': if (!qstr) { arrays++; } break; case '{': if (!qstr) { objects++; } break; case ']': if (!qstr) { arrays--; } break; case '}': if (!qstr) { objects--; } break; case ',': if (!qstr && !objects && !arrays) { /* do not eat the comma character */ return 0; } } if (objects < 0) { if (arrays) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_LYD, parent, "JSON data (missing end-array)"); return -1; } return 0; } if (arrays < 0) { if (objects) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_LYD, parent, "JSON data (missing end-object)"); return -1; } return 0; } (*len)++; } return 0; }
/** * @brief Skip subtree (find its end in the input data) of the current JSON item. * @param[in] ctx libyang context for logging * @param[in] parent parent node for logging * @param[in] data input data (pointing to the beginning, @p len is used to go to the current position). * @param[in, out] len Current position in the @p data, will be updated to the end of the element's subtree in the @p data * @retun 0 on success * @return -1 on error. */
@brief Skip subtree (find its end in the input data) of the current JSON item. @param[in] ctx libyang context for logging @param[in] parent parent node for logging @param[in] data input data (pointing to the beginning, @p len is used to go to the current position).
[ "@brief", "Skip", "subtree", "(", "find", "its", "end", "in", "the", "input", "data", ")", "of", "the", "current", "JSON", "item", ".", "@param", "[", "in", "]", "ctx", "libyang", "context", "for", "logging", "@param", "[", "in", "]", "parent", "parent", "node", "for", "logging", "@param", "[", "in", "]", "data", "input", "data", "(", "pointing", "to", "the", "beginning", "@p", "len", "is", "used", "to", "go", "to", "the", "current", "position", ")", "." ]
static int json_skip_unknown(struct ly_ctx *ctx, struct lyd_node *parent, const char *data, unsigned int *len) { int qstr = 0; int objects = 0; int arrays = 0; while (data[*len]) { switch (data[*len]) { case '\"': if (qstr) { if (data[(*len) - 1] != '\\') { qstr = 0; } } else if (data[(*len) - 1] != '\\') { qstr = 1; } else { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_LYD, parent, "JSON data (missing quotation mark for a string data) "); return -1; } break; case '[': if (!qstr) { arrays++; } break; case '{': if (!qstr) { objects++; } break; case ']': if (!qstr) { arrays--; } break; case '}': if (!qstr) { objects--; } break; case ',': if (!qstr && !objects && !arrays) { return 0; } } if (objects < 0) { if (arrays) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_LYD, parent, "JSON data (missing end-array)"); return -1; } return 0; } if (arrays < 0) { if (objects) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_LYD, parent, "JSON data (missing end-object)"); return -1; } return 0; } (*len)++; } return 0; }
[ "static", "int", "json_skip_unknown", "(", "struct", "ly_ctx", "*", "ctx", ",", "struct", "lyd_node", "*", "parent", ",", "const", "char", "*", "data", ",", "unsigned", "int", "*", "len", ")", "{", "int", "qstr", "=", "0", ";", "int", "objects", "=", "0", ";", "int", "arrays", "=", "0", ";", "while", "(", "data", "[", "*", "len", "]", ")", "{", "switch", "(", "data", "[", "*", "len", "]", ")", "{", "case", "'", "\\\"", "'", ":", "if", "(", "qstr", ")", "{", "if", "(", "data", "[", "(", "*", "len", ")", "-", "1", "]", "!=", "'", "\\\\", "'", ")", "{", "qstr", "=", "0", ";", "}", "}", "else", "if", "(", "data", "[", "(", "*", "len", ")", "-", "1", "]", "!=", "'", "\\\\", "'", ")", "{", "qstr", "=", "1", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_XML_INVAL", ",", "LY_VLOG_LYD", ",", "parent", ",", "\"", "\"", ")", ";", "return", "-1", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "!", "qstr", ")", "{", "arrays", "++", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "!", "qstr", ")", "{", "objects", "++", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "!", "qstr", ")", "{", "arrays", "--", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "!", "qstr", ")", "{", "objects", "--", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "!", "qstr", "&&", "!", "objects", "&&", "!", "arrays", ")", "{", "return", "0", ";", "}", "}", "if", "(", "objects", "<", "0", ")", "{", "if", "(", "arrays", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_XML_INVAL", ",", "LY_VLOG_LYD", ",", "parent", ",", "\"", "\"", ")", ";", "return", "-1", ";", "}", "return", "0", ";", "}", "if", "(", "arrays", "<", "0", ")", "{", "if", "(", "objects", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_XML_INVAL", ",", "LY_VLOG_LYD", ",", "parent", ",", "\"", "\"", ")", ";", "return", "-1", ";", "}", "return", "0", ";", "}", "(", "*", "len", ")", "++", ";", "}", "return", "0", ";", "}" ]
@brief Skip subtree (find its end in the input data) of the current JSON item.
[ "@brief", "Skip", "subtree", "(", "find", "its", "end", "in", "the", "input", "data", ")", "of", "the", "current", "JSON", "item", "." ]
[ "/* do not eat the comma character */" ]
[ { "param": "ctx", "type": "struct ly_ctx" }, { "param": "parent", "type": "struct lyd_node" }, { "param": "data", "type": "char" }, { "param": "len", "type": "unsigned int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctx", "type": "struct ly_ctx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parent", "type": "struct lyd_node", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "len", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_prepare_putv
int
int ARMCII_Buf_prepare_putv(void **orig_bufs, void ***new_bufs_ptr, int count, int size) { int num_moved = 0; if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { void **new_bufs = malloc(count*sizeof(void*)); int i; for (i = 0; i < count; i++) new_bufs[i] = NULL; for (i = 0; i < count; i++) { // Check if the source buffer is within a shared region. If so, copy it // into a private buffer. gmr_t *mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); if (mreg != NULL) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); gmr_dla_lock(mreg); ARMCI_Copy(orig_bufs[i], new_bufs[i], size); // gmr_get(mreg, orig_bufs[i], new_bufs[i], size, ARMCI_GROUP_WORLD.rank); gmr_dla_unlock(mreg); num_moved++; } else { new_bufs[i] = orig_bufs[i]; } } *new_bufs_ptr = new_bufs; } else { *new_bufs_ptr = orig_bufs; } return num_moved; }
/** Prepare a set of buffers for use with a put operation. The returned set of * buffers is guaranteed to be in private space. Copies will be made if needed, * the result should be completed by finish. * * @param[in] orig_bufs Original set of buffers. * @param[out] new_bufs Pointer to the set of private buffers. * @param[in] count Number of entries in the buffer list. * @param[in] size The size of the buffers (all are of the same size). * @return Number of buffers that were moved. */
Prepare a set of buffers for use with a put operation. The returned set of buffers is guaranteed to be in private space. Copies will be made if needed, the result should be completed by finish. @param[in] orig_bufs Original set of buffers. @param[out] new_bufs Pointer to the set of private buffers. @param[in] count Number of entries in the buffer list. @param[in] size The size of the buffers (all are of the same size). @return Number of buffers that were moved.
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "a", "put", "operation", ".", "The", "returned", "set", "of", "buffers", "is", "guaranteed", "to", "be", "in", "private", "space", ".", "Copies", "will", "be", "made", "if", "needed", "the", "result", "should", "be", "completed", "by", "finish", ".", "@param", "[", "in", "]", "orig_bufs", "Original", "set", "of", "buffers", ".", "@param", "[", "out", "]", "new_bufs", "Pointer", "to", "the", "set", "of", "private", "buffers", ".", "@param", "[", "in", "]", "count", "Number", "of", "entries", "in", "the", "buffer", "list", ".", "@param", "[", "in", "]", "size", "The", "size", "of", "the", "buffers", "(", "all", "are", "of", "the", "same", "size", ")", ".", "@return", "Number", "of", "buffers", "that", "were", "moved", "." ]
int ARMCII_Buf_prepare_putv(void **orig_bufs, void ***new_bufs_ptr, int count, int size) { int num_moved = 0; if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { void **new_bufs = malloc(count*sizeof(void*)); int i; for (i = 0; i < count; i++) new_bufs[i] = NULL; for (i = 0; i < count; i++) { gmr_t *mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); if (mreg != NULL) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); gmr_dla_lock(mreg); ARMCI_Copy(orig_bufs[i], new_bufs[i], size); gmr_dla_unlock(mreg); num_moved++; } else { new_bufs[i] = orig_bufs[i]; } } *new_bufs_ptr = new_bufs; } else { *new_bufs_ptr = orig_bufs; } return num_moved; }
[ "int", "ARMCII_Buf_prepare_putv", "(", "void", "*", "*", "orig_bufs", ",", "void", "*", "*", "*", "new_bufs_ptr", ",", "int", "count", ",", "int", "size", ")", "{", "int", "num_moved", "=", "0", ";", "if", "(", "ARMCII_GLOBAL_STATE", ".", "shr_buf_method", "!=", "ARMCII_SHR_BUF_NOGUARD", ")", "{", "void", "*", "*", "new_bufs", "=", "malloc", "(", "count", "*", "sizeof", "(", "void", "*", ")", ")", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "new_bufs", "[", "i", "]", "=", "NULL", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "gmr_t", "*", "mreg", "=", "gmr_lookup", "(", "orig_bufs", "[", "i", "]", ",", "ARMCI_GROUP_WORLD", ".", "rank", ")", ";", "if", "(", "mreg", "!=", "NULL", ")", "{", "MPI_Alloc_mem", "(", "size", ",", "MPI_INFO_NULL", ",", "&", "new_bufs", "[", "i", "]", ")", ";", "ARMCII_Assert", "(", "new_bufs", "[", "i", "]", "!=", "NULL", ")", ";", "gmr_dla_lock", "(", "mreg", ")", ";", "ARMCI_Copy", "(", "orig_bufs", "[", "i", "]", ",", "new_bufs", "[", "i", "]", ",", "size", ")", ";", "gmr_dla_unlock", "(", "mreg", ")", ";", "num_moved", "++", ";", "}", "else", "{", "new_bufs", "[", "i", "]", "=", "orig_bufs", "[", "i", "]", ";", "}", "}", "*", "new_bufs_ptr", "=", "new_bufs", ";", "}", "else", "{", "*", "new_bufs_ptr", "=", "orig_bufs", ";", "}", "return", "num_moved", ";", "}" ]
Prepare a set of buffers for use with a put operation.
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "a", "put", "operation", "." ]
[ "// Check if the source buffer is within a shared region. If so, copy it", "// into a private buffer.", "// gmr_get(mreg, orig_bufs[i], new_bufs[i], size, ARMCI_GROUP_WORLD.rank);" ]
[ { "param": "orig_bufs", "type": "void" }, { "param": "new_bufs_ptr", "type": "void" }, { "param": "count", "type": "int" }, { "param": "size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "orig_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_bufs_ptr", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_finish_putv
void
void ARMCII_Buf_finish_putv(void **orig_bufs, void **new_bufs, int count, int size) { if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { int i; for (i = 0; i < count; i++) { if (orig_bufs[i] != new_bufs[i]) { MPI_Free_mem(new_bufs[i]); } } free(new_bufs); } }
/** Finish a set of prepared buffers. Will perform communication and copies as * needed to ensure results are in the original buffers. Temporary space will be * freed. * * @param[in] orig_bufs Original set of buffers. * @param[out] new_bufs Set of private buffers. * @param[in] count Number of entries in the buffer list. * @param[in] size The size of the buffers (all are of the same size). */
Finish a set of prepared buffers. Will perform communication and copies as needed to ensure results are in the original buffers. Temporary space will be freed. @param[in] orig_bufs Original set of buffers. @param[out] new_bufs Set of private buffers. @param[in] count Number of entries in the buffer list. @param[in] size The size of the buffers (all are of the same size).
[ "Finish", "a", "set", "of", "prepared", "buffers", ".", "Will", "perform", "communication", "and", "copies", "as", "needed", "to", "ensure", "results", "are", "in", "the", "original", "buffers", ".", "Temporary", "space", "will", "be", "freed", ".", "@param", "[", "in", "]", "orig_bufs", "Original", "set", "of", "buffers", ".", "@param", "[", "out", "]", "new_bufs", "Set", "of", "private", "buffers", ".", "@param", "[", "in", "]", "count", "Number", "of", "entries", "in", "the", "buffer", "list", ".", "@param", "[", "in", "]", "size", "The", "size", "of", "the", "buffers", "(", "all", "are", "of", "the", "same", "size", ")", "." ]
void ARMCII_Buf_finish_putv(void **orig_bufs, void **new_bufs, int count, int size) { if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { int i; for (i = 0; i < count; i++) { if (orig_bufs[i] != new_bufs[i]) { MPI_Free_mem(new_bufs[i]); } } free(new_bufs); } }
[ "void", "ARMCII_Buf_finish_putv", "(", "void", "*", "*", "orig_bufs", ",", "void", "*", "*", "new_bufs", ",", "int", "count", ",", "int", "size", ")", "{", "if", "(", "ARMCII_GLOBAL_STATE", ".", "shr_buf_method", "!=", "ARMCII_SHR_BUF_NOGUARD", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "if", "(", "orig_bufs", "[", "i", "]", "!=", "new_bufs", "[", "i", "]", ")", "{", "MPI_Free_mem", "(", "new_bufs", "[", "i", "]", ")", ";", "}", "}", "free", "(", "new_bufs", ")", ";", "}", "}" ]
Finish a set of prepared buffers.
[ "Finish", "a", "set", "of", "prepared", "buffers", "." ]
[]
[ { "param": "orig_bufs", "type": "void" }, { "param": "new_bufs", "type": "void" }, { "param": "count", "type": "int" }, { "param": "size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "orig_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_prepare_accv
int
int ARMCII_Buf_prepare_accv(void **orig_bufs, void ***new_bufs_ptr, int count, int size, int datatype, void *scale) { void **new_bufs; int i, scaled, num_moved = 0; new_bufs = malloc(count*sizeof(void*)); ARMCII_Assert(new_bufs != NULL); scaled = ARMCII_Buf_acc_is_scaled(datatype, scale); for (i = 0; i < count; i++) { gmr_t *mreg; // Check if the source buffer is within a shared region. mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); if (scaled) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); // Lock if needed so we can directly access the buffer if (mreg != NULL && ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) gmr_dla_lock(mreg); ARMCII_Buf_acc_scale(orig_bufs[i], new_bufs[i], size, datatype, scale); if (mreg != NULL && ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) gmr_dla_unlock(mreg); } else { new_bufs[i] = orig_bufs[i]; } if (mreg != NULL && ARMCII_GLOBAL_STATE.shr_buf_method == ARMCII_SHR_BUF_COPY) { // If the buffer wasn't copied, we should copy it into a private buffer if (new_bufs[i] == orig_bufs[i]) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); gmr_dla_lock(mreg); ARMCI_Copy(orig_bufs[i], new_bufs[i], size); gmr_dla_unlock(mreg); } } if (new_bufs[i] == orig_bufs[i]) num_moved++; } *new_bufs_ptr = new_bufs; return num_moved; }
/** Prepare a set of buffers for use with an accumulate operation. The * returned set of buffers is guaranteed to be in private space and scaled. * Copies will be made if needed, the result should be completed by finish. * * @param[in] orig_bufs Original set of buffers. * @param[out] new_bufs Pointer to the set of private buffers. * @param[in] count Number of entries in the buffer list. * @param[in] size The size of the buffers (all are of the same size). * @param[in] datatype The type of the buffer. * @param[in] scale Scaling constant to apply to each buffer. * @return Number of buffers that were moved. */
Prepare a set of buffers for use with an accumulate operation. The returned set of buffers is guaranteed to be in private space and scaled. Copies will be made if needed, the result should be completed by finish. @param[in] orig_bufs Original set of buffers. @param[out] new_bufs Pointer to the set of private buffers. @param[in] count Number of entries in the buffer list. @param[in] size The size of the buffers (all are of the same size). @param[in] datatype The type of the buffer. @param[in] scale Scaling constant to apply to each buffer. @return Number of buffers that were moved.
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "an", "accumulate", "operation", ".", "The", "returned", "set", "of", "buffers", "is", "guaranteed", "to", "be", "in", "private", "space", "and", "scaled", ".", "Copies", "will", "be", "made", "if", "needed", "the", "result", "should", "be", "completed", "by", "finish", ".", "@param", "[", "in", "]", "orig_bufs", "Original", "set", "of", "buffers", ".", "@param", "[", "out", "]", "new_bufs", "Pointer", "to", "the", "set", "of", "private", "buffers", ".", "@param", "[", "in", "]", "count", "Number", "of", "entries", "in", "the", "buffer", "list", ".", "@param", "[", "in", "]", "size", "The", "size", "of", "the", "buffers", "(", "all", "are", "of", "the", "same", "size", ")", ".", "@param", "[", "in", "]", "datatype", "The", "type", "of", "the", "buffer", ".", "@param", "[", "in", "]", "scale", "Scaling", "constant", "to", "apply", "to", "each", "buffer", ".", "@return", "Number", "of", "buffers", "that", "were", "moved", "." ]
int ARMCII_Buf_prepare_accv(void **orig_bufs, void ***new_bufs_ptr, int count, int size, int datatype, void *scale) { void **new_bufs; int i, scaled, num_moved = 0; new_bufs = malloc(count*sizeof(void*)); ARMCII_Assert(new_bufs != NULL); scaled = ARMCII_Buf_acc_is_scaled(datatype, scale); for (i = 0; i < count; i++) { gmr_t *mreg; mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); if (scaled) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); if (mreg != NULL && ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) gmr_dla_lock(mreg); ARMCII_Buf_acc_scale(orig_bufs[i], new_bufs[i], size, datatype, scale); if (mreg != NULL && ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) gmr_dla_unlock(mreg); } else { new_bufs[i] = orig_bufs[i]; } if (mreg != NULL && ARMCII_GLOBAL_STATE.shr_buf_method == ARMCII_SHR_BUF_COPY) { if (new_bufs[i] == orig_bufs[i]) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); gmr_dla_lock(mreg); ARMCI_Copy(orig_bufs[i], new_bufs[i], size); gmr_dla_unlock(mreg); } } if (new_bufs[i] == orig_bufs[i]) num_moved++; } *new_bufs_ptr = new_bufs; return num_moved; }
[ "int", "ARMCII_Buf_prepare_accv", "(", "void", "*", "*", "orig_bufs", ",", "void", "*", "*", "*", "new_bufs_ptr", ",", "int", "count", ",", "int", "size", ",", "int", "datatype", ",", "void", "*", "scale", ")", "{", "void", "*", "*", "new_bufs", ";", "int", "i", ",", "scaled", ",", "num_moved", "=", "0", ";", "new_bufs", "=", "malloc", "(", "count", "*", "sizeof", "(", "void", "*", ")", ")", ";", "ARMCII_Assert", "(", "new_bufs", "!=", "NULL", ")", ";", "scaled", "=", "ARMCII_Buf_acc_is_scaled", "(", "datatype", ",", "scale", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "gmr_t", "*", "mreg", ";", "mreg", "=", "gmr_lookup", "(", "orig_bufs", "[", "i", "]", ",", "ARMCI_GROUP_WORLD", ".", "rank", ")", ";", "if", "(", "scaled", ")", "{", "MPI_Alloc_mem", "(", "size", ",", "MPI_INFO_NULL", ",", "&", "new_bufs", "[", "i", "]", ")", ";", "ARMCII_Assert", "(", "new_bufs", "[", "i", "]", "!=", "NULL", ")", ";", "if", "(", "mreg", "!=", "NULL", "&&", "ARMCII_GLOBAL_STATE", ".", "shr_buf_method", "!=", "ARMCII_SHR_BUF_NOGUARD", ")", "gmr_dla_lock", "(", "mreg", ")", ";", "ARMCII_Buf_acc_scale", "(", "orig_bufs", "[", "i", "]", ",", "new_bufs", "[", "i", "]", ",", "size", ",", "datatype", ",", "scale", ")", ";", "if", "(", "mreg", "!=", "NULL", "&&", "ARMCII_GLOBAL_STATE", ".", "shr_buf_method", "!=", "ARMCII_SHR_BUF_NOGUARD", ")", "gmr_dla_unlock", "(", "mreg", ")", ";", "}", "else", "{", "new_bufs", "[", "i", "]", "=", "orig_bufs", "[", "i", "]", ";", "}", "if", "(", "mreg", "!=", "NULL", "&&", "ARMCII_GLOBAL_STATE", ".", "shr_buf_method", "==", "ARMCII_SHR_BUF_COPY", ")", "{", "if", "(", "new_bufs", "[", "i", "]", "==", "orig_bufs", "[", "i", "]", ")", "{", "MPI_Alloc_mem", "(", "size", ",", "MPI_INFO_NULL", ",", "&", "new_bufs", "[", "i", "]", ")", ";", "ARMCII_Assert", "(", "new_bufs", "[", "i", "]", "!=", "NULL", ")", ";", "gmr_dla_lock", "(", "mreg", ")", ";", "ARMCI_Copy", "(", "orig_bufs", "[", "i", "]", ",", "new_bufs", "[", "i", "]", ",", "size", ")", ";", "gmr_dla_unlock", "(", "mreg", ")", ";", "}", "}", "if", "(", "new_bufs", "[", "i", "]", "==", "orig_bufs", "[", "i", "]", ")", "num_moved", "++", ";", "}", "*", "new_bufs_ptr", "=", "new_bufs", ";", "return", "num_moved", ";", "}" ]
Prepare a set of buffers for use with an accumulate operation.
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "an", "accumulate", "operation", "." ]
[ "// Check if the source buffer is within a shared region.", "// Lock if needed so we can directly access the buffer", "// If the buffer wasn't copied, we should copy it into a private buffer" ]
[ { "param": "orig_bufs", "type": "void" }, { "param": "new_bufs_ptr", "type": "void" }, { "param": "count", "type": "int" }, { "param": "size", "type": "int" }, { "param": "datatype", "type": "int" }, { "param": "scale", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "orig_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_bufs_ptr", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "datatype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scale", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_finish_accv
void
void ARMCII_Buf_finish_accv(void **orig_bufs, void **new_bufs, int count, int size) { int i; for (i = 0; i < count; i++) { if (orig_bufs[i] != new_bufs[i]) { MPI_Free_mem(new_bufs[i]); } } free(new_bufs); }
/** Finish a set of prepared buffers. Will perform communication and copies as * needed to ensure results are in the original buffers. Temporary space will be * freed. * * @param[in] orig_bufs Original set of buffers. * @param[out] new_bufs Set of private buffers. * @param[in] count Number of entries in the buffer list. * @param[in] size The size of the buffers (all are of the same size). */
Finish a set of prepared buffers. Will perform communication and copies as needed to ensure results are in the original buffers. Temporary space will be freed. @param[in] orig_bufs Original set of buffers. @param[out] new_bufs Set of private buffers. @param[in] count Number of entries in the buffer list. @param[in] size The size of the buffers (all are of the same size).
[ "Finish", "a", "set", "of", "prepared", "buffers", ".", "Will", "perform", "communication", "and", "copies", "as", "needed", "to", "ensure", "results", "are", "in", "the", "original", "buffers", ".", "Temporary", "space", "will", "be", "freed", ".", "@param", "[", "in", "]", "orig_bufs", "Original", "set", "of", "buffers", ".", "@param", "[", "out", "]", "new_bufs", "Set", "of", "private", "buffers", ".", "@param", "[", "in", "]", "count", "Number", "of", "entries", "in", "the", "buffer", "list", ".", "@param", "[", "in", "]", "size", "The", "size", "of", "the", "buffers", "(", "all", "are", "of", "the", "same", "size", ")", "." ]
void ARMCII_Buf_finish_accv(void **orig_bufs, void **new_bufs, int count, int size) { int i; for (i = 0; i < count; i++) { if (orig_bufs[i] != new_bufs[i]) { MPI_Free_mem(new_bufs[i]); } } free(new_bufs); }
[ "void", "ARMCII_Buf_finish_accv", "(", "void", "*", "*", "orig_bufs", ",", "void", "*", "*", "new_bufs", ",", "int", "count", ",", "int", "size", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "if", "(", "orig_bufs", "[", "i", "]", "!=", "new_bufs", "[", "i", "]", ")", "{", "MPI_Free_mem", "(", "new_bufs", "[", "i", "]", ")", ";", "}", "}", "free", "(", "new_bufs", ")", ";", "}" ]
Finish a set of prepared buffers.
[ "Finish", "a", "set", "of", "prepared", "buffers", "." ]
[]
[ { "param": "orig_bufs", "type": "void" }, { "param": "new_bufs", "type": "void" }, { "param": "count", "type": "int" }, { "param": "size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "orig_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_prepare_getv
int
int ARMCII_Buf_prepare_getv(void **orig_bufs, void ***new_bufs_ptr, int count, int size) { int num_moved = 0; if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { void **new_bufs = malloc(count*sizeof(void*)); int i; for (i = 0; i < count; i++) new_bufs[i] = NULL; for (i = 0; i < count; i++) { // Check if the destination buffer is within a shared region. If not, create // a temporary private buffer to hold the result. gmr_t *mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); if (mreg != NULL) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); num_moved++; } else { new_bufs[i] = orig_bufs[i]; } } *new_bufs_ptr = new_bufs; } else { *new_bufs_ptr = orig_bufs; } return num_moved; }
/** Prepare a set of buffers for use with a get operation. The returned set of * buffers is guaranteed to be in private space. Copies will be made if needed, * the result should be completed by finish. * * @param[in] orig_bufs Original set of buffers. * @param[out] new_bufs Pointer to the set of private buffers. * @param[in] count Number of entries in the buffer list. * @param[in] size The size of the buffers (all are of the same size). * @return Number of buffers that were moved. */
Prepare a set of buffers for use with a get operation. The returned set of buffers is guaranteed to be in private space. Copies will be made if needed, the result should be completed by finish. @param[in] orig_bufs Original set of buffers. @param[out] new_bufs Pointer to the set of private buffers. @param[in] count Number of entries in the buffer list. @param[in] size The size of the buffers (all are of the same size). @return Number of buffers that were moved.
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "a", "get", "operation", ".", "The", "returned", "set", "of", "buffers", "is", "guaranteed", "to", "be", "in", "private", "space", ".", "Copies", "will", "be", "made", "if", "needed", "the", "result", "should", "be", "completed", "by", "finish", ".", "@param", "[", "in", "]", "orig_bufs", "Original", "set", "of", "buffers", ".", "@param", "[", "out", "]", "new_bufs", "Pointer", "to", "the", "set", "of", "private", "buffers", ".", "@param", "[", "in", "]", "count", "Number", "of", "entries", "in", "the", "buffer", "list", ".", "@param", "[", "in", "]", "size", "The", "size", "of", "the", "buffers", "(", "all", "are", "of", "the", "same", "size", ")", ".", "@return", "Number", "of", "buffers", "that", "were", "moved", "." ]
int ARMCII_Buf_prepare_getv(void **orig_bufs, void ***new_bufs_ptr, int count, int size) { int num_moved = 0; if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { void **new_bufs = malloc(count*sizeof(void*)); int i; for (i = 0; i < count; i++) new_bufs[i] = NULL; for (i = 0; i < count; i++) { gmr_t *mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); if (mreg != NULL) { MPI_Alloc_mem(size, MPI_INFO_NULL, &new_bufs[i]); ARMCII_Assert(new_bufs[i] != NULL); num_moved++; } else { new_bufs[i] = orig_bufs[i]; } } *new_bufs_ptr = new_bufs; } else { *new_bufs_ptr = orig_bufs; } return num_moved; }
[ "int", "ARMCII_Buf_prepare_getv", "(", "void", "*", "*", "orig_bufs", ",", "void", "*", "*", "*", "new_bufs_ptr", ",", "int", "count", ",", "int", "size", ")", "{", "int", "num_moved", "=", "0", ";", "if", "(", "ARMCII_GLOBAL_STATE", ".", "shr_buf_method", "!=", "ARMCII_SHR_BUF_NOGUARD", ")", "{", "void", "*", "*", "new_bufs", "=", "malloc", "(", "count", "*", "sizeof", "(", "void", "*", ")", ")", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "new_bufs", "[", "i", "]", "=", "NULL", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "gmr_t", "*", "mreg", "=", "gmr_lookup", "(", "orig_bufs", "[", "i", "]", ",", "ARMCI_GROUP_WORLD", ".", "rank", ")", ";", "if", "(", "mreg", "!=", "NULL", ")", "{", "MPI_Alloc_mem", "(", "size", ",", "MPI_INFO_NULL", ",", "&", "new_bufs", "[", "i", "]", ")", ";", "ARMCII_Assert", "(", "new_bufs", "[", "i", "]", "!=", "NULL", ")", ";", "num_moved", "++", ";", "}", "else", "{", "new_bufs", "[", "i", "]", "=", "orig_bufs", "[", "i", "]", ";", "}", "}", "*", "new_bufs_ptr", "=", "new_bufs", ";", "}", "else", "{", "*", "new_bufs_ptr", "=", "orig_bufs", ";", "}", "return", "num_moved", ";", "}" ]
Prepare a set of buffers for use with a get operation.
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "a", "get", "operation", "." ]
[ "// Check if the destination buffer is within a shared region. If not, create", "// a temporary private buffer to hold the result." ]
[ { "param": "orig_bufs", "type": "void" }, { "param": "new_bufs_ptr", "type": "void" }, { "param": "count", "type": "int" }, { "param": "size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "orig_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_bufs_ptr", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_finish_getv
void
void ARMCII_Buf_finish_getv(void **orig_bufs, void **new_bufs, int count, int size) { if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { int i; for (i = 0; i < count; i++) { if (orig_bufs[i] != new_bufs[i]) { gmr_t *mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); ARMCII_Assert(mreg != NULL); gmr_dla_lock(mreg); ARMCI_Copy(new_bufs[i], orig_bufs[i], size); // gmr_put(mreg, new_bufs[i], orig_bufs[i], size, ARMCI_GROUP_WORLD.rank); gmr_dla_unlock(mreg); MPI_Free_mem(new_bufs[i]); } } } }
/** Finish a set of prepared buffers. Will perform communication and copies as * needed to ensure results are in the original buffers. Temporary space will be * freed. * * @param[in] orig_bufs Original set of buffers. * @param[out] new_bufs Set of private buffers. * @param[in] count Number of entries in the buffer list. * @param[in] size The size of the buffers (all are of the same size). */
Finish a set of prepared buffers. Will perform communication and copies as needed to ensure results are in the original buffers. Temporary space will be freed. @param[in] orig_bufs Original set of buffers. @param[out] new_bufs Set of private buffers. @param[in] count Number of entries in the buffer list. @param[in] size The size of the buffers (all are of the same size).
[ "Finish", "a", "set", "of", "prepared", "buffers", ".", "Will", "perform", "communication", "and", "copies", "as", "needed", "to", "ensure", "results", "are", "in", "the", "original", "buffers", ".", "Temporary", "space", "will", "be", "freed", ".", "@param", "[", "in", "]", "orig_bufs", "Original", "set", "of", "buffers", ".", "@param", "[", "out", "]", "new_bufs", "Set", "of", "private", "buffers", ".", "@param", "[", "in", "]", "count", "Number", "of", "entries", "in", "the", "buffer", "list", ".", "@param", "[", "in", "]", "size", "The", "size", "of", "the", "buffers", "(", "all", "are", "of", "the", "same", "size", ")", "." ]
void ARMCII_Buf_finish_getv(void **orig_bufs, void **new_bufs, int count, int size) { if (ARMCII_GLOBAL_STATE.shr_buf_method != ARMCII_SHR_BUF_NOGUARD) { int i; for (i = 0; i < count; i++) { if (orig_bufs[i] != new_bufs[i]) { gmr_t *mreg = gmr_lookup(orig_bufs[i], ARMCI_GROUP_WORLD.rank); ARMCII_Assert(mreg != NULL); gmr_dla_lock(mreg); ARMCI_Copy(new_bufs[i], orig_bufs[i], size); gmr_dla_unlock(mreg); MPI_Free_mem(new_bufs[i]); } } } }
[ "void", "ARMCII_Buf_finish_getv", "(", "void", "*", "*", "orig_bufs", ",", "void", "*", "*", "new_bufs", ",", "int", "count", ",", "int", "size", ")", "{", "if", "(", "ARMCII_GLOBAL_STATE", ".", "shr_buf_method", "!=", "ARMCII_SHR_BUF_NOGUARD", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "if", "(", "orig_bufs", "[", "i", "]", "!=", "new_bufs", "[", "i", "]", ")", "{", "gmr_t", "*", "mreg", "=", "gmr_lookup", "(", "orig_bufs", "[", "i", "]", ",", "ARMCI_GROUP_WORLD", ".", "rank", ")", ";", "ARMCII_Assert", "(", "mreg", "!=", "NULL", ")", ";", "gmr_dla_lock", "(", "mreg", ")", ";", "ARMCI_Copy", "(", "new_bufs", "[", "i", "]", ",", "orig_bufs", "[", "i", "]", ",", "size", ")", ";", "gmr_dla_unlock", "(", "mreg", ")", ";", "MPI_Free_mem", "(", "new_bufs", "[", "i", "]", ")", ";", "}", "}", "}", "}" ]
Finish a set of prepared buffers.
[ "Finish", "a", "set", "of", "prepared", "buffers", "." ]
[ "// gmr_put(mreg, new_bufs[i], orig_bufs[i], size, ARMCI_GROUP_WORLD.rank);" ]
[ { "param": "orig_bufs", "type": "void" }, { "param": "new_bufs", "type": "void" }, { "param": "count", "type": "int" }, { "param": "size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "orig_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_bufs", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_acc_is_scaled
int
int ARMCII_Buf_acc_is_scaled(int datatype, void *scale) { switch (datatype) { case ARMCI_ACC_INT: if (*((int*)scale) == 1) return 0; break; case ARMCI_ACC_LNG: if (*((long*)scale) == 1) return 0; break; case ARMCI_ACC_FLT: if (*((float*)scale) == 1.0) return 0; break; case ARMCI_ACC_DBL: if (*((double*)scale) == 1.0) return 0; break; case ARMCI_ACC_CPL: if (((float*)scale)[0] == 1.0 && ((float*)scale)[1] == 0.0) return 0; break; case ARMCI_ACC_DCP: if (((double*)scale)[0] == 1.0 && ((double*)scale)[1] == 0.0) return 0; break; default: ARMCII_Error("unknown data type (%d)", datatype); } return 1; }
/** Check if an operation with the given parameters requires scaling. * * @param[in] datatype Type of the data involved in the operation * @param[in] scale Value of type datatype to scale * @return Nonzero if scale is not the identity scale */
Check if an operation with the given parameters requires scaling. @param[in] datatype Type of the data involved in the operation @param[in] scale Value of type datatype to scale @return Nonzero if scale is not the identity scale
[ "Check", "if", "an", "operation", "with", "the", "given", "parameters", "requires", "scaling", ".", "@param", "[", "in", "]", "datatype", "Type", "of", "the", "data", "involved", "in", "the", "operation", "@param", "[", "in", "]", "scale", "Value", "of", "type", "datatype", "to", "scale", "@return", "Nonzero", "if", "scale", "is", "not", "the", "identity", "scale" ]
int ARMCII_Buf_acc_is_scaled(int datatype, void *scale) { switch (datatype) { case ARMCI_ACC_INT: if (*((int*)scale) == 1) return 0; break; case ARMCI_ACC_LNG: if (*((long*)scale) == 1) return 0; break; case ARMCI_ACC_FLT: if (*((float*)scale) == 1.0) return 0; break; case ARMCI_ACC_DBL: if (*((double*)scale) == 1.0) return 0; break; case ARMCI_ACC_CPL: if (((float*)scale)[0] == 1.0 && ((float*)scale)[1] == 0.0) return 0; break; case ARMCI_ACC_DCP: if (((double*)scale)[0] == 1.0 && ((double*)scale)[1] == 0.0) return 0; break; default: ARMCII_Error("unknown data type (%d)", datatype); } return 1; }
[ "int", "ARMCII_Buf_acc_is_scaled", "(", "int", "datatype", ",", "void", "*", "scale", ")", "{", "switch", "(", "datatype", ")", "{", "case", "ARMCI_ACC_INT", ":", "if", "(", "*", "(", "(", "int", "*", ")", "scale", ")", "==", "1", ")", "return", "0", ";", "break", ";", "case", "ARMCI_ACC_LNG", ":", "if", "(", "*", "(", "(", "long", "*", ")", "scale", ")", "==", "1", ")", "return", "0", ";", "break", ";", "case", "ARMCI_ACC_FLT", ":", "if", "(", "*", "(", "(", "float", "*", ")", "scale", ")", "==", "1.0", ")", "return", "0", ";", "break", ";", "case", "ARMCI_ACC_DBL", ":", "if", "(", "*", "(", "(", "double", "*", ")", "scale", ")", "==", "1.0", ")", "return", "0", ";", "break", ";", "case", "ARMCI_ACC_CPL", ":", "if", "(", "(", "(", "float", "*", ")", "scale", ")", "[", "0", "]", "==", "1.0", "&&", "(", "(", "float", "*", ")", "scale", ")", "[", "1", "]", "==", "0.0", ")", "return", "0", ";", "break", ";", "case", "ARMCI_ACC_DCP", ":", "if", "(", "(", "(", "double", "*", ")", "scale", ")", "[", "0", "]", "==", "1.0", "&&", "(", "(", "double", "*", ")", "scale", ")", "[", "1", "]", "==", "0.0", ")", "return", "0", ";", "break", ";", "default", ":", "ARMCII_Error", "(", "\"", "\"", ",", "datatype", ")", ";", "}", "return", "1", ";", "}" ]
Check if an operation with the given parameters requires scaling.
[ "Check", "if", "an", "operation", "with", "the", "given", "parameters", "requires", "scaling", "." ]
[]
[ { "param": "datatype", "type": "int" }, { "param": "scale", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "datatype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scale", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33a2a721ef5b9f7dc944f9bb68812b7154dd4b7c
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Buf_acc_scale
void
void ARMCII_Buf_acc_scale(void *buf_in, void *buf_out, int size, int datatype, void *scale) { int j, nelem; int type_size; MPI_Datatype type; switch (datatype) { case ARMCI_ACC_INT: MPI_Type_size(MPI_INT, &type_size); type = MPI_INT; nelem= size/type_size; { int *src_i = (int*) buf_in; int *scl_i = (int*) buf_out; const int s = *((int*) scale); for (j = 0; j < nelem; j++) scl_i[j] = src_i[j]*s; } break; case ARMCI_ACC_LNG: MPI_Type_size(MPI_LONG, &type_size); type = MPI_LONG; nelem= size/type_size; { long *src_l = (long*) buf_in; long *scl_l = (long*) buf_out; const long s = *((long*) scale); for (j = 0; j < nelem; j++) scl_l[j] = src_l[j]*s; } break; case ARMCI_ACC_FLT: MPI_Type_size(MPI_FLOAT, &type_size); type = MPI_FLOAT; nelem= size/type_size; { float *src_f = (float*) buf_in; float *scl_f = (float*) buf_out; const float s = *((float*) scale); for (j = 0; j < nelem; j++) scl_f[j] = src_f[j]*s; } break; case ARMCI_ACC_DBL: MPI_Type_size(MPI_DOUBLE, &type_size); type = MPI_DOUBLE; nelem= size/type_size; { double *src_d = (double*) buf_in; double *scl_d = (double*) buf_out; const double s = *((double*) scale); for (j = 0; j < nelem; j++) scl_d[j] = src_d[j]*s; } break; case ARMCI_ACC_CPL: MPI_Type_size(MPI_FLOAT, &type_size); type = MPI_FLOAT; nelem= size/type_size; { float *src_fc = (float*) buf_in; float *scl_fc = (float*) buf_out; const float s_r = ((float*)scale)[0]; const float s_c = ((float*)scale)[1]; for (j = 0; j < nelem; j += 2) { // Complex multiplication: (a + bi)*(c + di) const float src_fc_j = src_fc[j]; const float src_fc_j_1 = src_fc[j+1]; /* scl_fc[j] = src_fc[j]*s_r - src_fc[j+1]*s_c; scl_fc[j+1] = src_fc[j+1]*s_r + src_fc[j]*s_c; */ scl_fc[j] = src_fc_j*s_r - src_fc_j_1*s_c; scl_fc[j+1] = src_fc_j_1*s_r + src_fc_j*s_c; } } break; case ARMCI_ACC_DCP: MPI_Type_size(MPI_DOUBLE, &type_size); type = MPI_DOUBLE; nelem= size/type_size; { double *src_dc = (double*) buf_in; double *scl_dc = (double*) buf_out; const double s_r = ((double*)scale)[0]; const double s_c = ((double*)scale)[1]; for (j = 0; j < nelem; j += 2) { // Complex multiplication: (a + bi)*(c + di) const double src_dc_j = src_dc[j]; const double src_dc_j_1 = src_dc[j+1]; /* scl_dc[j] = src_dc[j]*s_r - src_dc[j+1]*s_c; scl_dc[j+1] = src_dc[j+1]*s_r + src_dc[j]*s_c; */ scl_dc[j] = src_dc_j*s_r - src_dc_j_1*s_c; scl_dc[j+1] = src_dc_j_1*s_r + src_dc_j*s_c; } } break; default: ARMCII_Error("unknown data type (%d)", datatype); } ARMCII_Assert_msg(size % type_size == 0, "Transfer size is not a multiple of the datatype size"); }
/** Prepare a set of buffers for use with an accumulate operation. The * returned set of buffers is guaranteed to be in private space and scaled. * Copies will be made if needed, the result should be completed by finish. * * @param[in] buf Original set of buffers. * @param[in] count Number of entries in the buffer list. * @param[in] size The size of the buffers (all are of the same size). * @param[in] datatype The type of the buffer. * @param[in] scale Scaling constant to apply to each buffer. * @return Pointer to the new buffer or buf */
Prepare a set of buffers for use with an accumulate operation. The returned set of buffers is guaranteed to be in private space and scaled. Copies will be made if needed, the result should be completed by finish. @param[in] buf Original set of buffers. @param[in] count Number of entries in the buffer list. @param[in] size The size of the buffers (all are of the same size). @param[in] datatype The type of the buffer. @param[in] scale Scaling constant to apply to each buffer. @return Pointer to the new buffer or buf
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "an", "accumulate", "operation", ".", "The", "returned", "set", "of", "buffers", "is", "guaranteed", "to", "be", "in", "private", "space", "and", "scaled", ".", "Copies", "will", "be", "made", "if", "needed", "the", "result", "should", "be", "completed", "by", "finish", ".", "@param", "[", "in", "]", "buf", "Original", "set", "of", "buffers", ".", "@param", "[", "in", "]", "count", "Number", "of", "entries", "in", "the", "buffer", "list", ".", "@param", "[", "in", "]", "size", "The", "size", "of", "the", "buffers", "(", "all", "are", "of", "the", "same", "size", ")", ".", "@param", "[", "in", "]", "datatype", "The", "type", "of", "the", "buffer", ".", "@param", "[", "in", "]", "scale", "Scaling", "constant", "to", "apply", "to", "each", "buffer", ".", "@return", "Pointer", "to", "the", "new", "buffer", "or", "buf" ]
void ARMCII_Buf_acc_scale(void *buf_in, void *buf_out, int size, int datatype, void *scale) { int j, nelem; int type_size; MPI_Datatype type; switch (datatype) { case ARMCI_ACC_INT: MPI_Type_size(MPI_INT, &type_size); type = MPI_INT; nelem= size/type_size; { int *src_i = (int*) buf_in; int *scl_i = (int*) buf_out; const int s = *((int*) scale); for (j = 0; j < nelem; j++) scl_i[j] = src_i[j]*s; } break; case ARMCI_ACC_LNG: MPI_Type_size(MPI_LONG, &type_size); type = MPI_LONG; nelem= size/type_size; { long *src_l = (long*) buf_in; long *scl_l = (long*) buf_out; const long s = *((long*) scale); for (j = 0; j < nelem; j++) scl_l[j] = src_l[j]*s; } break; case ARMCI_ACC_FLT: MPI_Type_size(MPI_FLOAT, &type_size); type = MPI_FLOAT; nelem= size/type_size; { float *src_f = (float*) buf_in; float *scl_f = (float*) buf_out; const float s = *((float*) scale); for (j = 0; j < nelem; j++) scl_f[j] = src_f[j]*s; } break; case ARMCI_ACC_DBL: MPI_Type_size(MPI_DOUBLE, &type_size); type = MPI_DOUBLE; nelem= size/type_size; { double *src_d = (double*) buf_in; double *scl_d = (double*) buf_out; const double s = *((double*) scale); for (j = 0; j < nelem; j++) scl_d[j] = src_d[j]*s; } break; case ARMCI_ACC_CPL: MPI_Type_size(MPI_FLOAT, &type_size); type = MPI_FLOAT; nelem= size/type_size; { float *src_fc = (float*) buf_in; float *scl_fc = (float*) buf_out; const float s_r = ((float*)scale)[0]; const float s_c = ((float*)scale)[1]; for (j = 0; j < nelem; j += 2) { const float src_fc_j = src_fc[j]; const float src_fc_j_1 = src_fc[j+1]; scl_fc[j] = src_fc_j*s_r - src_fc_j_1*s_c; scl_fc[j+1] = src_fc_j_1*s_r + src_fc_j*s_c; } } break; case ARMCI_ACC_DCP: MPI_Type_size(MPI_DOUBLE, &type_size); type = MPI_DOUBLE; nelem= size/type_size; { double *src_dc = (double*) buf_in; double *scl_dc = (double*) buf_out; const double s_r = ((double*)scale)[0]; const double s_c = ((double*)scale)[1]; for (j = 0; j < nelem; j += 2) { const double src_dc_j = src_dc[j]; const double src_dc_j_1 = src_dc[j+1]; scl_dc[j] = src_dc_j*s_r - src_dc_j_1*s_c; scl_dc[j+1] = src_dc_j_1*s_r + src_dc_j*s_c; } } break; default: ARMCII_Error("unknown data type (%d)", datatype); } ARMCII_Assert_msg(size % type_size == 0, "Transfer size is not a multiple of the datatype size"); }
[ "void", "ARMCII_Buf_acc_scale", "(", "void", "*", "buf_in", ",", "void", "*", "buf_out", ",", "int", "size", ",", "int", "datatype", ",", "void", "*", "scale", ")", "{", "int", "j", ",", "nelem", ";", "int", "type_size", ";", "MPI_Datatype", "type", ";", "switch", "(", "datatype", ")", "{", "case", "ARMCI_ACC_INT", ":", "MPI_Type_size", "(", "MPI_INT", ",", "&", "type_size", ")", ";", "type", "=", "MPI_INT", ";", "nelem", "=", "size", "/", "type_size", ";", "{", "int", "*", "src_i", "=", "(", "int", "*", ")", "buf_in", ";", "int", "*", "scl_i", "=", "(", "int", "*", ")", "buf_out", ";", "const", "int", "s", "=", "*", "(", "(", "int", "*", ")", "scale", ")", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nelem", ";", "j", "++", ")", "scl_i", "[", "j", "]", "=", "src_i", "[", "j", "]", "*", "s", ";", "}", "break", ";", "case", "ARMCI_ACC_LNG", ":", "MPI_Type_size", "(", "MPI_LONG", ",", "&", "type_size", ")", ";", "type", "=", "MPI_LONG", ";", "nelem", "=", "size", "/", "type_size", ";", "{", "long", "*", "src_l", "=", "(", "long", "*", ")", "buf_in", ";", "long", "*", "scl_l", "=", "(", "long", "*", ")", "buf_out", ";", "const", "long", "s", "=", "*", "(", "(", "long", "*", ")", "scale", ")", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nelem", ";", "j", "++", ")", "scl_l", "[", "j", "]", "=", "src_l", "[", "j", "]", "*", "s", ";", "}", "break", ";", "case", "ARMCI_ACC_FLT", ":", "MPI_Type_size", "(", "MPI_FLOAT", ",", "&", "type_size", ")", ";", "type", "=", "MPI_FLOAT", ";", "nelem", "=", "size", "/", "type_size", ";", "{", "float", "*", "src_f", "=", "(", "float", "*", ")", "buf_in", ";", "float", "*", "scl_f", "=", "(", "float", "*", ")", "buf_out", ";", "const", "float", "s", "=", "*", "(", "(", "float", "*", ")", "scale", ")", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nelem", ";", "j", "++", ")", "scl_f", "[", "j", "]", "=", "src_f", "[", "j", "]", "*", "s", ";", "}", "break", ";", "case", "ARMCI_ACC_DBL", ":", "MPI_Type_size", "(", "MPI_DOUBLE", ",", "&", "type_size", ")", ";", "type", "=", "MPI_DOUBLE", ";", "nelem", "=", "size", "/", "type_size", ";", "{", "double", "*", "src_d", "=", "(", "double", "*", ")", "buf_in", ";", "double", "*", "scl_d", "=", "(", "double", "*", ")", "buf_out", ";", "const", "double", "s", "=", "*", "(", "(", "double", "*", ")", "scale", ")", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nelem", ";", "j", "++", ")", "scl_d", "[", "j", "]", "=", "src_d", "[", "j", "]", "*", "s", ";", "}", "break", ";", "case", "ARMCI_ACC_CPL", ":", "MPI_Type_size", "(", "MPI_FLOAT", ",", "&", "type_size", ")", ";", "type", "=", "MPI_FLOAT", ";", "nelem", "=", "size", "/", "type_size", ";", "{", "float", "*", "src_fc", "=", "(", "float", "*", ")", "buf_in", ";", "float", "*", "scl_fc", "=", "(", "float", "*", ")", "buf_out", ";", "const", "float", "s_r", "=", "(", "(", "float", "*", ")", "scale", ")", "[", "0", "]", ";", "const", "float", "s_c", "=", "(", "(", "float", "*", ")", "scale", ")", "[", "1", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nelem", ";", "j", "+=", "2", ")", "{", "const", "float", "src_fc_j", "=", "src_fc", "[", "j", "]", ";", "const", "float", "src_fc_j_1", "=", "src_fc", "[", "j", "+", "1", "]", ";", "scl_fc", "[", "j", "]", "=", "src_fc_j", "*", "s_r", "-", "src_fc_j_1", "*", "s_c", ";", "scl_fc", "[", "j", "+", "1", "]", "=", "src_fc_j_1", "*", "s_r", "+", "src_fc_j", "*", "s_c", ";", "}", "}", "break", ";", "case", "ARMCI_ACC_DCP", ":", "MPI_Type_size", "(", "MPI_DOUBLE", ",", "&", "type_size", ")", ";", "type", "=", "MPI_DOUBLE", ";", "nelem", "=", "size", "/", "type_size", ";", "{", "double", "*", "src_dc", "=", "(", "double", "*", ")", "buf_in", ";", "double", "*", "scl_dc", "=", "(", "double", "*", ")", "buf_out", ";", "const", "double", "s_r", "=", "(", "(", "double", "*", ")", "scale", ")", "[", "0", "]", ";", "const", "double", "s_c", "=", "(", "(", "double", "*", ")", "scale", ")", "[", "1", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nelem", ";", "j", "+=", "2", ")", "{", "const", "double", "src_dc_j", "=", "src_dc", "[", "j", "]", ";", "const", "double", "src_dc_j_1", "=", "src_dc", "[", "j", "+", "1", "]", ";", "scl_dc", "[", "j", "]", "=", "src_dc_j", "*", "s_r", "-", "src_dc_j_1", "*", "s_c", ";", "scl_dc", "[", "j", "+", "1", "]", "=", "src_dc_j_1", "*", "s_r", "+", "src_dc_j", "*", "s_c", ";", "}", "}", "break", ";", "default", ":", "ARMCII_Error", "(", "\"", "\"", ",", "datatype", ")", ";", "}", "ARMCII_Assert_msg", "(", "size", "%", "type_size", "==", "0", ",", "\"", "\"", ")", ";", "}" ]
Prepare a set of buffers for use with an accumulate operation.
[ "Prepare", "a", "set", "of", "buffers", "for", "use", "with", "an", "accumulate", "operation", "." ]
[ "// Complex multiplication: (a + bi)*(c + di)", "/*\n scl_fc[j] = src_fc[j]*s_r - src_fc[j+1]*s_c;\n scl_fc[j+1] = src_fc[j+1]*s_r + src_fc[j]*s_c;\n */", "// Complex multiplication: (a + bi)*(c + di)", "/*\n scl_dc[j] = src_dc[j]*s_r - src_dc[j+1]*s_c;\n scl_dc[j+1] = src_dc[j+1]*s_r + src_dc[j]*s_c;\n */" ]
[ { "param": "buf_in", "type": "void" }, { "param": "buf_out", "type": "void" }, { "param": "size", "type": "int" }, { "param": "datatype", "type": "int" }, { "param": "scale", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf_in", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "buf_out", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "datatype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scale", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
249f0a5f0367b2cdb9b92f759c9055d5b2903749
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpi/topo/topoutil.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIR_Topology_get
MPIR_Topology
MPIR_Topology *MPIR_Topology_get( MPID_Comm *comm_ptr ) { int mpi_errno = MPI_SUCCESS; MPIR_Topology *topo_ptr; int flag; if (MPIR_Topology_keyval == MPI_KEYVAL_INVALID) { return 0; } mpi_errno = MPIR_CommGetAttr(comm_ptr->handle, MPIR_Topology_keyval, &topo_ptr, &flag, MPIR_ATTR_PTR ); if (mpi_errno) return NULL; if (flag) return topo_ptr; return NULL; }
/* Return a poiner to the topology structure on a communicator. Returns null if no topology structure is defined */
Return a poiner to the topology structure on a communicator. Returns null if no topology structure is defined
[ "Return", "a", "poiner", "to", "the", "topology", "structure", "on", "a", "communicator", ".", "Returns", "null", "if", "no", "topology", "structure", "is", "defined" ]
MPIR_Topology *MPIR_Topology_get( MPID_Comm *comm_ptr ) { int mpi_errno = MPI_SUCCESS; MPIR_Topology *topo_ptr; int flag; if (MPIR_Topology_keyval == MPI_KEYVAL_INVALID) { return 0; } mpi_errno = MPIR_CommGetAttr(comm_ptr->handle, MPIR_Topology_keyval, &topo_ptr, &flag, MPIR_ATTR_PTR ); if (mpi_errno) return NULL; if (flag) return topo_ptr; return NULL; }
[ "MPIR_Topology", "*", "MPIR_Topology_get", "(", "MPID_Comm", "*", "comm_ptr", ")", "{", "int", "mpi_errno", "=", "MPI_SUCCESS", ";", "MPIR_Topology", "*", "topo_ptr", ";", "int", "flag", ";", "if", "(", "MPIR_Topology_keyval", "==", "MPI_KEYVAL_INVALID", ")", "{", "return", "0", ";", "}", "mpi_errno", "=", "MPIR_CommGetAttr", "(", "comm_ptr", "->", "handle", ",", "MPIR_Topology_keyval", ",", "&", "topo_ptr", ",", "&", "flag", ",", "MPIR_ATTR_PTR", ")", ";", "if", "(", "mpi_errno", ")", "return", "NULL", ";", "if", "(", "flag", ")", "return", "topo_ptr", ";", "return", "NULL", ";", "}" ]
Return a poiner to the topology structure on a communicator.
[ "Return", "a", "poiner", "to", "the", "topology", "structure", "on", "a", "communicator", "." ]
[]
[ { "param": "comm_ptr", "type": "MPID_Comm" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "comm_ptr", "type": "MPID_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
339f7fc29ab0151e8561fb112310e33fa59020d6
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/ch3/src/mpid_cancel_send.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDI_CH3_PktHandler_CancelSendReq
int
int MPIDI_CH3_PktHandler_CancelSendReq( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t *buflen, MPID_Request **rreqp ) { MPIDI_CH3_Pkt_cancel_send_req_t * req_pkt = &pkt->cancel_send_req; MPID_Request * rreq; int ack; MPIDI_CH3_Pkt_t upkt; MPIDI_CH3_Pkt_cancel_send_resp_t * resp_pkt = &upkt.cancel_send_resp; MPID_Request * resp_sreq; int mpi_errno = MPI_SUCCESS; MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST, "received cancel send req pkt, sreq=0x%08x, rank=%d, tag=%d, context=%d", req_pkt->sender_req_id, req_pkt->match.parts.rank, req_pkt->match.parts.tag, req_pkt->match.parts.context_id)); *buflen = sizeof(MPIDI_CH3_Pkt_t); /* FIXME: Note that this routine is called from within the packet handler. If the message queue mutex is different from the progress mutex, this must be protected within a message-queue mutex */ rreq = MPIDI_CH3U_Recvq_FDU(req_pkt->sender_req_id, &req_pkt->match); if (rreq != NULL) { MPIU_DBG_MSG(CH3_OTHER,TYPICAL,"message cancelled"); if (MPIDI_Request_get_msg_type(rreq) == MPIDI_REQUEST_EAGER_MSG && rreq->dev.recv_data_sz > 0) { MPIU_Free(rreq->dev.tmpbuf); } MPID_Request_release(rreq); ack = TRUE; } else { MPIU_DBG_MSG(CH3_OTHER,TYPICAL,"unable to cancel message"); ack = FALSE; } MPIDI_Pkt_init(resp_pkt, MPIDI_CH3_PKT_CANCEL_SEND_RESP); resp_pkt->sender_req_id = req_pkt->sender_req_id; resp_pkt->ack = ack; /* FIXME: This is called within the packet handler */ /* MPIU_THREAD_CS_ENTER(CH3COMM,vc); */ mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsg(vc, resp_pkt, sizeof(*resp_pkt), &resp_sreq)); /* MPIU_THREAD_CS_EXIT(CH3COMM,vc); */ if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER, "**ch3|cancelresp"); } if (resp_sreq != NULL) { MPID_Request_release(resp_sreq); } *rreqp = NULL; fn_fail: return mpi_errno; }
/* * Handler routines called when cancel send packets arrive */
Handler routines called when cancel send packets arrive
[ "Handler", "routines", "called", "when", "cancel", "send", "packets", "arrive" ]
int MPIDI_CH3_PktHandler_CancelSendReq( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t *buflen, MPID_Request **rreqp ) { MPIDI_CH3_Pkt_cancel_send_req_t * req_pkt = &pkt->cancel_send_req; MPID_Request * rreq; int ack; MPIDI_CH3_Pkt_t upkt; MPIDI_CH3_Pkt_cancel_send_resp_t * resp_pkt = &upkt.cancel_send_resp; MPID_Request * resp_sreq; int mpi_errno = MPI_SUCCESS; MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST, "received cancel send req pkt, sreq=0x%08x, rank=%d, tag=%d, context=%d", req_pkt->sender_req_id, req_pkt->match.parts.rank, req_pkt->match.parts.tag, req_pkt->match.parts.context_id)); *buflen = sizeof(MPIDI_CH3_Pkt_t); rreq = MPIDI_CH3U_Recvq_FDU(req_pkt->sender_req_id, &req_pkt->match); if (rreq != NULL) { MPIU_DBG_MSG(CH3_OTHER,TYPICAL,"message cancelled"); if (MPIDI_Request_get_msg_type(rreq) == MPIDI_REQUEST_EAGER_MSG && rreq->dev.recv_data_sz > 0) { MPIU_Free(rreq->dev.tmpbuf); } MPID_Request_release(rreq); ack = TRUE; } else { MPIU_DBG_MSG(CH3_OTHER,TYPICAL,"unable to cancel message"); ack = FALSE; } MPIDI_Pkt_init(resp_pkt, MPIDI_CH3_PKT_CANCEL_SEND_RESP); resp_pkt->sender_req_id = req_pkt->sender_req_id; resp_pkt->ack = ack; mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsg(vc, resp_pkt, sizeof(*resp_pkt), &resp_sreq)); if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER, "**ch3|cancelresp"); } if (resp_sreq != NULL) { MPID_Request_release(resp_sreq); } *rreqp = NULL; fn_fail: return mpi_errno; }
[ "int", "MPIDI_CH3_PktHandler_CancelSendReq", "(", "MPIDI_VC_t", "*", "vc", ",", "MPIDI_CH3_Pkt_t", "*", "pkt", ",", "MPIDI_msg_sz_t", "*", "buflen", ",", "MPID_Request", "*", "*", "rreqp", ")", "{", "MPIDI_CH3_Pkt_cancel_send_req_t", "*", "req_pkt", "=", "&", "pkt", "->", "cancel_send_req", ";", "MPID_Request", "*", "rreq", ";", "int", "ack", ";", "MPIDI_CH3_Pkt_t", "upkt", ";", "MPIDI_CH3_Pkt_cancel_send_resp_t", "*", "resp_pkt", "=", "&", "upkt", ".", "cancel_send_resp", ";", "MPID_Request", "*", "resp_sreq", ";", "int", "mpi_errno", "=", "MPI_SUCCESS", ";", "MPIU_DBG_MSG_FMT", "(", "CH3_OTHER", ",", "VERBOSE", ",", "(", "MPIU_DBG_FDEST", ",", "\"", "\"", ",", "req_pkt", "->", "sender_req_id", ",", "req_pkt", "->", "match", ".", "parts", ".", "rank", ",", "req_pkt", "->", "match", ".", "parts", ".", "tag", ",", "req_pkt", "->", "match", ".", "parts", ".", "context_id", ")", ")", ";", "*", "buflen", "=", "sizeof", "(", "MPIDI_CH3_Pkt_t", ")", ";", "rreq", "=", "MPIDI_CH3U_Recvq_FDU", "(", "req_pkt", "->", "sender_req_id", ",", "&", "req_pkt", "->", "match", ")", ";", "if", "(", "rreq", "!=", "NULL", ")", "{", "MPIU_DBG_MSG", "(", "CH3_OTHER", ",", "TYPICAL", ",", "\"", "\"", ")", ";", "if", "(", "MPIDI_Request_get_msg_type", "(", "rreq", ")", "==", "MPIDI_REQUEST_EAGER_MSG", "&&", "rreq", "->", "dev", ".", "recv_data_sz", ">", "0", ")", "{", "MPIU_Free", "(", "rreq", "->", "dev", ".", "tmpbuf", ")", ";", "}", "MPID_Request_release", "(", "rreq", ")", ";", "ack", "=", "TRUE", ";", "}", "else", "{", "MPIU_DBG_MSG", "(", "CH3_OTHER", ",", "TYPICAL", ",", "\"", "\"", ")", ";", "ack", "=", "FALSE", ";", "}", "MPIDI_Pkt_init", "(", "resp_pkt", ",", "MPIDI_CH3_PKT_CANCEL_SEND_RESP", ")", ";", "resp_pkt", "->", "sender_req_id", "=", "req_pkt", "->", "sender_req_id", ";", "resp_pkt", "->", "ack", "=", "ack", ";", "mpi_errno", "=", "MPIU_CALL", "(", "MPIDI_CH3", ",", "iStartMsg", "(", "vc", ",", "resp_pkt", ",", "sizeof", "(", "*", "resp_pkt", ")", ",", "&", "resp_sreq", ")", ")", ";", "if", "(", "mpi_errno", "!=", "MPI_SUCCESS", ")", "{", "MPIU_ERR_SETANDJUMP", "(", "mpi_errno", ",", "MPI_ERR_OTHER", ",", "\"", "\"", ")", ";", "}", "if", "(", "resp_sreq", "!=", "NULL", ")", "{", "MPID_Request_release", "(", "resp_sreq", ")", ";", "}", "*", "rreqp", "=", "NULL", ";", "fn_fail", ":", "return", "mpi_errno", ";", "}" ]
Handler routines called when cancel send packets arrive
[ "Handler", "routines", "called", "when", "cancel", "send", "packets", "arrive" ]
[ "/* FIXME: Note that this routine is called from within the packet handler. \n If the message queue mutex is different from the progress mutex, this \n must be protected within a message-queue mutex */", "/* FIXME: This is called within the packet handler */", "/* MPIU_THREAD_CS_ENTER(CH3COMM,vc); */", "/* MPIU_THREAD_CS_EXIT(CH3COMM,vc); */" ]
[ { "param": "vc", "type": "MPIDI_VC_t" }, { "param": "pkt", "type": "MPIDI_CH3_Pkt_t" }, { "param": "buflen", "type": "MPIDI_msg_sz_t" }, { "param": "rreqp", "type": "MPID_Request" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vc", "type": "MPIDI_VC_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pkt", "type": "MPIDI_CH3_Pkt_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "buflen", "type": "MPIDI_msg_sz_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rreqp", "type": "MPID_Request", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f4c7524dfb9b681d91ab0bb6fe7ef2d5aaa00f0
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/coll/alltoallw/alltoallw_algorithms.c
[ "Intel", "mpich2", "Unlicense" ]
C
alltoallw_cb_done
void
static void alltoallw_cb_done(void *clientdata, DCMF_Error_t *err) { volatile unsigned * work_left = (unsigned *) clientdata; * work_left = 0; MPID_Progress_signal(); return; }
/** * ************************************************************************** * \brief "Done" callback for collective alltoall message. * ************************************************************************** */
\brief "Done" callback for collective alltoall message.
[ "\\", "brief", "\"", "Done", "\"", "callback", "for", "collective", "alltoall", "message", "." ]
static void alltoallw_cb_done(void *clientdata, DCMF_Error_t *err) { volatile unsigned * work_left = (unsigned *) clientdata; * work_left = 0; MPID_Progress_signal(); return; }
[ "static", "void", "alltoallw_cb_done", "(", "void", "*", "clientdata", ",", "DCMF_Error_t", "*", "err", ")", "{", "volatile", "unsigned", "*", "work_left", "=", "(", "unsigned", "*", ")", "clientdata", ";", "*", "work_left", "=", "0", ";", "MPID_Progress_signal", "(", ")", ";", "return", ";", "}" ]
\brief "Done" callback for collective alltoall message.
[ "\\", "brief", "\"", "Done", "\"", "callback", "for", "collective", "alltoall", "message", "." ]
[]
[ { "param": "clientdata", "type": "void" }, { "param": "err", "type": "DCMF_Error_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "clientdata", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "err", "type": "DCMF_Error_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4bafcfdf7362eb298dce36908f3442c3f2db53ec
graingert/MPICH2-Armel-Raspberry-Pi-1
examples/pmandel_service.c
[ "Intel", "mpich2", "Unlicense" ]
C
subtractive_mandelbrot_point
int
int subtractive_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point, a_point; /* we need 2 pts to use in our calculation */ int num_iterations; /* a counter to track the number of iterations done */ num_iterations = 0; /* zero our counter */ z_point = coord_point; /* initialize to the given start coordinate */ /* loop while the absolute value of the complex coordinate is < our limit (for a mandelbrot) or until we've done our specified maximum number of iterations (both julia and mandelbrot) */ while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { /* z = z(1-z) */ a_point.real = 1.0; a_point.imaginary = 0.0; /* make "1" */ a_point = subtract_complex(a_point,z_point); z_point = multiply_complex(z_point,a_point); ++num_iterations; } /* done iterating for one point */ return num_iterations; }
/* This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer. */
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", ".", "It", "eventually", "returns", "an", "integer", "of", "how", "many", "counts", "the", "code", "iterated", "for", "within", "the", "given", "point", "/", "region", "until", "the", "exit", "condition", "(", "abs", "(", "x", "+", "iy", ")", ">", "limit", ")", "was", "met", ".", "This", "value", "is", "returned", "as", "an", "integer", "." ]
int subtractive_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point, a_point; int num_iterations; num_iterations = 0; z_point = coord_point; while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { a_point.real = 1.0; a_point.imaginary = 0.0; a_point = subtract_complex(a_point,z_point); z_point = multiply_complex(z_point,a_point); ++num_iterations; } return num_iterations; }
[ "int", "subtractive_mandelbrot_point", "(", "complex_t", "coord_point", ",", "complex_t", "c_constant", ",", "int", "Max_iterations", ",", "double", "divergent_limit", ")", "{", "complex_t", "z_point", ",", "a_point", ";", "int", "num_iterations", ";", "num_iterations", "=", "0", ";", "z_point", "=", "coord_point", ";", "while", "(", "absolute_complex", "(", "z_point", ")", "<", "divergent_limit", "&&", "num_iterations", "<", "Max_iterations", ")", "{", "a_point", ".", "real", "=", "1.0", ";", "a_point", ".", "imaginary", "=", "0.0", ";", "a_point", "=", "subtract_complex", "(", "a_point", ",", "z_point", ")", ";", "z_point", "=", "multiply_complex", "(", "z_point", ",", "a_point", ")", ";", "++", "num_iterations", ";", "}", "return", "num_iterations", ";", "}" ]
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", "." ]
[ "/* we need 2 pts to use in our calculation */", "/* a counter to track the number of iterations done */", "/* zero our counter */", "/* initialize to the given start coordinate */", "/* loop while the absolute value of the complex coordinate is < our limit\n (for a mandelbrot) or until we've done our specified maximum number of\n iterations (both julia and mandelbrot) */", "/* z = z(1-z) */", "/* make \"1\" */", "/* done iterating for one point */" ]
[ { "param": "coord_point", "type": "complex_t" }, { "param": "c_constant", "type": "complex_t" }, { "param": "Max_iterations", "type": "int" }, { "param": "divergent_limit", "type": "double" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "coord_point", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "c_constant", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Max_iterations", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "divergent_limit", "type": "double", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4bafcfdf7362eb298dce36908f3442c3f2db53ec
graingert/MPICH2-Armel-Raspberry-Pi-1
examples/pmandel_service.c
[ "Intel", "mpich2", "Unlicense" ]
C
additive_mandelbrot_point
int
int additive_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point, a_point; /* we need 2 pts to use in our calculation */ int num_iterations; /* a counter to track the number of iterations done */ num_iterations = 0; /* zero our counter */ z_point = coord_point; /* initialize to the given start coordinate */ /* loop while the absolute value of the complex coordinate is < our limit (for a mandelbrot) or until we've done our specified maximum number of iterations (both julia and mandelbrot) */ while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { /* z = z(z+C) */ a_point = add_complex(z_point,coord_point); z_point = multiply_complex(z_point,a_point); ++num_iterations; } /* done iterating for one point */ return num_iterations; }
/* This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer. */
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", ".", "It", "eventually", "returns", "an", "integer", "of", "how", "many", "counts", "the", "code", "iterated", "for", "within", "the", "given", "point", "/", "region", "until", "the", "exit", "condition", "(", "abs", "(", "x", "+", "iy", ")", ">", "limit", ")", "was", "met", ".", "This", "value", "is", "returned", "as", "an", "integer", "." ]
int additive_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point, a_point; int num_iterations; num_iterations = 0; z_point = coord_point; while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { a_point = add_complex(z_point,coord_point); z_point = multiply_complex(z_point,a_point); ++num_iterations; } return num_iterations; }
[ "int", "additive_mandelbrot_point", "(", "complex_t", "coord_point", ",", "complex_t", "c_constant", ",", "int", "Max_iterations", ",", "double", "divergent_limit", ")", "{", "complex_t", "z_point", ",", "a_point", ";", "int", "num_iterations", ";", "num_iterations", "=", "0", ";", "z_point", "=", "coord_point", ";", "while", "(", "absolute_complex", "(", "z_point", ")", "<", "divergent_limit", "&&", "num_iterations", "<", "Max_iterations", ")", "{", "a_point", "=", "add_complex", "(", "z_point", ",", "coord_point", ")", ";", "z_point", "=", "multiply_complex", "(", "z_point", ",", "a_point", ")", ";", "++", "num_iterations", ";", "}", "return", "num_iterations", ";", "}" ]
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", "." ]
[ "/* we need 2 pts to use in our calculation */", "/* a counter to track the number of iterations done */", "/* zero our counter */", "/* initialize to the given start coordinate */", "/* loop while the absolute value of the complex coordinate is < our limit\n (for a mandelbrot) or until we've done our specified maximum number of\n iterations (both julia and mandelbrot) */", "/* z = z(z+C) */", "/* done iterating for one point */" ]
[ { "param": "coord_point", "type": "complex_t" }, { "param": "c_constant", "type": "complex_t" }, { "param": "Max_iterations", "type": "int" }, { "param": "divergent_limit", "type": "double" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "coord_point", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "c_constant", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Max_iterations", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "divergent_limit", "type": "double", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4bafcfdf7362eb298dce36908f3442c3f2db53ec
graingert/MPICH2-Armel-Raspberry-Pi-1
examples/pmandel_service.c
[ "Intel", "mpich2", "Unlicense" ]
C
exponential_mandelbrot_point
int
int exponential_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point, a_point; /* we need 2 pts to use in our calculation */ int num_iterations; /* a counter to track the number of iterations done */ num_iterations = 0; /* zero our counter */ z_point = coord_point; /* initialize to the given start coordinate */ /* loop while the absolute value of the complex coordinate is < our limit (for a mandelbrot) or until we've done our specified maximum number of iterations (both julia and mandelbrot) */ while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { /* z = z(1-z) */ a_point.real = 1.0; a_point.imaginary = 0.0; /* make "1" */ a_point = subtract_complex(a_point,z_point); z_point = multiply_complex(z_point,a_point); ++num_iterations; } /* done iterating for one point */ return num_iterations; }
/* This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer. */
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", ".", "It", "eventually", "returns", "an", "integer", "of", "how", "many", "counts", "the", "code", "iterated", "for", "within", "the", "given", "point", "/", "region", "until", "the", "exit", "condition", "(", "abs", "(", "x", "+", "iy", ")", ">", "limit", ")", "was", "met", ".", "This", "value", "is", "returned", "as", "an", "integer", "." ]
int exponential_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point, a_point; int num_iterations; num_iterations = 0; z_point = coord_point; while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { a_point.real = 1.0; a_point.imaginary = 0.0; a_point = subtract_complex(a_point,z_point); z_point = multiply_complex(z_point,a_point); ++num_iterations; } return num_iterations; }
[ "int", "exponential_mandelbrot_point", "(", "complex_t", "coord_point", ",", "complex_t", "c_constant", ",", "int", "Max_iterations", ",", "double", "divergent_limit", ")", "{", "complex_t", "z_point", ",", "a_point", ";", "int", "num_iterations", ";", "num_iterations", "=", "0", ";", "z_point", "=", "coord_point", ";", "while", "(", "absolute_complex", "(", "z_point", ")", "<", "divergent_limit", "&&", "num_iterations", "<", "Max_iterations", ")", "{", "a_point", ".", "real", "=", "1.0", ";", "a_point", ".", "imaginary", "=", "0.0", ";", "a_point", "=", "subtract_complex", "(", "a_point", ",", "z_point", ")", ";", "z_point", "=", "multiply_complex", "(", "z_point", ",", "a_point", ")", ";", "++", "num_iterations", ";", "}", "return", "num_iterations", ";", "}" ]
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", "." ]
[ "/* we need 2 pts to use in our calculation */", "/* a counter to track the number of iterations done */", "/* zero our counter */", "/* initialize to the given start coordinate */", "/* loop while the absolute value of the complex coordinate is < our limit\n (for a mandelbrot) or until we've done our specified maximum number of\n iterations (both julia and mandelbrot) */", "/* z = z(1-z) */", "/* make \"1\" */", "/* done iterating for one point */" ]
[ { "param": "coord_point", "type": "complex_t" }, { "param": "c_constant", "type": "complex_t" }, { "param": "Max_iterations", "type": "int" }, { "param": "divergent_limit", "type": "double" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "coord_point", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "c_constant", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Max_iterations", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "divergent_limit", "type": "double", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4bafcfdf7362eb298dce36908f3442c3f2db53ec
graingert/MPICH2-Armel-Raspberry-Pi-1
examples/pmandel_service.c
[ "Intel", "mpich2", "Unlicense" ]
C
single_mandelbrot_point
int
int single_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point; /* we need a point to use in our calculation */ int num_iterations; /* a counter to track the number of iterations done */ num_iterations = 0; /* zero our counter */ z_point = coord_point; /* initialize to the given start coordinate */ /* loop while the absolute value of the complex coordinate is < our limit (for a mandelbrot) or until we've done our specified maximum number of iterations (both julia and mandelbrot) */ while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { /* z = z*z + c */ z_point = multiply_complex(z_point,z_point); z_point = add_complex(z_point,c_constant); ++num_iterations; } /* done iterating for one point */ return num_iterations; }
/* This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer. */
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is. It eventually returns an integer of how many counts the code iterated for within the given point/region until the exit condition ( abs(x+iy) > limit) was met. This value is returned as an integer.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", ".", "It", "eventually", "returns", "an", "integer", "of", "how", "many", "counts", "the", "code", "iterated", "for", "within", "the", "given", "point", "/", "region", "until", "the", "exit", "condition", "(", "abs", "(", "x", "+", "iy", ")", ">", "limit", ")", "was", "met", ".", "This", "value", "is", "returned", "as", "an", "integer", "." ]
int single_mandelbrot_point(complex_t coord_point, complex_t c_constant, int Max_iterations, double divergent_limit) { complex_t z_point; int num_iterations; num_iterations = 0; z_point = coord_point; while (absolute_complex(z_point) < divergent_limit && num_iterations < Max_iterations) { z_point = multiply_complex(z_point,z_point); z_point = add_complex(z_point,c_constant); ++num_iterations; } return num_iterations; }
[ "int", "single_mandelbrot_point", "(", "complex_t", "coord_point", ",", "complex_t", "c_constant", ",", "int", "Max_iterations", ",", "double", "divergent_limit", ")", "{", "complex_t", "z_point", ";", "int", "num_iterations", ";", "num_iterations", "=", "0", ";", "z_point", "=", "coord_point", ";", "while", "(", "absolute_complex", "(", "z_point", ")", "<", "divergent_limit", "&&", "num_iterations", "<", "Max_iterations", ")", "{", "z_point", "=", "multiply_complex", "(", "z_point", ",", "z_point", ")", ";", "z_point", "=", "add_complex", "(", "z_point", ",", "c_constant", ")", ";", "++", "num_iterations", ";", "}", "return", "num_iterations", ";", "}" ]
This routine takes a complex coordinate point (x+iy) and a value stating what the upper limit to the number of iterations is.
[ "This", "routine", "takes", "a", "complex", "coordinate", "point", "(", "x", "+", "iy", ")", "and", "a", "value", "stating", "what", "the", "upper", "limit", "to", "the", "number", "of", "iterations", "is", "." ]
[ "/* we need a point to use in our calculation */", "/* a counter to track the number of iterations done */", "/* zero our counter */", "/* initialize to the given start coordinate */", "/* loop while the absolute value of the complex coordinate is < our limit\n (for a mandelbrot) or until we've done our specified maximum number of\n iterations (both julia and mandelbrot) */", "/* z = z*z + c */", "/* done iterating for one point */" ]
[ { "param": "coord_point", "type": "complex_t" }, { "param": "c_constant", "type": "complex_t" }, { "param": "Max_iterations", "type": "int" }, { "param": "divergent_limit", "type": "double" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "coord_point", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "c_constant", "type": "complex_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Max_iterations", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "divergent_limit", "type": "double", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4bafcfdf7362eb298dce36908f3442c3f2db53ec
graingert/MPICH2-Armel-Raspberry-Pi-1
examples/pmandel_service.c
[ "Intel", "mpich2", "Unlicense" ]
C
dumpimage
void
void dumpimage(char *filename, int in_grid_array[], int in_pixels_across, int in_pixels_down, int in_max_pixel_value, char input_string[], int num_colors, color_t colors[]) { FILE *ifp; int i, j, k; #ifdef USE_PPM int r, g, b; #endif printf("%s\nwidth: %d\nheight: %d\ncolors: %d\nstr: %s\n", filename, in_pixels_across, in_pixels_down, num_colors, input_string); fflush(stdout); if ( (ifp=fopen(filename, "w")) == NULL) { printf("Error, could not open output file\n"); MPI_Abort(MPI_COMM_WORLD, -1); exit(-1); } #ifdef USE_PPM fprintf(ifp, "P3\n"); /* specifies type of file, in this case ppm */ fprintf(ifp, "# %s\n", input_string); /* an arbitrary file identifier */ /* now give the file size in pixels by pixels */ fprintf(ifp, "%d %d\n", in_pixels_across, in_pixels_down); /* give the max r,g,b level */ fprintf(ifp, "255\n"); k=0; /* counter for the linear array of the final image */ /* assumes first point is upper left corner (element 0 of array) */ if (in_max_pixel_value < 1) { for (j=0; j<in_pixels_down; ++j) /* start at the top row and work down */ { for (i=0; i<in_pixels_across; ++i) /* go along the row */ { fprintf(ifp, "0 0 0 "); } fprintf(ifp, "\n"); /* done writing one row, begin next line */ } } else { for (j=0; j<in_pixels_down; ++j) /* start at the top row and work down */ { for (i=0; i<in_pixels_across; ++i) /* go along the row */ { getRGB(colors[(in_grid_array[k] * num_colors) / in_max_pixel_value], &r, &g, &b); fprintf(ifp, "%d %d %d ", r, g, b); /* +1 since 0 = first color */ ++k; } fprintf(ifp, "\n"); /* done writing one row, begin next line */ } } #else fprintf(ifp, "P2\n"); /* specifies type of file, in this case pgm */ fprintf(ifp, "# %s\n", input_string); /* an arbitrary file identifier */ /* now give the file size in pixels by pixels */ fprintf(ifp, "%d %d\n", in_pixels_across, in_pixels_down); /* gives max number of grayscale levels */ fprintf(ifp, "%d\n", in_max_pixel_value+1); /* plus 1 because 0=first color */ k=0; /* counter for the linear array of the final image */ /* assumes first point is upper left corner (element 0 of array) */ for (j=0;j<in_pixels_down;++j) /* start at the top row and work down */ { for (i=0;i<in_pixels_across;++i) /* go along the row */ { fprintf(ifp, "%d ", in_grid_array[k]+1); /* +1 since 0 = first color */ ++k; } fprintf(ifp, "\n"); /* done writing one row, begin next line */ } #endif fclose(ifp); }
/* You need the following inputs: A linear integer array with the actual pixel values (read in as consecutive rows), The width and height of the grid, and The maximum pixel value (to set greyscale range). We are assuming that the lowest value is "0". */
You need the following inputs: A linear integer array with the actual pixel values (read in as consecutive rows), The width and height of the grid, and The maximum pixel value (to set greyscale range). We are assuming that the lowest value is "0".
[ "You", "need", "the", "following", "inputs", ":", "A", "linear", "integer", "array", "with", "the", "actual", "pixel", "values", "(", "read", "in", "as", "consecutive", "rows", ")", "The", "width", "and", "height", "of", "the", "grid", "and", "The", "maximum", "pixel", "value", "(", "to", "set", "greyscale", "range", ")", ".", "We", "are", "assuming", "that", "the", "lowest", "value", "is", "\"", "0", "\"", "." ]
void dumpimage(char *filename, int in_grid_array[], int in_pixels_across, int in_pixels_down, int in_max_pixel_value, char input_string[], int num_colors, color_t colors[]) { FILE *ifp; int i, j, k; #ifdef USE_PPM int r, g, b; #endif printf("%s\nwidth: %d\nheight: %d\ncolors: %d\nstr: %s\n", filename, in_pixels_across, in_pixels_down, num_colors, input_string); fflush(stdout); if ( (ifp=fopen(filename, "w")) == NULL) { printf("Error, could not open output file\n"); MPI_Abort(MPI_COMM_WORLD, -1); exit(-1); } #ifdef USE_PPM fprintf(ifp, "P3\n"); fprintf(ifp, "# %s\n", input_string); fprintf(ifp, "%d %d\n", in_pixels_across, in_pixels_down); fprintf(ifp, "255\n"); k=0; if (in_max_pixel_value < 1) { for (j=0; j<in_pixels_down; ++j) { for (i=0; i<in_pixels_across; ++i) { fprintf(ifp, "0 0 0 "); } fprintf(ifp, "\n"); } } else { for (j=0; j<in_pixels_down; ++j) { for (i=0; i<in_pixels_across; ++i) { getRGB(colors[(in_grid_array[k] * num_colors) / in_max_pixel_value], &r, &g, &b); fprintf(ifp, "%d %d %d ", r, g, b); ++k; } fprintf(ifp, "\n"); } } #else fprintf(ifp, "P2\n"); fprintf(ifp, "# %s\n", input_string); fprintf(ifp, "%d %d\n", in_pixels_across, in_pixels_down); fprintf(ifp, "%d\n", in_max_pixel_value+1); k=0; for (j=0;j<in_pixels_down;++j) { for (i=0;i<in_pixels_across;++i) { fprintf(ifp, "%d ", in_grid_array[k]+1); ++k; } fprintf(ifp, "\n"); } #endif fclose(ifp); }
[ "void", "dumpimage", "(", "char", "*", "filename", ",", "int", "in_grid_array", "[", "]", ",", "int", "in_pixels_across", ",", "int", "in_pixels_down", ",", "int", "in_max_pixel_value", ",", "char", "input_string", "[", "]", ",", "int", "num_colors", ",", "color_t", "colors", "[", "]", ")", "{", "FILE", "*", "ifp", ";", "int", "i", ",", "j", ",", "k", ";", "#ifdef", "USE_PPM", "int", "r", ",", "g", ",", "b", ";", "#endif", "printf", "(", "\"", "\\n", "\\n", "\\n", "\\n", "\\n", "\"", ",", "filename", ",", "in_pixels_across", ",", "in_pixels_down", ",", "num_colors", ",", "input_string", ")", ";", "fflush", "(", "stdout", ")", ";", "if", "(", "(", "ifp", "=", "fopen", "(", "filename", ",", "\"", "\"", ")", ")", "==", "NULL", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "MPI_Abort", "(", "MPI_COMM_WORLD", ",", "-1", ")", ";", "exit", "(", "-1", ")", ";", "}", "#ifdef", "USE_PPM", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ")", ";", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ",", "input_string", ")", ";", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ",", "in_pixels_across", ",", "in_pixels_down", ")", ";", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ")", ";", "k", "=", "0", ";", "if", "(", "in_max_pixel_value", "<", "1", ")", "{", "for", "(", "j", "=", "0", ";", "j", "<", "in_pixels_down", ";", "++", "j", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "in_pixels_across", ";", "++", "i", ")", "{", "fprintf", "(", "ifp", ",", "\"", "\"", ")", ";", "}", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ")", ";", "}", "}", "else", "{", "for", "(", "j", "=", "0", ";", "j", "<", "in_pixels_down", ";", "++", "j", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "in_pixels_across", ";", "++", "i", ")", "{", "getRGB", "(", "colors", "[", "(", "in_grid_array", "[", "k", "]", "*", "num_colors", ")", "/", "in_max_pixel_value", "]", ",", "&", "r", ",", "&", "g", ",", "&", "b", ")", ";", "fprintf", "(", "ifp", ",", "\"", "\"", ",", "r", ",", "g", ",", "b", ")", ";", "++", "k", ";", "}", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ")", ";", "}", "}", "#else", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ")", ";", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ",", "input_string", ")", ";", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ",", "in_pixels_across", ",", "in_pixels_down", ")", ";", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ",", "in_max_pixel_value", "+", "1", ")", ";", "k", "=", "0", ";", "for", "(", "j", "=", "0", ";", "j", "<", "in_pixels_down", ";", "++", "j", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "in_pixels_across", ";", "++", "i", ")", "{", "fprintf", "(", "ifp", ",", "\"", "\"", ",", "in_grid_array", "[", "k", "]", "+", "1", ")", ";", "++", "k", ";", "}", "fprintf", "(", "ifp", ",", "\"", "\\n", "\"", ")", ";", "}", "#endif", "fclose", "(", "ifp", ")", ";", "}" ]
You need the following inputs: A linear integer array with the actual pixel values (read in as consecutive rows), The width and height of the grid, and The maximum pixel value (to set greyscale range).
[ "You", "need", "the", "following", "inputs", ":", "A", "linear", "integer", "array", "with", "the", "actual", "pixel", "values", "(", "read", "in", "as", "consecutive", "rows", ")", "The", "width", "and", "height", "of", "the", "grid", "and", "The", "maximum", "pixel", "value", "(", "to", "set", "greyscale", "range", ")", "." ]
[ "/* specifies type of file, in this case ppm */", "/* an arbitrary file identifier */", "/* now give the file size in pixels by pixels */", "/* give the max r,g,b level */", "/* counter for the linear array of the final image */", "/* assumes first point is upper left corner (element 0 of array) */", "/* start at the top row and work down */", "/* go along the row */", "/* done writing one row, begin next line */", "/* start at the top row and work down */", "/* go along the row */", "/* +1 since 0 = first color */", "/* done writing one row, begin next line */", "/* specifies type of file, in this case pgm */", "/* an arbitrary file identifier */", "/* now give the file size in pixels by pixels */", "/* gives max number of grayscale levels */", "/* plus 1 because 0=first color */", "/* counter for the linear array of the final image */", "/* assumes first point is upper left corner (element 0 of array) */", "/* start at the top row and work down */", "/* go along the row */", "/* +1 since 0 = first color */", "/* done writing one row, begin next line */" ]
[ { "param": "filename", "type": "char" }, { "param": "in_grid_array", "type": "int" }, { "param": "in_pixels_across", "type": "int" }, { "param": "in_pixels_down", "type": "int" }, { "param": "in_max_pixel_value", "type": "int" }, { "param": "input_string", "type": "char" }, { "param": "num_colors", "type": "int" }, { "param": "colors", "type": "color_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "in_grid_array", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "in_pixels_across", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "in_pixels_down", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "in_max_pixel_value", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "input_string", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num_colors", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "colors", "type": "color_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9131a03196d4d1d21d3cb324281293946612c528
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/pt2pt/mpid_irsend.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPID_Irsend
int
int MPID_Irsend(const void * buf, int count, MPI_Datatype datatype, int rank, int tag, MPID_Comm * comm, int context_offset, MPID_Request ** request) { return MPID_Isend(buf, count, datatype, rank, tag, comm, context_offset, request); }
/** * \brief ADI level implemenation of MPI_Irsend() * * \param[in] buf The buffer to send * \param[in] count Number of elements in the buffer * \param[in] datatype The datatype of each element * \param[in] rank The destination rank * \param[in] tag The message tag * \param[in] comm Pointer to the communicator * \param[in] context_offset Offset from the communicator context ID * \param[out] request Return a pointer to the new request object * * \returns An MPI Error code * * Semantics of Irsend are undefined if the receiver has not posted a * receive. We define this "undefined" behavior to look like the * normal mode send behavior. */
\returns An MPI Error code Semantics of Irsend are undefined if the receiver has not posted a receive. We define this "undefined" behavior to look like the normal mode send behavior.
[ "\\", "returns", "An", "MPI", "Error", "code", "Semantics", "of", "Irsend", "are", "undefined", "if", "the", "receiver", "has", "not", "posted", "a", "receive", ".", "We", "define", "this", "\"", "undefined", "\"", "behavior", "to", "look", "like", "the", "normal", "mode", "send", "behavior", "." ]
int MPID_Irsend(const void * buf, int count, MPI_Datatype datatype, int rank, int tag, MPID_Comm * comm, int context_offset, MPID_Request ** request) { return MPID_Isend(buf, count, datatype, rank, tag, comm, context_offset, request); }
[ "int", "MPID_Irsend", "(", "const", "void", "*", "buf", ",", "int", "count", ",", "MPI_Datatype", "datatype", ",", "int", "rank", ",", "int", "tag", ",", "MPID_Comm", "*", "comm", ",", "int", "context_offset", ",", "MPID_Request", "*", "*", "request", ")", "{", "return", "MPID_Isend", "(", "buf", ",", "count", ",", "datatype", ",", "rank", ",", "tag", ",", "comm", ",", "context_offset", ",", "request", ")", ";", "}" ]
\brief ADI level implemenation of MPI_Irsend() \param[in] buf The buffer to send \param[in] count Number of elements in the buffer \param[in] datatype The datatype of each element \param[in] rank The destination rank \param[in] tag The message tag \param[in] comm Pointer to the communicator \param[in] context_offset Offset from the communicator context ID \param[out] request Return a pointer to the new request object
[ "\\", "brief", "ADI", "level", "implemenation", "of", "MPI_Irsend", "()", "\\", "param", "[", "in", "]", "buf", "The", "buffer", "to", "send", "\\", "param", "[", "in", "]", "count", "Number", "of", "elements", "in", "the", "buffer", "\\", "param", "[", "in", "]", "datatype", "The", "datatype", "of", "each", "element", "\\", "param", "[", "in", "]", "rank", "The", "destination", "rank", "\\", "param", "[", "in", "]", "tag", "The", "message", "tag", "\\", "param", "[", "in", "]", "comm", "Pointer", "to", "the", "communicator", "\\", "param", "[", "in", "]", "context_offset", "Offset", "from", "the", "communicator", "context", "ID", "\\", "param", "[", "out", "]", "request", "Return", "a", "pointer", "to", "the", "new", "request", "object" ]
[]
[ { "param": "buf", "type": "void" }, { "param": "count", "type": "int" }, { "param": "datatype", "type": "MPI_Datatype" }, { "param": "rank", "type": "int" }, { "param": "tag", "type": "int" }, { "param": "comm", "type": "MPID_Comm" }, { "param": "context_offset", "type": "int" }, { "param": "request", "type": "MPID_Request" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "datatype", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rank", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tag", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "comm", "type": "MPID_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "context_offset", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": "MPID_Request", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b26bf07da523abb1dd0a703715ab80d8e1d3eca
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/internals.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Error_impl
void
void ARMCII_Error_impl(const char *file, const int line, const char *func, const char *msg, ...) { va_list ap; int disp; char string[500]; disp = 0; va_start(ap, msg); disp += vsnprintf(string, 500, msg, ap); va_end(ap); fprintf(stderr, "[%d] ARMCI Internal error in %s (%s:%d)\n[%d] Messge: %s\n", ARMCI_GROUP_WORLD.rank, func, file, line, ARMCI_GROUP_WORLD.rank, string); MPI_Abort(ARMCI_GROUP_WORLD.comm, 100); }
/** Raise an internal fatal ARMCI error. * * @param[in] file Current file name (__FILE__) * @param[in] line Current line numeber (__LINE__) * @param[in] func Current function name (__func__) * @param[in] msg Message to be printed * @param[in] code Exit error code */
Raise an internal fatal ARMCI error.
[ "Raise", "an", "internal", "fatal", "ARMCI", "error", "." ]
void ARMCII_Error_impl(const char *file, const int line, const char *func, const char *msg, ...) { va_list ap; int disp; char string[500]; disp = 0; va_start(ap, msg); disp += vsnprintf(string, 500, msg, ap); va_end(ap); fprintf(stderr, "[%d] ARMCI Internal error in %s (%s:%d)\n[%d] Messge: %s\n", ARMCI_GROUP_WORLD.rank, func, file, line, ARMCI_GROUP_WORLD.rank, string); MPI_Abort(ARMCI_GROUP_WORLD.comm, 100); }
[ "void", "ARMCII_Error_impl", "(", "const", "char", "*", "file", ",", "const", "int", "line", ",", "const", "char", "*", "func", ",", "const", "char", "*", "msg", ",", "...", ")", "{", "va_list", "ap", ";", "int", "disp", ";", "char", "string", "[", "500", "]", ";", "disp", "=", "0", ";", "va_start", "(", "ap", ",", "msg", ")", ";", "disp", "+=", "vsnprintf", "(", "string", ",", "500", ",", "msg", ",", "ap", ")", ";", "va_end", "(", "ap", ")", ";", "fprintf", "(", "stderr", ",", "\"", "\\n", "\\n", "\"", ",", "ARMCI_GROUP_WORLD", ".", "rank", ",", "func", ",", "file", ",", "line", ",", "ARMCI_GROUP_WORLD", ".", "rank", ",", "string", ")", ";", "MPI_Abort", "(", "ARMCI_GROUP_WORLD", ".", "comm", ",", "100", ")", ";", "}" ]
Raise an internal fatal ARMCI error.
[ "Raise", "an", "internal", "fatal", "ARMCI", "error", "." ]
[]
[ { "param": "file", "type": "char" }, { "param": "line", "type": "int" }, { "param": "func", "type": "char" }, { "param": "msg", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "line", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "func", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "msg", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b26bf07da523abb1dd0a703715ab80d8e1d3eca
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/internals.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Translate_absolute_to_group
int
int ARMCII_Translate_absolute_to_group(MPI_Comm group_comm, int world_rank) { int group_rank; MPI_Group world_group, sub_group; MPI_Comm_group(ARMCI_GROUP_WORLD.comm, &world_group); MPI_Comm_group(group_comm, &sub_group); MPI_Group_translate_ranks(world_group, 1, &world_rank, sub_group, &group_rank); MPI_Group_free(&world_group); MPI_Group_free(&sub_group); return group_rank == MPI_UNDEFINED ? -1 : group_rank; }
/** Translate a world process rank to the corresponding process rank in the * ARMCI group. * * @param[in] group Group to translate to. * @param[in] world_rank Rank of the process in the world group. * @return Rank in group or -1 if not in the group. */
Translate a world process rank to the corresponding process rank in the ARMCI group. @param[in] group Group to translate to. @param[in] world_rank Rank of the process in the world group. @return Rank in group or -1 if not in the group.
[ "Translate", "a", "world", "process", "rank", "to", "the", "corresponding", "process", "rank", "in", "the", "ARMCI", "group", ".", "@param", "[", "in", "]", "group", "Group", "to", "translate", "to", ".", "@param", "[", "in", "]", "world_rank", "Rank", "of", "the", "process", "in", "the", "world", "group", ".", "@return", "Rank", "in", "group", "or", "-", "1", "if", "not", "in", "the", "group", "." ]
int ARMCII_Translate_absolute_to_group(MPI_Comm group_comm, int world_rank) { int group_rank; MPI_Group world_group, sub_group; MPI_Comm_group(ARMCI_GROUP_WORLD.comm, &world_group); MPI_Comm_group(group_comm, &sub_group); MPI_Group_translate_ranks(world_group, 1, &world_rank, sub_group, &group_rank); MPI_Group_free(&world_group); MPI_Group_free(&sub_group); return group_rank == MPI_UNDEFINED ? -1 : group_rank; }
[ "int", "ARMCII_Translate_absolute_to_group", "(", "MPI_Comm", "group_comm", ",", "int", "world_rank", ")", "{", "int", "group_rank", ";", "MPI_Group", "world_group", ",", "sub_group", ";", "MPI_Comm_group", "(", "ARMCI_GROUP_WORLD", ".", "comm", ",", "&", "world_group", ")", ";", "MPI_Comm_group", "(", "group_comm", ",", "&", "sub_group", ")", ";", "MPI_Group_translate_ranks", "(", "world_group", ",", "1", ",", "&", "world_rank", ",", "sub_group", ",", "&", "group_rank", ")", ";", "MPI_Group_free", "(", "&", "world_group", ")", ";", "MPI_Group_free", "(", "&", "sub_group", ")", ";", "return", "group_rank", "==", "MPI_UNDEFINED", "?", "-1", ":", "group_rank", ";", "}" ]
Translate a world process rank to the corresponding process rank in the ARMCI group.
[ "Translate", "a", "world", "process", "rank", "to", "the", "corresponding", "process", "rank", "in", "the", "ARMCI", "group", "." ]
[]
[ { "param": "group_comm", "type": "MPI_Comm" }, { "param": "world_rank", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "group_comm", "type": "MPI_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "world_rank", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b26bf07da523abb1dd0a703715ab80d8e1d3eca
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/internals.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Acc_type_translate
void
void ARMCII_Acc_type_translate(int armci_datatype, MPI_Datatype *mpi_type, int *type_size) { // Determine the MPI type for the transfer switch (armci_datatype) { case ARMCI_ACC_INT: *mpi_type = MPI_INT; break; case ARMCI_ACC_LNG: *mpi_type = MPI_LONG; break; case ARMCI_ACC_FLT: *mpi_type = MPI_FLOAT; break; case ARMCI_ACC_DBL: *mpi_type = MPI_DOUBLE; break; case ARMCI_ACC_CPL: *mpi_type = MPI_FLOAT; break; case ARMCI_ACC_DCP: *mpi_type = MPI_DOUBLE; break; default: ARMCII_Error("unknown data type", 100); return; } MPI_Type_size(*mpi_type, type_size); }
/** Translate an ARMCI accumulate data type into an MPI type so we can pass it * to mem regions. * * @param[in] armci_datatype ARMCI accumulate data type * @param[out] mpi_type MPI data type * @param[out] type_size Size of the MPI data type */
Translate an ARMCI accumulate data type into an MPI type so we can pass it to mem regions. @param[in] armci_datatype ARMCI accumulate data type @param[out] mpi_type MPI data type @param[out] type_size Size of the MPI data type
[ "Translate", "an", "ARMCI", "accumulate", "data", "type", "into", "an", "MPI", "type", "so", "we", "can", "pass", "it", "to", "mem", "regions", ".", "@param", "[", "in", "]", "armci_datatype", "ARMCI", "accumulate", "data", "type", "@param", "[", "out", "]", "mpi_type", "MPI", "data", "type", "@param", "[", "out", "]", "type_size", "Size", "of", "the", "MPI", "data", "type" ]
void ARMCII_Acc_type_translate(int armci_datatype, MPI_Datatype *mpi_type, int *type_size) { switch (armci_datatype) { case ARMCI_ACC_INT: *mpi_type = MPI_INT; break; case ARMCI_ACC_LNG: *mpi_type = MPI_LONG; break; case ARMCI_ACC_FLT: *mpi_type = MPI_FLOAT; break; case ARMCI_ACC_DBL: *mpi_type = MPI_DOUBLE; break; case ARMCI_ACC_CPL: *mpi_type = MPI_FLOAT; break; case ARMCI_ACC_DCP: *mpi_type = MPI_DOUBLE; break; default: ARMCII_Error("unknown data type", 100); return; } MPI_Type_size(*mpi_type, type_size); }
[ "void", "ARMCII_Acc_type_translate", "(", "int", "armci_datatype", ",", "MPI_Datatype", "*", "mpi_type", ",", "int", "*", "type_size", ")", "{", "switch", "(", "armci_datatype", ")", "{", "case", "ARMCI_ACC_INT", ":", "*", "mpi_type", "=", "MPI_INT", ";", "break", ";", "case", "ARMCI_ACC_LNG", ":", "*", "mpi_type", "=", "MPI_LONG", ";", "break", ";", "case", "ARMCI_ACC_FLT", ":", "*", "mpi_type", "=", "MPI_FLOAT", ";", "break", ";", "case", "ARMCI_ACC_DBL", ":", "*", "mpi_type", "=", "MPI_DOUBLE", ";", "break", ";", "case", "ARMCI_ACC_CPL", ":", "*", "mpi_type", "=", "MPI_FLOAT", ";", "break", ";", "case", "ARMCI_ACC_DCP", ":", "*", "mpi_type", "=", "MPI_DOUBLE", ";", "break", ";", "default", ":", "ARMCII_Error", "(", "\"", "\"", ",", "100", ")", ";", "return", ";", "}", "MPI_Type_size", "(", "*", "mpi_type", ",", "type_size", ")", ";", "}" ]
Translate an ARMCI accumulate data type into an MPI type so we can pass it to mem regions.
[ "Translate", "an", "ARMCI", "accumulate", "data", "type", "into", "an", "MPI", "type", "so", "we", "can", "pass", "it", "to", "mem", "regions", "." ]
[ "// Determine the MPI type for the transfer" ]
[ { "param": "armci_datatype", "type": "int" }, { "param": "mpi_type", "type": "MPI_Datatype" }, { "param": "type_size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "armci_datatype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mpi_type", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type_size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b26bf07da523abb1dd0a703715ab80d8e1d3eca
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/internals.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Flush_local
void
void ARMCII_Flush_local(void) { gmr_t *cur_mreg = gmr_list; while (cur_mreg) { gmr_dla_lock(cur_mreg); gmr_dla_unlock(cur_mreg); cur_mreg = cur_mreg->next; } }
/** Synchronize all public and private windows. */
Synchronize all public and private windows.
[ "Synchronize", "all", "public", "and", "private", "windows", "." ]
void ARMCII_Flush_local(void) { gmr_t *cur_mreg = gmr_list; while (cur_mreg) { gmr_dla_lock(cur_mreg); gmr_dla_unlock(cur_mreg); cur_mreg = cur_mreg->next; } }
[ "void", "ARMCII_Flush_local", "(", "void", ")", "{", "gmr_t", "*", "cur_mreg", "=", "gmr_list", ";", "while", "(", "cur_mreg", ")", "{", "gmr_dla_lock", "(", "cur_mreg", ")", ";", "gmr_dla_unlock", "(", "cur_mreg", ")", ";", "cur_mreg", "=", "cur_mreg", "->", "next", ";", "}", "}" ]
Synchronize all public and private windows.
[ "Synchronize", "all", "public", "and", "private", "windows", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
73d6f7ad072b88cf9b823189616d2ded4b529b12
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/coll/allgatherv/allgatherv_algorithms.c
[ "Intel", "mpich2", "Unlicense" ]
C
allgatherv_async_done
void
static void allgatherv_async_done(void *clientdata, DCMF_Error_t *err) { volatile unsigned *work_left = (unsigned *)clientdata; (*work_left)--; MPID_Progress_signal(); }
/* \brief Callback for async bcast. MPIDO_Bcast call wouldn't be appropriate * here, so we just use call DCMF_AsyncBroadcast directly */
\brief Callback for async bcast. MPIDO_Bcast call wouldn't be appropriate here, so we just use call DCMF_AsyncBroadcast directly
[ "\\", "brief", "Callback", "for", "async", "bcast", ".", "MPIDO_Bcast", "call", "wouldn", "'", "t", "be", "appropriate", "here", "so", "we", "just", "use", "call", "DCMF_AsyncBroadcast", "directly" ]
static void allgatherv_async_done(void *clientdata, DCMF_Error_t *err) { volatile unsigned *work_left = (unsigned *)clientdata; (*work_left)--; MPID_Progress_signal(); }
[ "static", "void", "allgatherv_async_done", "(", "void", "*", "clientdata", ",", "DCMF_Error_t", "*", "err", ")", "{", "volatile", "unsigned", "*", "work_left", "=", "(", "unsigned", "*", ")", "clientdata", ";", "(", "*", "work_left", ")", "--", ";", "MPID_Progress_signal", "(", ")", ";", "}" ]
\brief Callback for async bcast.
[ "\\", "brief", "Callback", "for", "async", "bcast", "." ]
[]
[ { "param": "clientdata", "type": "void" }, { "param": "err", "type": "DCMF_Error_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "clientdata", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "err", "type": "DCMF_Error_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
make_dt_map_vec
void
void make_dt_map_vec(MPI_Datatype dt, mpid_dt_info *dti) { int nb; DLOOP_Offset last; MPID_Segment seg; MPID_Type_map *mv; DLOOP_VECTOR *iv; int i; MPI_Datatype eltype; unsigned size; MPID_Datatype *dtp; /* NOTE: we know "dt" is not builtin, else why do this? */ /* Use existing routines to get IOV */ MPID_Datatype_get_ptr(dt, dtp); nb = dtp->max_contig_blocks + 1; MPIDU_MALLOC(mv, MPID_Type_map, nb * sizeof(*mv), last, "MPID_Type_map"); MPID_assert(mv != NULL); iv = (DLOOP_VECTOR *)mv; MPID_Segment_init(NULL, 1, dt, &seg, 0); last = dtp->size; MPID_Segment_pack_vector(&seg, 0, &last, iv, &nb); if (HANDLE_GET_KIND(dtp->eltype) == HANDLE_KIND_BUILTIN) { eltype = dtp->eltype; size = MPID_Datatype_get_basic_size(eltype); } else { eltype = 0; size = 0; /* don't care */ } /* This works because we go backwards, and DLOOP_VECTOR << MPID_Type_map */ for (i = nb; i > 0; ) { --i; mv[i].off = (size_t)iv[i].DLOOP_VECTOR_BUF; mv[i].len = iv[i].DLOOP_VECTOR_LEN; mv[i].num = (eltype ? mv[i].len / size : 0); mv[i].dt = eltype; } dti->map_len = nb; dti->map = mv; dti->dtp = dtp; }
/** * \brief Build datatype map and iovec * * \param[in] dt Datatype to build map/iov for * \param[out] dti Pointer to datatype info struct */
\brief Build datatype map and iovec \param[in] dt Datatype to build map/iov for \param[out] dti Pointer to datatype info struct
[ "\\", "brief", "Build", "datatype", "map", "and", "iovec", "\\", "param", "[", "in", "]", "dt", "Datatype", "to", "build", "map", "/", "iov", "for", "\\", "param", "[", "out", "]", "dti", "Pointer", "to", "datatype", "info", "struct" ]
void make_dt_map_vec(MPI_Datatype dt, mpid_dt_info *dti) { int nb; DLOOP_Offset last; MPID_Segment seg; MPID_Type_map *mv; DLOOP_VECTOR *iv; int i; MPI_Datatype eltype; unsigned size; MPID_Datatype *dtp; MPID_Datatype_get_ptr(dt, dtp); nb = dtp->max_contig_blocks + 1; MPIDU_MALLOC(mv, MPID_Type_map, nb * sizeof(*mv), last, "MPID_Type_map"); MPID_assert(mv != NULL); iv = (DLOOP_VECTOR *)mv; MPID_Segment_init(NULL, 1, dt, &seg, 0); last = dtp->size; MPID_Segment_pack_vector(&seg, 0, &last, iv, &nb); if (HANDLE_GET_KIND(dtp->eltype) == HANDLE_KIND_BUILTIN) { eltype = dtp->eltype; size = MPID_Datatype_get_basic_size(eltype); } else { eltype = 0; size = 0; } for (i = nb; i > 0; ) { --i; mv[i].off = (size_t)iv[i].DLOOP_VECTOR_BUF; mv[i].len = iv[i].DLOOP_VECTOR_LEN; mv[i].num = (eltype ? mv[i].len / size : 0); mv[i].dt = eltype; } dti->map_len = nb; dti->map = mv; dti->dtp = dtp; }
[ "void", "make_dt_map_vec", "(", "MPI_Datatype", "dt", ",", "mpid_dt_info", "*", "dti", ")", "{", "int", "nb", ";", "DLOOP_Offset", "last", ";", "MPID_Segment", "seg", ";", "MPID_Type_map", "*", "mv", ";", "DLOOP_VECTOR", "*", "iv", ";", "int", "i", ";", "MPI_Datatype", "eltype", ";", "unsigned", "size", ";", "MPID_Datatype", "*", "dtp", ";", "MPID_Datatype_get_ptr", "(", "dt", ",", "dtp", ")", ";", "nb", "=", "dtp", "->", "max_contig_blocks", "+", "1", ";", "MPIDU_MALLOC", "(", "mv", ",", "MPID_Type_map", ",", "nb", "*", "sizeof", "(", "*", "mv", ")", ",", "last", ",", "\"", "\"", ")", ";", "MPID_assert", "(", "mv", "!=", "NULL", ")", ";", "iv", "=", "(", "DLOOP_VECTOR", "*", ")", "mv", ";", "MPID_Segment_init", "(", "NULL", ",", "1", ",", "dt", ",", "&", "seg", ",", "0", ")", ";", "last", "=", "dtp", "->", "size", ";", "MPID_Segment_pack_vector", "(", "&", "seg", ",", "0", ",", "&", "last", ",", "iv", ",", "&", "nb", ")", ";", "if", "(", "HANDLE_GET_KIND", "(", "dtp", "->", "eltype", ")", "==", "HANDLE_KIND_BUILTIN", ")", "{", "eltype", "=", "dtp", "->", "eltype", ";", "size", "=", "MPID_Datatype_get_basic_size", "(", "eltype", ")", ";", "}", "else", "{", "eltype", "=", "0", ";", "size", "=", "0", ";", "}", "for", "(", "i", "=", "nb", ";", "i", ">", "0", ";", ")", "{", "--", "i", ";", "mv", "[", "i", "]", ".", "off", "=", "(", "size_t", ")", "iv", "[", "i", "]", ".", "DLOOP_VECTOR_BUF", ";", "mv", "[", "i", "]", ".", "len", "=", "iv", "[", "i", "]", ".", "DLOOP_VECTOR_LEN", ";", "mv", "[", "i", "]", ".", "num", "=", "(", "eltype", "?", "mv", "[", "i", "]", ".", "len", "/", "size", ":", "0", ")", ";", "mv", "[", "i", "]", ".", "dt", "=", "eltype", ";", "}", "dti", "->", "map_len", "=", "nb", ";", "dti", "->", "map", "=", "mv", ";", "dti", "->", "dtp", "=", "dtp", ";", "}" ]
\brief Build datatype map and iovec \param[in] dt Datatype to build map/iov for \param[out] dti Pointer to datatype info struct
[ "\\", "brief", "Build", "datatype", "map", "and", "iovec", "\\", "param", "[", "in", "]", "dt", "Datatype", "to", "build", "map", "/", "iov", "for", "\\", "param", "[", "out", "]", "dti", "Pointer", "to", "datatype", "info", "struct" ]
[ "/* NOTE: we know \"dt\" is not builtin, else why do this? */", "/* Use existing routines to get IOV */", "/* don't care */", "/* This works because we go backwards, and DLOOP_VECTOR << MPID_Type_map */" ]
[ { "param": "dt", "type": "MPI_Datatype" }, { "param": "dti", "type": "mpid_dt_info" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dt", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dti", "type": "mpid_dt_info", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_free_resource
void
void MPIDU_free_resource(struct mpid_qhead *qhead) { struct mpid_resource *qp, *np; for (qp = qhead->blocks; qp != NULL; qp = np) { np = qp->next_block; MPIDU_FREE(qp, e, "MPIDU_free_resource"); } qhead->blocks = NULL; }
/** * \brief Unconditionally free all resource blocks * referenced by 'qhead'. * * NOTE: elements such as datatype cache require addition freeing * and so won't work with this. We could add a "free func ptr" to * qhead and call it here - so each element type can free any other * buffers it may have allocated. * * Right now, this is only called by Win_free() on the lock and unlock * wait queues, which do no additional allocation. * * \param[in] qhead Queue Head * \return nothing * * \ref rsrc_design */
\brief Unconditionally free all resource blocks referenced by 'qhead'. elements such as datatype cache require addition freeing and so won't work with this. We could add a "free func ptr" to qhead and call it here - so each element type can free any other buffers it may have allocated. Right now, this is only called by Win_free() on the lock and unlock wait queues, which do no additional allocation. \param[in] qhead Queue Head \return nothing
[ "\\", "brief", "Unconditionally", "free", "all", "resource", "blocks", "referenced", "by", "'", "qhead", "'", ".", "elements", "such", "as", "datatype", "cache", "require", "addition", "freeing", "and", "so", "won", "'", "t", "work", "with", "this", ".", "We", "could", "add", "a", "\"", "free", "func", "ptr", "\"", "to", "qhead", "and", "call", "it", "here", "-", "so", "each", "element", "type", "can", "free", "any", "other", "buffers", "it", "may", "have", "allocated", ".", "Right", "now", "this", "is", "only", "called", "by", "Win_free", "()", "on", "the", "lock", "and", "unlock", "wait", "queues", "which", "do", "no", "additional", "allocation", ".", "\\", "param", "[", "in", "]", "qhead", "Queue", "Head", "\\", "return", "nothing" ]
void MPIDU_free_resource(struct mpid_qhead *qhead) { struct mpid_resource *qp, *np; for (qp = qhead->blocks; qp != NULL; qp = np) { np = qp->next_block; MPIDU_FREE(qp, e, "MPIDU_free_resource"); } qhead->blocks = NULL; }
[ "void", "MPIDU_free_resource", "(", "struct", "mpid_qhead", "*", "qhead", ")", "{", "struct", "mpid_resource", "*", "qp", ",", "*", "np", ";", "for", "(", "qp", "=", "qhead", "->", "blocks", ";", "qp", "!=", "NULL", ";", "qp", "=", "np", ")", "{", "np", "=", "qp", "->", "next_block", ";", "MPIDU_FREE", "(", "qp", ",", "e", ",", "\"", "\"", ")", ";", "}", "qhead", "->", "blocks", "=", "NULL", ";", "}" ]
\brief Unconditionally free all resource blocks referenced by 'qhead'.
[ "\\", "brief", "Unconditionally", "free", "all", "resource", "blocks", "referenced", "by", "'", "qhead", "'", "." ]
[]
[ { "param": "qhead", "type": "struct mpid_qhead" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "qhead", "type": "struct mpid_qhead", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_get_element
void
void *MPIDU_get_element(struct mpid_qhead *qhead) { struct mpid_resource *lq = qhead->blocks; struct mpid_element *wp; if (lq == NULL || lq->next_free == NULL) { MPIDU_alloc_resource(qhead); lq = qhead->blocks; MPID_assert_debug(lq != NULL && lq->next_free != NULL); } wp = lq->next_free; lq->next_free = wp->next; if (lq->last_used != NULL) { lq->last_used->next = wp; } wp->next = NULL; lq->last_used = wp; if (lq->next_used == NULL) { lq->next_used = wp; } return wp; }
/** * \brief Get a new (unused) resource element. * * Take a resource element off the free list and put it on the * end of used list (bottom of queue). Element is uninitialized * except for mpid_element structure fields. * * \param[in] qhead Queue Head * \return pointer to element. * * \ref rsrc_design */
\brief Get a new (unused) resource element. Take a resource element off the free list and put it on the end of used list (bottom of queue). Element is uninitialized except for mpid_element structure fields. \param[in] qhead Queue Head \return pointer to element.
[ "\\", "brief", "Get", "a", "new", "(", "unused", ")", "resource", "element", ".", "Take", "a", "resource", "element", "off", "the", "free", "list", "and", "put", "it", "on", "the", "end", "of", "used", "list", "(", "bottom", "of", "queue", ")", ".", "Element", "is", "uninitialized", "except", "for", "mpid_element", "structure", "fields", ".", "\\", "param", "[", "in", "]", "qhead", "Queue", "Head", "\\", "return", "pointer", "to", "element", "." ]
void *MPIDU_get_element(struct mpid_qhead *qhead) { struct mpid_resource *lq = qhead->blocks; struct mpid_element *wp; if (lq == NULL || lq->next_free == NULL) { MPIDU_alloc_resource(qhead); lq = qhead->blocks; MPID_assert_debug(lq != NULL && lq->next_free != NULL); } wp = lq->next_free; lq->next_free = wp->next; if (lq->last_used != NULL) { lq->last_used->next = wp; } wp->next = NULL; lq->last_used = wp; if (lq->next_used == NULL) { lq->next_used = wp; } return wp; }
[ "void", "*", "MPIDU_get_element", "(", "struct", "mpid_qhead", "*", "qhead", ")", "{", "struct", "mpid_resource", "*", "lq", "=", "qhead", "->", "blocks", ";", "struct", "mpid_element", "*", "wp", ";", "if", "(", "lq", "==", "NULL", "||", "lq", "->", "next_free", "==", "NULL", ")", "{", "MPIDU_alloc_resource", "(", "qhead", ")", ";", "lq", "=", "qhead", "->", "blocks", ";", "MPID_assert_debug", "(", "lq", "!=", "NULL", "&&", "lq", "->", "next_free", "!=", "NULL", ")", ";", "}", "wp", "=", "lq", "->", "next_free", ";", "lq", "->", "next_free", "=", "wp", "->", "next", ";", "if", "(", "lq", "->", "last_used", "!=", "NULL", ")", "{", "lq", "->", "last_used", "->", "next", "=", "wp", ";", "}", "wp", "->", "next", "=", "NULL", ";", "lq", "->", "last_used", "=", "wp", ";", "if", "(", "lq", "->", "next_used", "==", "NULL", ")", "{", "lq", "->", "next_used", "=", "wp", ";", "}", "return", "wp", ";", "}" ]
\brief Get a new (unused) resource element.
[ "\\", "brief", "Get", "a", "new", "(", "unused", ")", "resource", "element", "." ]
[]
[ { "param": "qhead", "type": "struct mpid_qhead" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "qhead", "type": "struct mpid_qhead", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
mpid_match_dt
int
static int mpid_match_dt(void *v1, void *v2, void *v3) { struct mpid_dtc_entry *w1 = (struct mpid_dtc_entry *)v1; struct mpid_dtc_entry *w2 = (struct mpid_dtc_entry *)v2; if (w1->dt != w2->dt) { /* couldn't possibly match */ return 1; } if (w1->lpid == w2->lpid) { /* exact match */ return 0; } if (v3 && MPIDU_DT_LPID(w2->lpid) == mpid_my_lpid) { *((struct mpid_dtc_entry **)v3) = w2; } return 1; }
/** * \brief Callback function to match datatype cache entry * * 'v1' is a struct mpid_dtc_entry with lpid and dt filled in with * desired origin lpid and foreign datatype handle. * 'v2' is the (currrent) struct mpid_dtc_entry being examined as * a potential match. * 'v3' optional pointer to element pointer, which will be filled * with the element that contains the already-built datatype * map and iovec, if it exists. This element is the one that * has the local node's lpid. * * \param[in] v1 Desired datatype cache pseudo-element * \param[in] v2 Datatype cache element to compare with 'v1' * \param[in] v3 Pointer to Datatype cache element pointer * where same datatype but different target * will be saved, if v3 not NULL * \return boolean indicating if 'v2' does not matche 'v1'. * * \ref dtcache_design */
\brief Callback function to match datatype cache entry 'v1' is a struct mpid_dtc_entry with lpid and dt filled in with desired origin lpid and foreign datatype handle. 'v2' is the (currrent) struct mpid_dtc_entry being examined as a potential match. 'v3' optional pointer to element pointer, which will be filled with the element that contains the already-built datatype map and iovec, if it exists. This element is the one that has the local node's lpid.
[ "\\", "brief", "Callback", "function", "to", "match", "datatype", "cache", "entry", "'", "v1", "'", "is", "a", "struct", "mpid_dtc_entry", "with", "lpid", "and", "dt", "filled", "in", "with", "desired", "origin", "lpid", "and", "foreign", "datatype", "handle", ".", "'", "v2", "'", "is", "the", "(", "currrent", ")", "struct", "mpid_dtc_entry", "being", "examined", "as", "a", "potential", "match", ".", "'", "v3", "'", "optional", "pointer", "to", "element", "pointer", "which", "will", "be", "filled", "with", "the", "element", "that", "contains", "the", "already", "-", "built", "datatype", "map", "and", "iovec", "if", "it", "exists", ".", "This", "element", "is", "the", "one", "that", "has", "the", "local", "node", "'", "s", "lpid", "." ]
static int mpid_match_dt(void *v1, void *v2, void *v3) { struct mpid_dtc_entry *w1 = (struct mpid_dtc_entry *)v1; struct mpid_dtc_entry *w2 = (struct mpid_dtc_entry *)v2; if (w1->dt != w2->dt) { return 1; } if (w1->lpid == w2->lpid) { return 0; } if (v3 && MPIDU_DT_LPID(w2->lpid) == mpid_my_lpid) { *((struct mpid_dtc_entry **)v3) = w2; } return 1; }
[ "static", "int", "mpid_match_dt", "(", "void", "*", "v1", ",", "void", "*", "v2", ",", "void", "*", "v3", ")", "{", "struct", "mpid_dtc_entry", "*", "w1", "=", "(", "struct", "mpid_dtc_entry", "*", ")", "v1", ";", "struct", "mpid_dtc_entry", "*", "w2", "=", "(", "struct", "mpid_dtc_entry", "*", ")", "v2", ";", "if", "(", "w1", "->", "dt", "!=", "w2", "->", "dt", ")", "{", "return", "1", ";", "}", "if", "(", "w1", "->", "lpid", "==", "w2", "->", "lpid", ")", "{", "return", "0", ";", "}", "if", "(", "v3", "&&", "MPIDU_DT_LPID", "(", "w2", "->", "lpid", ")", "==", "mpid_my_lpid", ")", "{", "*", "(", "(", "struct", "mpid_dtc_entry", "*", "*", ")", "v3", ")", "=", "w2", ";", "}", "return", "1", ";", "}" ]
\brief Callback function to match datatype cache entry 'v1' is a struct mpid_dtc_entry with lpid and dt filled in with desired origin lpid and foreign datatype handle.
[ "\\", "brief", "Callback", "function", "to", "match", "datatype", "cache", "entry", "'", "v1", "'", "is", "a", "struct", "mpid_dtc_entry", "with", "lpid", "and", "dt", "filled", "in", "with", "desired", "origin", "lpid", "and", "foreign", "datatype", "handle", "." ]
[ "/* couldn't possibly match */", "/* exact match */" ]
[ { "param": "v1", "type": "void" }, { "param": "v2", "type": "void" }, { "param": "v3", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v2", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v3", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_locate_dt
null
static struct mpid_dtc_entry *MPIDU_locate_dt(int lpid, MPI_Datatype dt, int *new, struct mpid_dtc_entry **src) { struct mpid_dtc_entry el, *ep; el.lpid = lpid; el.dt = dt; ep = MPIDU_find_element(&dtc, mpid_match_dt, src, &el, NULL); if (new) { if (ep == NULL) { /* el was untouched by (failed) MPIDU_find_element() */ memset(&el.dti, 0, sizeof(el.dti)); ep = MPIDU_add_element(&dtc, &el); *new = 1; } else { *new = 0; } } return ep; }
/** * \brief Locate a cached foreign datatype. * * Internal use only - within datatype cache routines. * Locate a foreign (remote, origin) datatype cache object in * local cache. Returns pointer to datatype cache object. * Uses origin lpid and (foreign) datatype to match. * Flag/pointer 'new' indicates whether the object must not already exist. * If 'new' is not NULL and object exists, sets *new to "0"; or if does * not exist then create new object and set *new to "1". * If 'new' is NULL and object does not exist, returns NULL. * * \param[in] lpid Rank of origin (locker) * \param[in] dt Datatype handle to search for * \param[in] new Pointer to boolean for flag indicating * new element was created. If this is not NULL, * then a new element will be created if none exists. * \param[in] src Pointer to datatype cache element pointer * used to save "closest match" element. * \return If 'new' is false, returns pointer to * datatype cache element found, or NULL if none found. * In the case of 'new' being true, returns NULL if * datatype already exists, or a pointer to a newly-created * cache element otherwise. * * \ref dtcache_design */
\brief Locate a cached foreign datatype. Internal use only - within datatype cache routines. Locate a foreign (remote, origin) datatype cache object in local cache. Returns pointer to datatype cache object. Uses origin lpid and (foreign) datatype to match. Flag/pointer 'new' indicates whether the object must not already exist. If 'new' is not NULL and object exists, sets *new to "0"; or if does not exist then create new object and set *new to "1". If 'new' is NULL and object does not exist, returns NULL. \param[in] lpid Rank of origin (locker) \param[in] dt Datatype handle to search for \param[in] new Pointer to boolean for flag indicating new element was created. If this is not NULL, then a new element will be created if none exists. \param[in] src Pointer to datatype cache element pointer used to save "closest match" element. \return If 'new' is false, returns pointer to datatype cache element found, or NULL if none found. In the case of 'new' being true, returns NULL if datatype already exists, or a pointer to a newly-created cache element otherwise.
[ "\\", "brief", "Locate", "a", "cached", "foreign", "datatype", ".", "Internal", "use", "only", "-", "within", "datatype", "cache", "routines", ".", "Locate", "a", "foreign", "(", "remote", "origin", ")", "datatype", "cache", "object", "in", "local", "cache", ".", "Returns", "pointer", "to", "datatype", "cache", "object", ".", "Uses", "origin", "lpid", "and", "(", "foreign", ")", "datatype", "to", "match", ".", "Flag", "/", "pointer", "'", "new", "'", "indicates", "whether", "the", "object", "must", "not", "already", "exist", ".", "If", "'", "new", "'", "is", "not", "NULL", "and", "object", "exists", "sets", "*", "new", "to", "\"", "0", "\"", ";", "or", "if", "does", "not", "exist", "then", "create", "new", "object", "and", "set", "*", "new", "to", "\"", "1", "\"", ".", "If", "'", "new", "'", "is", "NULL", "and", "object", "does", "not", "exist", "returns", "NULL", ".", "\\", "param", "[", "in", "]", "lpid", "Rank", "of", "origin", "(", "locker", ")", "\\", "param", "[", "in", "]", "dt", "Datatype", "handle", "to", "search", "for", "\\", "param", "[", "in", "]", "new", "Pointer", "to", "boolean", "for", "flag", "indicating", "new", "element", "was", "created", ".", "If", "this", "is", "not", "NULL", "then", "a", "new", "element", "will", "be", "created", "if", "none", "exists", ".", "\\", "param", "[", "in", "]", "src", "Pointer", "to", "datatype", "cache", "element", "pointer", "used", "to", "save", "\"", "closest", "match", "\"", "element", ".", "\\", "return", "If", "'", "new", "'", "is", "false", "returns", "pointer", "to", "datatype", "cache", "element", "found", "or", "NULL", "if", "none", "found", ".", "In", "the", "case", "of", "'", "new", "'", "being", "true", "returns", "NULL", "if", "datatype", "already", "exists", "or", "a", "pointer", "to", "a", "newly", "-", "created", "cache", "element", "otherwise", "." ]
static struct mpid_dtc_entry *MPIDU_locate_dt(int lpid, MPI_Datatype dt, int *new, struct mpid_dtc_entry **src) { struct mpid_dtc_entry el, *ep; el.lpid = lpid; el.dt = dt; ep = MPIDU_find_element(&dtc, mpid_match_dt, src, &el, NULL); if (new) { if (ep == NULL) { memset(&el.dti, 0, sizeof(el.dti)); ep = MPIDU_add_element(&dtc, &el); *new = 1; } else { *new = 0; } } return ep; }
[ "static", "struct", "mpid_dtc_entry", "*", "MPIDU_locate_dt", "(", "int", "lpid", ",", "MPI_Datatype", "dt", ",", "int", "*", "new", ",", "struct", "mpid_dtc_entry", "*", "*", "src", ")", "{", "struct", "mpid_dtc_entry", "el", ",", "*", "ep", ";", "el", ".", "lpid", "=", "lpid", ";", "el", ".", "dt", "=", "dt", ";", "ep", "=", "MPIDU_find_element", "(", "&", "dtc", ",", "mpid_match_dt", ",", "src", ",", "&", "el", ",", "NULL", ")", ";", "if", "(", "new", ")", "{", "if", "(", "ep", "==", "NULL", ")", "{", "memset", "(", "&", "el", ".", "dti", ",", "0", ",", "sizeof", "(", "el", ".", "dti", ")", ")", ";", "ep", "=", "MPIDU_add_element", "(", "&", "dtc", ",", "&", "el", ")", ";", "*", "new", "=", "1", ";", "}", "else", "{", "*", "new", "=", "0", ";", "}", "}", "return", "ep", ";", "}" ]
\brief Locate a cached foreign datatype.
[ "\\", "brief", "Locate", "a", "cached", "foreign", "datatype", "." ]
[ "/* el was untouched by (failed) MPIDU_find_element() */" ]
[ { "param": "lpid", "type": "int" }, { "param": "dt", "type": "MPI_Datatype" }, { "param": "new", "type": "int" }, { "param": "src", "type": "struct mpid_dtc_entry" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lpid", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dt", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src", "type": "struct mpid_dtc_entry", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_flush_dt
int
static int MPIDU_flush_dt(MPID_Datatype *dtp) { struct mpid_dtc_entry el, *ep; struct mpid_element *pp = NULL; int n = 0; el.dt = dtp->handle; while ((ep = MPIDU_find_element(&dtc, mpid_flush_dt, NULL, &el, &pp)) != NULL) { if (MPIDU_DT_LPID(ep->lpid) == mpid_my_lpid) { if (ep->dti.map) MPIDU_FREE(ep->dti.map, mpi_errno, "MPIDU_flush_dt"); if (ep->dti.dtp && !ep->dti.dtp->handle) MPIDU_FREE(ep->dti.dtp, mpi_errno, "MPIDU_flush_dt"); } MPIDU_free_element(&dtc, ep, pp); ++n; } return n; }
/** * \brief Function to remove all datatype cache entries for specific datatype * * Should be called whenever a datatype is freed/destroyed. Alternatively, * could be called whenever a datatype is detected as having changed * (i.e. handle gets re-used). * * \param[in] dtp MPID_Datatype object to be flushed * \return number of entries flushed */
\brief Function to remove all datatype cache entries for specific datatype Should be called whenever a datatype is freed/destroyed. Alternatively, could be called whenever a datatype is detected as having changed . \param[in] dtp MPID_Datatype object to be flushed \return number of entries flushed
[ "\\", "brief", "Function", "to", "remove", "all", "datatype", "cache", "entries", "for", "specific", "datatype", "Should", "be", "called", "whenever", "a", "datatype", "is", "freed", "/", "destroyed", ".", "Alternatively", "could", "be", "called", "whenever", "a", "datatype", "is", "detected", "as", "having", "changed", ".", "\\", "param", "[", "in", "]", "dtp", "MPID_Datatype", "object", "to", "be", "flushed", "\\", "return", "number", "of", "entries", "flushed" ]
static int MPIDU_flush_dt(MPID_Datatype *dtp) { struct mpid_dtc_entry el, *ep; struct mpid_element *pp = NULL; int n = 0; el.dt = dtp->handle; while ((ep = MPIDU_find_element(&dtc, mpid_flush_dt, NULL, &el, &pp)) != NULL) { if (MPIDU_DT_LPID(ep->lpid) == mpid_my_lpid) { if (ep->dti.map) MPIDU_FREE(ep->dti.map, mpi_errno, "MPIDU_flush_dt"); if (ep->dti.dtp && !ep->dti.dtp->handle) MPIDU_FREE(ep->dti.dtp, mpi_errno, "MPIDU_flush_dt"); } MPIDU_free_element(&dtc, ep, pp); ++n; } return n; }
[ "static", "int", "MPIDU_flush_dt", "(", "MPID_Datatype", "*", "dtp", ")", "{", "struct", "mpid_dtc_entry", "el", ",", "*", "ep", ";", "struct", "mpid_element", "*", "pp", "=", "NULL", ";", "int", "n", "=", "0", ";", "el", ".", "dt", "=", "dtp", "->", "handle", ";", "while", "(", "(", "ep", "=", "MPIDU_find_element", "(", "&", "dtc", ",", "mpid_flush_dt", ",", "NULL", ",", "&", "el", ",", "&", "pp", ")", ")", "!=", "NULL", ")", "{", "if", "(", "MPIDU_DT_LPID", "(", "ep", "->", "lpid", ")", "==", "mpid_my_lpid", ")", "{", "if", "(", "ep", "->", "dti", ".", "map", ")", "MPIDU_FREE", "(", "ep", "->", "dti", ".", "map", ",", "mpi_errno", ",", "\"", "\"", ")", ";", "if", "(", "ep", "->", "dti", ".", "dtp", "&&", "!", "ep", "->", "dti", ".", "dtp", "->", "handle", ")", "MPIDU_FREE", "(", "ep", "->", "dti", ".", "dtp", ",", "mpi_errno", ",", "\"", "\"", ")", ";", "}", "MPIDU_free_element", "(", "&", "dtc", ",", "ep", ",", "pp", ")", ";", "++", "n", ";", "}", "return", "n", ";", "}" ]
\brief Function to remove all datatype cache entries for specific datatype Should be called whenever a datatype is freed/destroyed.
[ "\\", "brief", "Function", "to", "remove", "all", "datatype", "cache", "entries", "for", "specific", "datatype", "Should", "be", "called", "whenever", "a", "datatype", "is", "freed", "/", "destroyed", "." ]
[]
[ { "param": "dtp", "type": "MPID_Datatype" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dtp", "type": "MPID_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPID_Prepare_rem_dt
char
char *MPID_Prepare_rem_dt(MPIDU_Onesided_info_t *mi) { struct mpid_dtc_entry *dtc; int new = 0; dtc = MPIDU_locate_dt(mi->mpid_info_w2 | MPIDU_ORIGIN_FLAG, (MPI_Datatype)mi->mpid_info_w3, &new, NULL); if (!new) { /* if origin is re-sending, they must know what they're doing. */ if (dtc->dti.map) MPIDU_FREE(dtc->dti.map, mpi_errno, "MPID_Prepare_rem_dt"); } if (!dtc->dti.dtp) { dtc->dti.dtp = MPIDU_MALLOC(dtc->dti.dtp, MPID_Datatype, sizeof(MPID_Datatype), mpi_errno, "MPID_Prepare_rem_dt"); MPID_assert(dtc->dti.dtp != NULL); } /* caution! not a real datatype object! */ dtc->dti.dtp->handle = 0; dtc->dti.dtp->extent = mi->mpid_info_w4; dtc->dti.dtp->eltype = mi->mpid_info_w5; dtc->dti.dtp->element_size = mi->mpid_info_w6; dtc->dti.map_len = 0; MPIDU_MALLOC(dtc->dti.map, MPID_Type_map, mi->mpid_info_w1 * sizeof(*dtc->dti.map), mpi_errno, "MPID_Prepare_rem_dt"); MPID_assert(dtc->dti.map != NULL); #ifdef NOT_USED dtc->dti.iov = NULL; #endif /* NOT_USED */ return (char *)dtc->dti.map; }
/** * \brief Prepare to receive a foreign datatype (step 1 - map). * * Called when MPID_MSGTYPE_DT_MAP (first datatype packet) received. * Returns NULL if this datatype is already in the cache. * Since the origin should be mirroring our cache status, * we would expect to never see this case here. * Must be the first of sequence: * - MPID_MSGTYPE_DT_MAP * - MPID_MSGTYPE_DT_IOV * - MPID_MSGTYPE_ACC (_PUT, _GET) * Although, the cache operation is not dependant on any subsequent * RMA operations - i.e. the caching may be done for its own sake. * * Allocates storage for the map and updates cache element. * * mpid_info_w0 = MPID_MSGTYPE_MAP * mpid_info_w1 = map size, bytes * mpid_info_w2 = origin lpid * mpid_info_w3 = foreign datatype handle * mpid_info_w4 = datatype extent * mpid_info_w5 = datatype element type * mpid_info_w6 = datatype element size * mpid_info_w7 = (not used) * * \param[in] mi MPIDU_Onesided_info_t containing data * \return pointer to buffer to receive foreign datatype map * structure, or NULL if datatype is already cached. * * \ref dtcache_design */
\brief Prepare to receive a foreign datatype (step 1 - map). Called when MPID_MSGTYPE_DT_MAP (first datatype packet) received. Returns NULL if this datatype is already in the cache. Since the origin should be mirroring our cache status, we would expect to never see this case here. Must be the first of sequence: - MPID_MSGTYPE_DT_MAP - MPID_MSGTYPE_DT_IOV - MPID_MSGTYPE_ACC (_PUT, _GET) Although, the cache operation is not dependant on any subsequent RMA operations - i.e. the caching may be done for its own sake. Allocates storage for the map and updates cache element. \param[in] mi MPIDU_Onesided_info_t containing data \return pointer to buffer to receive foreign datatype map structure, or NULL if datatype is already cached.
[ "\\", "brief", "Prepare", "to", "receive", "a", "foreign", "datatype", "(", "step", "1", "-", "map", ")", ".", "Called", "when", "MPID_MSGTYPE_DT_MAP", "(", "first", "datatype", "packet", ")", "received", ".", "Returns", "NULL", "if", "this", "datatype", "is", "already", "in", "the", "cache", ".", "Since", "the", "origin", "should", "be", "mirroring", "our", "cache", "status", "we", "would", "expect", "to", "never", "see", "this", "case", "here", ".", "Must", "be", "the", "first", "of", "sequence", ":", "-", "MPID_MSGTYPE_DT_MAP", "-", "MPID_MSGTYPE_DT_IOV", "-", "MPID_MSGTYPE_ACC", "(", "_PUT", "_GET", ")", "Although", "the", "cache", "operation", "is", "not", "dependant", "on", "any", "subsequent", "RMA", "operations", "-", "i", ".", "e", ".", "the", "caching", "may", "be", "done", "for", "its", "own", "sake", ".", "Allocates", "storage", "for", "the", "map", "and", "updates", "cache", "element", ".", "\\", "param", "[", "in", "]", "mi", "MPIDU_Onesided_info_t", "containing", "data", "\\", "return", "pointer", "to", "buffer", "to", "receive", "foreign", "datatype", "map", "structure", "or", "NULL", "if", "datatype", "is", "already", "cached", "." ]
char *MPID_Prepare_rem_dt(MPIDU_Onesided_info_t *mi) { struct mpid_dtc_entry *dtc; int new = 0; dtc = MPIDU_locate_dt(mi->mpid_info_w2 | MPIDU_ORIGIN_FLAG, (MPI_Datatype)mi->mpid_info_w3, &new, NULL); if (!new) { if (dtc->dti.map) MPIDU_FREE(dtc->dti.map, mpi_errno, "MPID_Prepare_rem_dt"); } if (!dtc->dti.dtp) { dtc->dti.dtp = MPIDU_MALLOC(dtc->dti.dtp, MPID_Datatype, sizeof(MPID_Datatype), mpi_errno, "MPID_Prepare_rem_dt"); MPID_assert(dtc->dti.dtp != NULL); } dtc->dti.dtp->handle = 0; dtc->dti.dtp->extent = mi->mpid_info_w4; dtc->dti.dtp->eltype = mi->mpid_info_w5; dtc->dti.dtp->element_size = mi->mpid_info_w6; dtc->dti.map_len = 0; MPIDU_MALLOC(dtc->dti.map, MPID_Type_map, mi->mpid_info_w1 * sizeof(*dtc->dti.map), mpi_errno, "MPID_Prepare_rem_dt"); MPID_assert(dtc->dti.map != NULL); #ifdef NOT_USED dtc->dti.iov = NULL; #endif return (char *)dtc->dti.map; }
[ "char", "*", "MPID_Prepare_rem_dt", "(", "MPIDU_Onesided_info_t", "*", "mi", ")", "{", "struct", "mpid_dtc_entry", "*", "dtc", ";", "int", "new", "=", "0", ";", "dtc", "=", "MPIDU_locate_dt", "(", "mi", "->", "mpid_info_w2", "|", "MPIDU_ORIGIN_FLAG", ",", "(", "MPI_Datatype", ")", "mi", "->", "mpid_info_w3", ",", "&", "new", ",", "NULL", ")", ";", "if", "(", "!", "new", ")", "{", "if", "(", "dtc", "->", "dti", ".", "map", ")", "MPIDU_FREE", "(", "dtc", "->", "dti", ".", "map", ",", "mpi_errno", ",", "\"", "\"", ")", ";", "}", "if", "(", "!", "dtc", "->", "dti", ".", "dtp", ")", "{", "dtc", "->", "dti", ".", "dtp", "=", "MPIDU_MALLOC", "(", "dtc", "->", "dti", ".", "dtp", ",", "MPID_Datatype", ",", "sizeof", "(", "MPID_Datatype", ")", ",", "mpi_errno", ",", "\"", "\"", ")", ";", "MPID_assert", "(", "dtc", "->", "dti", ".", "dtp", "!=", "NULL", ")", ";", "}", "dtc", "->", "dti", ".", "dtp", "->", "handle", "=", "0", ";", "dtc", "->", "dti", ".", "dtp", "->", "extent", "=", "mi", "->", "mpid_info_w4", ";", "dtc", "->", "dti", ".", "dtp", "->", "eltype", "=", "mi", "->", "mpid_info_w5", ";", "dtc", "->", "dti", ".", "dtp", "->", "element_size", "=", "mi", "->", "mpid_info_w6", ";", "dtc", "->", "dti", ".", "map_len", "=", "0", ";", "MPIDU_MALLOC", "(", "dtc", "->", "dti", ".", "map", ",", "MPID_Type_map", ",", "mi", "->", "mpid_info_w1", "*", "sizeof", "(", "*", "dtc", "->", "dti", ".", "map", ")", ",", "mpi_errno", ",", "\"", "\"", ")", ";", "MPID_assert", "(", "dtc", "->", "dti", ".", "map", "!=", "NULL", ")", ";", "#ifdef", "NOT_USED", "dtc", "->", "dti", ".", "iov", "=", "NULL", ";", "#endif", "return", "(", "char", "*", ")", "dtc", "->", "dti", ".", "map", ";", "}" ]
\brief Prepare to receive a foreign datatype (step 1 - map).
[ "\\", "brief", "Prepare", "to", "receive", "a", "foreign", "datatype", "(", "step", "1", "-", "map", ")", "." ]
[ "/* if origin is re-sending, they must know what they're doing. */", "/* caution! not a real datatype object! */", "/* NOT_USED */" ]
[ { "param": "mi", "type": "MPIDU_Onesided_info_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mi", "type": "MPIDU_Onesided_info_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPID_Recvdone1_rem_dt
void
void MPID_Recvdone1_rem_dt(MPIDU_Onesided_xtra_t *xtra) { struct mpid_dtc_entry *dtc; dtc = MPIDU_locate_dt(xtra->mpid_xtra_w2 | MPIDU_ORIGIN_FLAG, xtra->mpid_xtra_w3, NULL, NULL); MPID_assert_debug(dtc != NULL); dtc->dti.map_len = xtra->mpid_xtra_w1; }
/** * \brief completion for datatype cache messages (map and iov) * * To use this callback, the msginfo (DCQuad) must * be filled as follows: * * - \e w0 - extent size * - \e w1 - number of elements in map or iov * - \e w2 - origin rank * - \e w3 - datatype handle on origin * * \param[in] xtra Pointer to xtra msginfo saved from original message * \return nothing * */
\brief completion for datatype cache messages (map and iov) To use this callback, the msginfo (DCQuad) must be filled as follows. \param[in] xtra Pointer to xtra msginfo saved from original message \return nothing
[ "\\", "brief", "completion", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "To", "use", "this", "callback", "the", "msginfo", "(", "DCQuad", ")", "must", "be", "filled", "as", "follows", ".", "\\", "param", "[", "in", "]", "xtra", "Pointer", "to", "xtra", "msginfo", "saved", "from", "original", "message", "\\", "return", "nothing" ]
void MPID_Recvdone1_rem_dt(MPIDU_Onesided_xtra_t *xtra) { struct mpid_dtc_entry *dtc; dtc = MPIDU_locate_dt(xtra->mpid_xtra_w2 | MPIDU_ORIGIN_FLAG, xtra->mpid_xtra_w3, NULL, NULL); MPID_assert_debug(dtc != NULL); dtc->dti.map_len = xtra->mpid_xtra_w1; }
[ "void", "MPID_Recvdone1_rem_dt", "(", "MPIDU_Onesided_xtra_t", "*", "xtra", ")", "{", "struct", "mpid_dtc_entry", "*", "dtc", ";", "dtc", "=", "MPIDU_locate_dt", "(", "xtra", "->", "mpid_xtra_w2", "|", "MPIDU_ORIGIN_FLAG", ",", "xtra", "->", "mpid_xtra_w3", ",", "NULL", ",", "NULL", ")", ";", "MPID_assert_debug", "(", "dtc", "!=", "NULL", ")", ";", "dtc", "->", "dti", ".", "map_len", "=", "xtra", "->", "mpid_xtra_w1", ";", "}" ]
\brief completion for datatype cache messages (map and iov) To use this callback, the msginfo (DCQuad) must be filled as follows:
[ "\\", "brief", "completion", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "To", "use", "this", "callback", "the", "msginfo", "(", "DCQuad", ")", "must", "be", "filled", "as", "follows", ":" ]
[]
[ { "param": "xtra", "type": "MPIDU_Onesided_xtra_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "xtra", "type": "MPIDU_Onesided_xtra_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
mpid_recvdone2_rem_dt
void
static void mpid_recvdone2_rem_dt(MPIDU_Onesided_xtra_t *xtra) { struct mpid_dtc_entry *dtc; dtc = MPIDU_locate_dt(xtra->mpid_xtra_w2 | MPIDU_ORIGIN_FLAG, xtra->mpid_xtra_w3, NULL, NULL); MPID_assert_debug(dtc != NULL); dtc->dti.iov_len = xtra->mpid_xtra_w1; }
/** * \brief completion for datatype cache messages (map and iov) * * To use this callback, the msginfo (DCQuad) must * be filled as follows: * * - \e w0 - MPID_MSGTYPE_DT_IOV * - \e w1 - number of elements in map or iov * - \e w2 - origin rank * - \e w3 - datatype handle on origin * * \param[in] xtra Pointer to xtra msginfo saved from original message * \return nothing * */
\brief completion for datatype cache messages (map and iov) To use this callback, the msginfo (DCQuad) must be filled as follows. \param[in] xtra Pointer to xtra msginfo saved from original message \return nothing
[ "\\", "brief", "completion", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "To", "use", "this", "callback", "the", "msginfo", "(", "DCQuad", ")", "must", "be", "filled", "as", "follows", ".", "\\", "param", "[", "in", "]", "xtra", "Pointer", "to", "xtra", "msginfo", "saved", "from", "original", "message", "\\", "return", "nothing" ]
static void mpid_recvdone2_rem_dt(MPIDU_Onesided_xtra_t *xtra) { struct mpid_dtc_entry *dtc; dtc = MPIDU_locate_dt(xtra->mpid_xtra_w2 | MPIDU_ORIGIN_FLAG, xtra->mpid_xtra_w3, NULL, NULL); MPID_assert_debug(dtc != NULL); dtc->dti.iov_len = xtra->mpid_xtra_w1; }
[ "static", "void", "mpid_recvdone2_rem_dt", "(", "MPIDU_Onesided_xtra_t", "*", "xtra", ")", "{", "struct", "mpid_dtc_entry", "*", "dtc", ";", "dtc", "=", "MPIDU_locate_dt", "(", "xtra", "->", "mpid_xtra_w2", "|", "MPIDU_ORIGIN_FLAG", ",", "xtra", "->", "mpid_xtra_w3", ",", "NULL", ",", "NULL", ")", ";", "MPID_assert_debug", "(", "dtc", "!=", "NULL", ")", ";", "dtc", "->", "dti", ".", "iov_len", "=", "xtra", "->", "mpid_xtra_w1", ";", "}" ]
\brief completion for datatype cache messages (map and iov) To use this callback, the msginfo (DCQuad) must be filled as follows:
[ "\\", "brief", "completion", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "To", "use", "this", "callback", "the", "msginfo", "(", "DCQuad", ")", "must", "be", "filled", "as", "follows", ":" ]
[]
[ { "param": "xtra", "type": "MPIDU_Onesided_xtra_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "xtra", "type": "MPIDU_Onesided_xtra_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_check_dt
int
int MPIDU_check_dt(int lpid, MPI_Datatype dt, mpid_dt_info *dti) { struct mpid_dtc_entry *dtc, *cln = NULL; int new = 0; dtc = MPIDU_locate_dt(lpid | MPIDU_TARGET_FLAG, dt, &new, &cln); if (new) { if (cln) { /* * same local datatype, different target, * copy what we already have cached. */ dtc->dti = cln->dti; } else { /* * first time using this datatype - create map/iov. */ make_dt_map_vec(dt, &dtc->dti); #ifdef NOT_USED MPID_assert_debug(dtc->dti.iov != NULL); #endif /* NOT_USED */ MPID_assert_debug(dtc->dti.map != NULL); } } if (dti) { *dti = dtc->dti; } /* we never send datatype */ return 1; return (!new); }
/** * \brief Checks whether a local datatype has already been cached * at the target node. * * Determine whether a local datatype has already been sent to * this target (and thus is cached over there). * Returns bool TRUE if datatype is (should be) in lpid's cache. * * Should only be called on the origin. * * \param[in] lpid lpid of target * \param[in] dt Local datatype handle to search for * \param[out] dti Pointer to datatype info struct * \return Boolean TRUE if the datatype has already been cached. * * \ref dtcache_design */
\brief Checks whether a local datatype has already been cached at the target node. Determine whether a local datatype has already been sent to this target (and thus is cached over there). Returns bool TRUE if datatype is (should be) in lpid's cache. Should only be called on the origin. \param[in] lpid lpid of target \param[in] dt Local datatype handle to search for \param[out] dti Pointer to datatype info struct \return Boolean TRUE if the datatype has already been cached.
[ "\\", "brief", "Checks", "whether", "a", "local", "datatype", "has", "already", "been", "cached", "at", "the", "target", "node", ".", "Determine", "whether", "a", "local", "datatype", "has", "already", "been", "sent", "to", "this", "target", "(", "and", "thus", "is", "cached", "over", "there", ")", ".", "Returns", "bool", "TRUE", "if", "datatype", "is", "(", "should", "be", ")", "in", "lpid", "'", "s", "cache", ".", "Should", "only", "be", "called", "on", "the", "origin", ".", "\\", "param", "[", "in", "]", "lpid", "lpid", "of", "target", "\\", "param", "[", "in", "]", "dt", "Local", "datatype", "handle", "to", "search", "for", "\\", "param", "[", "out", "]", "dti", "Pointer", "to", "datatype", "info", "struct", "\\", "return", "Boolean", "TRUE", "if", "the", "datatype", "has", "already", "been", "cached", "." ]
int MPIDU_check_dt(int lpid, MPI_Datatype dt, mpid_dt_info *dti) { struct mpid_dtc_entry *dtc, *cln = NULL; int new = 0; dtc = MPIDU_locate_dt(lpid | MPIDU_TARGET_FLAG, dt, &new, &cln); if (new) { if (cln) { dtc->dti = cln->dti; } else { make_dt_map_vec(dt, &dtc->dti); #ifdef NOT_USED MPID_assert_debug(dtc->dti.iov != NULL); #endif MPID_assert_debug(dtc->dti.map != NULL); } } if (dti) { *dti = dtc->dti; } return 1; return (!new); }
[ "int", "MPIDU_check_dt", "(", "int", "lpid", ",", "MPI_Datatype", "dt", ",", "mpid_dt_info", "*", "dti", ")", "{", "struct", "mpid_dtc_entry", "*", "dtc", ",", "*", "cln", "=", "NULL", ";", "int", "new", "=", "0", ";", "dtc", "=", "MPIDU_locate_dt", "(", "lpid", "|", "MPIDU_TARGET_FLAG", ",", "dt", ",", "&", "new", ",", "&", "cln", ")", ";", "if", "(", "new", ")", "{", "if", "(", "cln", ")", "{", "dtc", "->", "dti", "=", "cln", "->", "dti", ";", "}", "else", "{", "make_dt_map_vec", "(", "dt", ",", "&", "dtc", "->", "dti", ")", ";", "#ifdef", "NOT_USED", "MPID_assert_debug", "(", "dtc", "->", "dti", ".", "iov", "!=", "NULL", ")", ";", "#endif", "MPID_assert_debug", "(", "dtc", "->", "dti", ".", "map", "!=", "NULL", ")", ";", "}", "}", "if", "(", "dti", ")", "{", "*", "dti", "=", "dtc", "->", "dti", ";", "}", "return", "1", ";", "return", "(", "!", "new", ")", ";", "}" ]
\brief Checks whether a local datatype has already been cached at the target node.
[ "\\", "brief", "Checks", "whether", "a", "local", "datatype", "has", "already", "been", "cached", "at", "the", "target", "node", "." ]
[ "/*\n * same local datatype, different target,\n * copy what we already have cached.\n */", "/*\n * first time using this datatype - create map/iov.\n */", "/* NOT_USED */", "/* we never send datatype */" ]
[ { "param": "lpid", "type": "int" }, { "param": "dt", "type": "MPI_Datatype" }, { "param": "dti", "type": "mpid_dt_info" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lpid", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dt", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dti", "type": "mpid_dt_info", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
mpid_match_rq
int
static int mpid_match_rq(void *v1, void *v2, void *v3) { DCMF_Request_t *w1 = (DCMF_Request_t *)v1; struct mpid_rqc_entry *w2 = (struct mpid_rqc_entry *)v2; return (w1 != &w2->req); }
/** * \brief Test if a request object is represented by the given element. * * \param[in] v1 Pointer to DCMF request object in question * \param[in] v2 Pointer to request cache element to test * \param[in] v3 not used * \return 1 if NOT a matching request * * \ref rqcache_design */
\brief Test if a request object is represented by the given element. \param[in] v1 Pointer to DCMF request object in question \param[in] v2 Pointer to request cache element to test \param[in] v3 not used \return 1 if NOT a matching request
[ "\\", "brief", "Test", "if", "a", "request", "object", "is", "represented", "by", "the", "given", "element", ".", "\\", "param", "[", "in", "]", "v1", "Pointer", "to", "DCMF", "request", "object", "in", "question", "\\", "param", "[", "in", "]", "v2", "Pointer", "to", "request", "cache", "element", "to", "test", "\\", "param", "[", "in", "]", "v3", "not", "used", "\\", "return", "1", "if", "NOT", "a", "matching", "request" ]
static int mpid_match_rq(void *v1, void *v2, void *v3) { DCMF_Request_t *w1 = (DCMF_Request_t *)v1; struct mpid_rqc_entry *w2 = (struct mpid_rqc_entry *)v2; return (w1 != &w2->req); }
[ "static", "int", "mpid_match_rq", "(", "void", "*", "v1", ",", "void", "*", "v2", ",", "void", "*", "v3", ")", "{", "DCMF_Request_t", "*", "w1", "=", "(", "DCMF_Request_t", "*", ")", "v1", ";", "struct", "mpid_rqc_entry", "*", "w2", "=", "(", "struct", "mpid_rqc_entry", "*", ")", "v2", ";", "return", "(", "w1", "!=", "&", "w2", "->", "req", ")", ";", "}" ]
\brief Test if a request object is represented by the given element.
[ "\\", "brief", "Test", "if", "a", "request", "object", "is", "represented", "by", "the", "given", "element", "." ]
[]
[ { "param": "v1", "type": "void" }, { "param": "v2", "type": "void" }, { "param": "v3", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v2", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v3", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_get_req
DCMF_Request_t
DCMF_Request_t *MPIDU_get_req(MPIDU_Onesided_xtra_t *xtra, MPIDU_Onesided_info_t **info) { struct mpid_rqc_entry *rqe; rqe = MPIDU_get_element(&rqc); MPID_assert_debug(rqe != NULL); // This assert is not relavent for non-BG and not needed for BG. // MPID_assert_debug((((unsigned)&rqe->req) & 0x0f) == 0); if (xtra) { rqe->xtra = *xtra; } else { memset(&rqe->xtra, 0, sizeof(rqe->xtra)); } if (info) { *info = &rqe->info; } return &rqe->req; }
/** * \brief Get a new request object from the resource queue. * * If 'xtra' is not NULL, copy data into request cache element, * otherwise zero the field. * Returns pointer to the request component of the cache element. * * \param[in] xtra Optional pointer to additional info to save * \param[out] info Optional pointer to private msg info to use * \return Pointer to DCMF request object * * \ref rqcache_design */
\brief Get a new request object from the resource queue. If 'xtra' is not NULL, copy data into request cache element, otherwise zero the field. Returns pointer to the request component of the cache element. \param[in] xtra Optional pointer to additional info to save \param[out] info Optional pointer to private msg info to use \return Pointer to DCMF request object
[ "\\", "brief", "Get", "a", "new", "request", "object", "from", "the", "resource", "queue", ".", "If", "'", "xtra", "'", "is", "not", "NULL", "copy", "data", "into", "request", "cache", "element", "otherwise", "zero", "the", "field", ".", "Returns", "pointer", "to", "the", "request", "component", "of", "the", "cache", "element", ".", "\\", "param", "[", "in", "]", "xtra", "Optional", "pointer", "to", "additional", "info", "to", "save", "\\", "param", "[", "out", "]", "info", "Optional", "pointer", "to", "private", "msg", "info", "to", "use", "\\", "return", "Pointer", "to", "DCMF", "request", "object" ]
DCMF_Request_t *MPIDU_get_req(MPIDU_Onesided_xtra_t *xtra, MPIDU_Onesided_info_t **info) { struct mpid_rqc_entry *rqe; rqe = MPIDU_get_element(&rqc); MPID_assert_debug(rqe != NULL); if (xtra) { rqe->xtra = *xtra; } else { memset(&rqe->xtra, 0, sizeof(rqe->xtra)); } if (info) { *info = &rqe->info; } return &rqe->req; }
[ "DCMF_Request_t", "*", "MPIDU_get_req", "(", "MPIDU_Onesided_xtra_t", "*", "xtra", ",", "MPIDU_Onesided_info_t", "*", "*", "info", ")", "{", "struct", "mpid_rqc_entry", "*", "rqe", ";", "rqe", "=", "MPIDU_get_element", "(", "&", "rqc", ")", ";", "MPID_assert_debug", "(", "rqe", "!=", "NULL", ")", ";", "if", "(", "xtra", ")", "{", "rqe", "->", "xtra", "=", "*", "xtra", ";", "}", "else", "{", "memset", "(", "&", "rqe", "->", "xtra", ",", "0", ",", "sizeof", "(", "rqe", "->", "xtra", ")", ")", ";", "}", "if", "(", "info", ")", "{", "*", "info", "=", "&", "rqe", "->", "info", ";", "}", "return", "&", "rqe", "->", "req", ";", "}" ]
\brief Get a new request object from the resource queue.
[ "\\", "brief", "Get", "a", "new", "request", "object", "from", "the", "resource", "queue", "." ]
[ "// This assert is not relavent for non-BG and not needed for BG.", "// MPID_assert_debug((((unsigned)&rqe->req) & 0x0f) == 0);" ]
[ { "param": "xtra", "type": "MPIDU_Onesided_xtra_t" }, { "param": "info", "type": "MPIDU_Onesided_info_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "xtra", "type": "MPIDU_Onesided_xtra_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "info", "type": "MPIDU_Onesided_info_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_free_req
void
void MPIDU_free_req(DCMF_Request_t *req, MPIDU_Onesided_xtra_t *xtra) { struct mpid_rqc_entry *rqe; struct mpid_element *pp = NULL; rqe = (struct mpid_rqc_entry *)MPIDU_find_element(&rqc, mpid_match_rq, NULL, req, &pp); MPID_assert_debug(rqe != NULL); if (xtra) { *xtra = rqe->xtra; } MPIDU_free_element(&rqc, rqe, pp); }
/** * \brief Release a DCMF request object and retrieve info * * Locate the request object in the request cache and free it. * If 'xtra' is not NULL, copy piggy-back data into 'bgp'. * Assumes request object was returned by a call to MPIDU_get_req(). * * \param[in] req Pointer to DCMF request object being released * \param[out] xtra Optional pointer to receive saved additional info * \return nothing * * \ref rqcache_design */
\brief Release a DCMF request object and retrieve info Locate the request object in the request cache and free it. If 'xtra' is not NULL, copy piggy-back data into 'bgp'. Assumes request object was returned by a call to MPIDU_get_req(). \param[in] req Pointer to DCMF request object being released \param[out] xtra Optional pointer to receive saved additional info \return nothing
[ "\\", "brief", "Release", "a", "DCMF", "request", "object", "and", "retrieve", "info", "Locate", "the", "request", "object", "in", "the", "request", "cache", "and", "free", "it", ".", "If", "'", "xtra", "'", "is", "not", "NULL", "copy", "piggy", "-", "back", "data", "into", "'", "bgp", "'", ".", "Assumes", "request", "object", "was", "returned", "by", "a", "call", "to", "MPIDU_get_req", "()", ".", "\\", "param", "[", "in", "]", "req", "Pointer", "to", "DCMF", "request", "object", "being", "released", "\\", "param", "[", "out", "]", "xtra", "Optional", "pointer", "to", "receive", "saved", "additional", "info", "\\", "return", "nothing" ]
void MPIDU_free_req(DCMF_Request_t *req, MPIDU_Onesided_xtra_t *xtra) { struct mpid_rqc_entry *rqe; struct mpid_element *pp = NULL; rqe = (struct mpid_rqc_entry *)MPIDU_find_element(&rqc, mpid_match_rq, NULL, req, &pp); MPID_assert_debug(rqe != NULL); if (xtra) { *xtra = rqe->xtra; } MPIDU_free_element(&rqc, rqe, pp); }
[ "void", "MPIDU_free_req", "(", "DCMF_Request_t", "*", "req", ",", "MPIDU_Onesided_xtra_t", "*", "xtra", ")", "{", "struct", "mpid_rqc_entry", "*", "rqe", ";", "struct", "mpid_element", "*", "pp", "=", "NULL", ";", "rqe", "=", "(", "struct", "mpid_rqc_entry", "*", ")", "MPIDU_find_element", "(", "&", "rqc", ",", "mpid_match_rq", ",", "NULL", ",", "req", ",", "&", "pp", ")", ";", "MPID_assert_debug", "(", "rqe", "!=", "NULL", ")", ";", "if", "(", "xtra", ")", "{", "*", "xtra", "=", "rqe", "->", "xtra", ";", "}", "MPIDU_free_element", "(", "&", "rqc", ",", "rqe", ",", "pp", ")", ";", "}" ]
\brief Release a DCMF request object and retrieve info Locate the request object in the request cache and free it.
[ "\\", "brief", "Release", "a", "DCMF", "request", "object", "and", "retrieve", "info", "Locate", "the", "request", "object", "in", "the", "request", "cache", "and", "free", "it", "." ]
[]
[ { "param": "req", "type": "DCMF_Request_t" }, { "param": "xtra", "type": "MPIDU_Onesided_xtra_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "req", "type": "DCMF_Request_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "xtra", "type": "MPIDU_Onesided_xtra_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
done_getfree_rqc_cb
void
void done_getfree_rqc_cb(void *v, DCMF_Error_t *e) { volatile unsigned *pending; volatile struct mpid_get_cb_data *get; MPIDU_Onesided_xtra_t xtra; MPIDU_free_req((DCMF_Request_t *)v, &xtra); pending = (volatile unsigned *)xtra.mpid_xtra_w0; get = (volatile struct mpid_get_cb_data *)xtra.mpid_xtra_w1; if (pending) { --(*pending); } MPID_assert_debug(get != NULL); if (--get->ref == 0) { if (get->dtp) { MPID_Segment segment; DLOOP_Offset last; int mpi_errno = MPID_Segment_init(get->addr, get->count, get->dtp->handle, &segment, 0); MPID_assert_debug(mpi_errno == MPI_SUCCESS); last = get->len; MPID_Segment_unpack(&segment, 0, &last, get->buf); MPID_assert_debug(last == get->len); MPID_Datatype_release(get->dtp); } DCMF_Memregion_destroy((DCMF_Memregion_t *)&get->memreg); if (xtra.mpid_xtra_w2) { MPIDU_FREE(xtra.mpid_xtra_w2, e, "xtra.mpid_xtra_w2"); } if (xtra.mpid_xtra_w3) { MPIDU_FREE(xtra.mpid_xtra_w3, e, "xtra.mpid_xtra_w3"); } } }
/** * \brief request cache done callback for Get, with counter decr, * ref count, buffer freeing and dt release when ref count reaches zero. * Also uses dt to unpack results into application buffer. * * Callback for decrementing a "done" or pending count and * freeing malloc() memory, up to two pointers, when ref count goes 0. * * To use this callback, the "xtra" info (DCQuad) must * be filled as follows: * * - \e w0 - (int *) pending counter * - \e w1 - (int *) get struct * - \e w2 - (void *) allocated memory if not NULL * - \e w3 - (void *) allocated memory if not NULL * * \param[in] v Pointer to DCMF request object * \return nothing * * \ref rqcache_design */
\brief request cache done callback for Get, with counter decr, ref count, buffer freeing and dt release when ref count reaches zero. Also uses dt to unpack results into application buffer. Callback for decrementing a "done" or pending count and freeing malloc() memory, up to two pointers, when ref count goes 0. To use this callback, the "xtra" info (DCQuad) must be filled as follows. \param[in] v Pointer to DCMF request object \return nothing
[ "\\", "brief", "request", "cache", "done", "callback", "for", "Get", "with", "counter", "decr", "ref", "count", "buffer", "freeing", "and", "dt", "release", "when", "ref", "count", "reaches", "zero", ".", "Also", "uses", "dt", "to", "unpack", "results", "into", "application", "buffer", ".", "Callback", "for", "decrementing", "a", "\"", "done", "\"", "or", "pending", "count", "and", "freeing", "malloc", "()", "memory", "up", "to", "two", "pointers", "when", "ref", "count", "goes", "0", ".", "To", "use", "this", "callback", "the", "\"", "xtra", "\"", "info", "(", "DCQuad", ")", "must", "be", "filled", "as", "follows", ".", "\\", "param", "[", "in", "]", "v", "Pointer", "to", "DCMF", "request", "object", "\\", "return", "nothing" ]
void done_getfree_rqc_cb(void *v, DCMF_Error_t *e) { volatile unsigned *pending; volatile struct mpid_get_cb_data *get; MPIDU_Onesided_xtra_t xtra; MPIDU_free_req((DCMF_Request_t *)v, &xtra); pending = (volatile unsigned *)xtra.mpid_xtra_w0; get = (volatile struct mpid_get_cb_data *)xtra.mpid_xtra_w1; if (pending) { --(*pending); } MPID_assert_debug(get != NULL); if (--get->ref == 0) { if (get->dtp) { MPID_Segment segment; DLOOP_Offset last; int mpi_errno = MPID_Segment_init(get->addr, get->count, get->dtp->handle, &segment, 0); MPID_assert_debug(mpi_errno == MPI_SUCCESS); last = get->len; MPID_Segment_unpack(&segment, 0, &last, get->buf); MPID_assert_debug(last == get->len); MPID_Datatype_release(get->dtp); } DCMF_Memregion_destroy((DCMF_Memregion_t *)&get->memreg); if (xtra.mpid_xtra_w2) { MPIDU_FREE(xtra.mpid_xtra_w2, e, "xtra.mpid_xtra_w2"); } if (xtra.mpid_xtra_w3) { MPIDU_FREE(xtra.mpid_xtra_w3, e, "xtra.mpid_xtra_w3"); } } }
[ "void", "done_getfree_rqc_cb", "(", "void", "*", "v", ",", "DCMF_Error_t", "*", "e", ")", "{", "volatile", "unsigned", "*", "pending", ";", "volatile", "struct", "mpid_get_cb_data", "*", "get", ";", "MPIDU_Onesided_xtra_t", "xtra", ";", "MPIDU_free_req", "(", "(", "DCMF_Request_t", "*", ")", "v", ",", "&", "xtra", ")", ";", "pending", "=", "(", "volatile", "unsigned", "*", ")", "xtra", ".", "mpid_xtra_w0", ";", "get", "=", "(", "volatile", "struct", "mpid_get_cb_data", "*", ")", "xtra", ".", "mpid_xtra_w1", ";", "if", "(", "pending", ")", "{", "--", "(", "*", "pending", ")", ";", "}", "MPID_assert_debug", "(", "get", "!=", "NULL", ")", ";", "if", "(", "--", "get", "->", "ref", "==", "0", ")", "{", "if", "(", "get", "->", "dtp", ")", "{", "MPID_Segment", "segment", ";", "DLOOP_Offset", "last", ";", "int", "mpi_errno", "=", "MPID_Segment_init", "(", "get", "->", "addr", ",", "get", "->", "count", ",", "get", "->", "dtp", "->", "handle", ",", "&", "segment", ",", "0", ")", ";", "MPID_assert_debug", "(", "mpi_errno", "==", "MPI_SUCCESS", ")", ";", "last", "=", "get", "->", "len", ";", "MPID_Segment_unpack", "(", "&", "segment", ",", "0", ",", "&", "last", ",", "get", "->", "buf", ")", ";", "MPID_assert_debug", "(", "last", "==", "get", "->", "len", ")", ";", "MPID_Datatype_release", "(", "get", "->", "dtp", ")", ";", "}", "DCMF_Memregion_destroy", "(", "(", "DCMF_Memregion_t", "*", ")", "&", "get", "->", "memreg", ")", ";", "if", "(", "xtra", ".", "mpid_xtra_w2", ")", "{", "MPIDU_FREE", "(", "xtra", ".", "mpid_xtra_w2", ",", "e", ",", "\"", "\"", ")", ";", "}", "if", "(", "xtra", ".", "mpid_xtra_w3", ")", "{", "MPIDU_FREE", "(", "xtra", ".", "mpid_xtra_w3", ",", "e", ",", "\"", "\"", ")", ";", "}", "}", "}" ]
\brief request cache done callback for Get, with counter decr, ref count, buffer freeing and dt release when ref count reaches zero.
[ "\\", "brief", "request", "cache", "done", "callback", "for", "Get", "with", "counter", "decr", "ref", "count", "buffer", "freeing", "and", "dt", "release", "when", "ref", "count", "reaches", "zero", "." ]
[]
[ { "param": "v", "type": "void" }, { "param": "e", "type": "DCMF_Error_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "e", "type": "DCMF_Error_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
dtc1_rqc_cb
void
void dtc1_rqc_cb(void *v, DCMF_Error_t *e) { MPIDU_Onesided_xtra_t xtra; MPIDU_free_req((DCMF_Request_t *)v, &xtra); MPID_Recvdone1_rem_dt(&xtra); }
/** * \brief receive callback for datatype cache messages (map and iov) * * \param[in] v Pointer to request object used for transfer * \return nothing */
\brief receive callback for datatype cache messages (map and iov) \param[in] v Pointer to request object used for transfer \return nothing
[ "\\", "brief", "receive", "callback", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "\\", "param", "[", "in", "]", "v", "Pointer", "to", "request", "object", "used", "for", "transfer", "\\", "return", "nothing" ]
void dtc1_rqc_cb(void *v, DCMF_Error_t *e) { MPIDU_Onesided_xtra_t xtra; MPIDU_free_req((DCMF_Request_t *)v, &xtra); MPID_Recvdone1_rem_dt(&xtra); }
[ "void", "dtc1_rqc_cb", "(", "void", "*", "v", ",", "DCMF_Error_t", "*", "e", ")", "{", "MPIDU_Onesided_xtra_t", "xtra", ";", "MPIDU_free_req", "(", "(", "DCMF_Request_t", "*", ")", "v", ",", "&", "xtra", ")", ";", "MPID_Recvdone1_rem_dt", "(", "&", "xtra", ")", ";", "}" ]
\brief receive callback for datatype cache messages (map and iov) \param[in] v Pointer to request object used for transfer \return nothing
[ "\\", "brief", "receive", "callback", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "\\", "param", "[", "in", "]", "v", "Pointer", "to", "request", "object", "used", "for", "transfer", "\\", "return", "nothing" ]
[]
[ { "param": "v", "type": "void" }, { "param": "e", "type": "DCMF_Error_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "e", "type": "DCMF_Error_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
dtc2_rqc_cb
void
static void dtc2_rqc_cb(void *v, DCMF_Error_t *e) { MPIDU_Onesided_xtra_t xtra; MPIDU_free_req((DCMF_Request_t *)v, &xtra); mpid_recvdone2_rem_dt(&xtra); }
/** * \brief receive callback for datatype cache messages (map and iov) * * \param[in] v Pointer to request object used for transfer * \return nothing */
\brief receive callback for datatype cache messages (map and iov) \param[in] v Pointer to request object used for transfer \return nothing
[ "\\", "brief", "receive", "callback", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "\\", "param", "[", "in", "]", "v", "Pointer", "to", "request", "object", "used", "for", "transfer", "\\", "return", "nothing" ]
static void dtc2_rqc_cb(void *v, DCMF_Error_t *e) { MPIDU_Onesided_xtra_t xtra; MPIDU_free_req((DCMF_Request_t *)v, &xtra); mpid_recvdone2_rem_dt(&xtra); }
[ "static", "void", "dtc2_rqc_cb", "(", "void", "*", "v", ",", "DCMF_Error_t", "*", "e", ")", "{", "MPIDU_Onesided_xtra_t", "xtra", ";", "MPIDU_free_req", "(", "(", "DCMF_Request_t", "*", ")", "v", ",", "&", "xtra", ")", ";", "mpid_recvdone2_rem_dt", "(", "&", "xtra", ")", ";", "}" ]
\brief receive callback for datatype cache messages (map and iov) \param[in] v Pointer to request object used for transfer \return nothing
[ "\\", "brief", "receive", "callback", "for", "datatype", "cache", "messages", "(", "map", "and", "iov", ")", "\\", "param", "[", "in", "]", "v", "Pointer", "to", "request", "object", "used", "for", "transfer", "\\", "return", "nothing" ]
[]
[ { "param": "v", "type": "void" }, { "param": "e", "type": "DCMF_Error_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "e", "type": "DCMF_Error_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_proto_send
int
int MPIDU_proto_send(MPID_Win *win, MPID_Group *grp, int type) { int lpid, x; MPIDU_Onesided_ctl_t ctl; int size, comm_size = 0, comm_rank; int mpi_errno = MPI_SUCCESS; MPID_VCR *vc; DCMF_Consistency consistency = win->_dev.my_cstcy; /* * \todo Confirm this: * For inter-comms, we only talk to the remote nodes. For * intra-comms there are no remote or local nodes. * So, we always use win->_dev.comm_ptr->vcr (?) * However, we have to choose remote_size, in the case of * inter-comms, vs. local_size. This decision also * affects MPIDU_world_rank_c(). */ size = MPIDU_comm_size(win); vc = MPIDU_world_vcr(win); MPID_assert_debug(vc != NULL && size > 0); if (grp) { comm_size = size; size = grp->size; } /** \todo is it OK to lower consistency here? */ consistency = DCMF_RELAXED_CONSISTENCY; ctl.mpid_ctl_w0 = type; ctl.mpid_ctl_w2 = win->_dev.comm_ptr->rank; for (x = 0; x < size; ++x) { if (grp) { int z; lpid = grp->lrank_to_lpid[x].lpid; /* convert group rank to comm rank */ for (z = 0; z < comm_size && lpid != vc[z]; ++z); MPID_assert_debug(z < comm_size); comm_rank = z; } else { lpid = vc[x]; comm_rank = x; } ctl.mpid_ctl_w1 = win->_dev.coll_info[comm_rank].win_handle; if (type == MPID_MSGTYPE_COMPLETE) { ctl.mpid_ctl_w3 = win->_dev.coll_info[comm_rank].rma_sends; win->_dev.coll_info[comm_rank].rma_sends = 0; } if (lpid == mpid_my_lpid) { if (type == MPID_MSGTYPE_POST) { ++win->_dev.my_sync_begin; } else if (type == MPID_MSGTYPE_COMPLETE) { ++win->_dev.my_sync_done; } } else { mpi_errno = DCMF_Control(&bg1s_ct_proto, consistency, lpid, &ctl.ctl); if (mpi_errno) { break; } } } return mpi_errno; }
/** * \brief Send (spray) a protocol message to a group of nodes. * * Send a protocol message to all members of a group (or the * window-comm if no group). * * Currently, this routine will only be called once per group * (i.e. once during an exposure or access epoch). If it ends * up being called more than once, it might make sense to build * a translation table between the group rank and the window * communicator rank. Or if we can determine that the same * group is being used in multiple, successive, epochs. In practice, * it takes more work to build a translation table than to lookup * ranks ad-hoc. * * \param[in] win Pointer to MPID_Win object * \param[in] grp Optional pointer to MPID_Group object * \param[in] type Type of message (MPID_MSGTYPE_*) * \return MPI_SUCCESS or error returned from DCMF_Send. * * \ref msginfo_usage */
\brief Send (spray) a protocol message to a group of nodes. Send a protocol message to all members of a group (or the window-comm if no group). Currently, this routine will only be called once per group . If it ends up being called more than once, it might make sense to build a translation table between the group rank and the window communicator rank. Or if we can determine that the same group is being used in multiple, successive, epochs. In practice, it takes more work to build a translation table than to lookup ranks ad-hoc. \param[in] win Pointer to MPID_Win object \param[in] grp Optional pointer to MPID_Group object \param[in] type Type of message (MPID_MSGTYPE_*) \return MPI_SUCCESS or error returned from DCMF_Send.
[ "\\", "brief", "Send", "(", "spray", ")", "a", "protocol", "message", "to", "a", "group", "of", "nodes", ".", "Send", "a", "protocol", "message", "to", "all", "members", "of", "a", "group", "(", "or", "the", "window", "-", "comm", "if", "no", "group", ")", ".", "Currently", "this", "routine", "will", "only", "be", "called", "once", "per", "group", ".", "If", "it", "ends", "up", "being", "called", "more", "than", "once", "it", "might", "make", "sense", "to", "build", "a", "translation", "table", "between", "the", "group", "rank", "and", "the", "window", "communicator", "rank", ".", "Or", "if", "we", "can", "determine", "that", "the", "same", "group", "is", "being", "used", "in", "multiple", "successive", "epochs", ".", "In", "practice", "it", "takes", "more", "work", "to", "build", "a", "translation", "table", "than", "to", "lookup", "ranks", "ad", "-", "hoc", ".", "\\", "param", "[", "in", "]", "win", "Pointer", "to", "MPID_Win", "object", "\\", "param", "[", "in", "]", "grp", "Optional", "pointer", "to", "MPID_Group", "object", "\\", "param", "[", "in", "]", "type", "Type", "of", "message", "(", "MPID_MSGTYPE_", "*", ")", "\\", "return", "MPI_SUCCESS", "or", "error", "returned", "from", "DCMF_Send", "." ]
int MPIDU_proto_send(MPID_Win *win, MPID_Group *grp, int type) { int lpid, x; MPIDU_Onesided_ctl_t ctl; int size, comm_size = 0, comm_rank; int mpi_errno = MPI_SUCCESS; MPID_VCR *vc; DCMF_Consistency consistency = win->_dev.my_cstcy; size = MPIDU_comm_size(win); vc = MPIDU_world_vcr(win); MPID_assert_debug(vc != NULL && size > 0); if (grp) { comm_size = size; size = grp->size; } consistency = DCMF_RELAXED_CONSISTENCY; ctl.mpid_ctl_w0 = type; ctl.mpid_ctl_w2 = win->_dev.comm_ptr->rank; for (x = 0; x < size; ++x) { if (grp) { int z; lpid = grp->lrank_to_lpid[x].lpid; for (z = 0; z < comm_size && lpid != vc[z]; ++z); MPID_assert_debug(z < comm_size); comm_rank = z; } else { lpid = vc[x]; comm_rank = x; } ctl.mpid_ctl_w1 = win->_dev.coll_info[comm_rank].win_handle; if (type == MPID_MSGTYPE_COMPLETE) { ctl.mpid_ctl_w3 = win->_dev.coll_info[comm_rank].rma_sends; win->_dev.coll_info[comm_rank].rma_sends = 0; } if (lpid == mpid_my_lpid) { if (type == MPID_MSGTYPE_POST) { ++win->_dev.my_sync_begin; } else if (type == MPID_MSGTYPE_COMPLETE) { ++win->_dev.my_sync_done; } } else { mpi_errno = DCMF_Control(&bg1s_ct_proto, consistency, lpid, &ctl.ctl); if (mpi_errno) { break; } } } return mpi_errno; }
[ "int", "MPIDU_proto_send", "(", "MPID_Win", "*", "win", ",", "MPID_Group", "*", "grp", ",", "int", "type", ")", "{", "int", "lpid", ",", "x", ";", "MPIDU_Onesided_ctl_t", "ctl", ";", "int", "size", ",", "comm_size", "=", "0", ",", "comm_rank", ";", "int", "mpi_errno", "=", "MPI_SUCCESS", ";", "MPID_VCR", "*", "vc", ";", "DCMF_Consistency", "consistency", "=", "win", "->", "_dev", ".", "my_cstcy", ";", "size", "=", "MPIDU_comm_size", "(", "win", ")", ";", "vc", "=", "MPIDU_world_vcr", "(", "win", ")", ";", "MPID_assert_debug", "(", "vc", "!=", "NULL", "&&", "size", ">", "0", ")", ";", "if", "(", "grp", ")", "{", "comm_size", "=", "size", ";", "size", "=", "grp", "->", "size", ";", "}", "consistency", "=", "DCMF_RELAXED_CONSISTENCY", ";", "ctl", ".", "mpid_ctl_w0", "=", "type", ";", "ctl", ".", "mpid_ctl_w2", "=", "win", "->", "_dev", ".", "comm_ptr", "->", "rank", ";", "for", "(", "x", "=", "0", ";", "x", "<", "size", ";", "++", "x", ")", "{", "if", "(", "grp", ")", "{", "int", "z", ";", "lpid", "=", "grp", "->", "lrank_to_lpid", "[", "x", "]", ".", "lpid", ";", "for", "(", "z", "=", "0", ";", "z", "<", "comm_size", "&&", "lpid", "!=", "vc", "[", "z", "]", ";", "++", "z", ")", ";", "MPID_assert_debug", "(", "z", "<", "comm_size", ")", ";", "comm_rank", "=", "z", ";", "}", "else", "{", "lpid", "=", "vc", "[", "x", "]", ";", "comm_rank", "=", "x", ";", "}", "ctl", ".", "mpid_ctl_w1", "=", "win", "->", "_dev", ".", "coll_info", "[", "comm_rank", "]", ".", "win_handle", ";", "if", "(", "type", "==", "MPID_MSGTYPE_COMPLETE", ")", "{", "ctl", ".", "mpid_ctl_w3", "=", "win", "->", "_dev", ".", "coll_info", "[", "comm_rank", "]", ".", "rma_sends", ";", "win", "->", "_dev", ".", "coll_info", "[", "comm_rank", "]", ".", "rma_sends", "=", "0", ";", "}", "if", "(", "lpid", "==", "mpid_my_lpid", ")", "{", "if", "(", "type", "==", "MPID_MSGTYPE_POST", ")", "{", "++", "win", "->", "_dev", ".", "my_sync_begin", ";", "}", "else", "if", "(", "type", "==", "MPID_MSGTYPE_COMPLETE", ")", "{", "++", "win", "->", "_dev", ".", "my_sync_done", ";", "}", "}", "else", "{", "mpi_errno", "=", "DCMF_Control", "(", "&", "bg1s_ct_proto", ",", "consistency", ",", "lpid", ",", "&", "ctl", ".", "ctl", ")", ";", "if", "(", "mpi_errno", ")", "{", "break", ";", "}", "}", "}", "return", "mpi_errno", ";", "}" ]
\brief Send (spray) a protocol message to a group of nodes.
[ "\\", "brief", "Send", "(", "spray", ")", "a", "protocol", "message", "to", "a", "group", "of", "nodes", "." ]
[ "/*\n * \\todo Confirm this:\n * For inter-comms, we only talk to the remote nodes. For\n * intra-comms there are no remote or local nodes.\n * So, we always use win->_dev.comm_ptr->vcr (?)\n * However, we have to choose remote_size, in the case of\n * inter-comms, vs. local_size. This decision also\n * affects MPIDU_world_rank_c().\n */", "/** \\todo is it OK to lower consistency here? */", "/* convert group rank to comm rank */" ]
[ { "param": "win", "type": "MPID_Win" }, { "param": "grp", "type": "MPID_Group" }, { "param": "type", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "MPID_Win", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "grp", "type": "MPID_Group", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_valid_group_rank
int
int MPIDU_valid_group_rank(int lpid, MPID_Group *grp) { int size = grp->size; int z; for (z = 0; z < size && lpid != grp->lrank_to_lpid[z].lpid; ++z); return (z < size); }
/** * \brief validate whether a lpid is in a given group * * Searches the group lpid list for a match. * * \param[in] lpid World rank of the node in question * \param[in] grp Group to validate against * \return TRUE is lpid is in group */
\brief validate whether a lpid is in a given group Searches the group lpid list for a match. \param[in] lpid World rank of the node in question \param[in] grp Group to validate against \return TRUE is lpid is in group
[ "\\", "brief", "validate", "whether", "a", "lpid", "is", "in", "a", "given", "group", "Searches", "the", "group", "lpid", "list", "for", "a", "match", ".", "\\", "param", "[", "in", "]", "lpid", "World", "rank", "of", "the", "node", "in", "question", "\\", "param", "[", "in", "]", "grp", "Group", "to", "validate", "against", "\\", "return", "TRUE", "is", "lpid", "is", "in", "group" ]
int MPIDU_valid_group_rank(int lpid, MPID_Group *grp) { int size = grp->size; int z; for (z = 0; z < size && lpid != grp->lrank_to_lpid[z].lpid; ++z); return (z < size); }
[ "int", "MPIDU_valid_group_rank", "(", "int", "lpid", ",", "MPID_Group", "*", "grp", ")", "{", "int", "size", "=", "grp", "->", "size", ";", "int", "z", ";", "for", "(", "z", "=", "0", ";", "z", "<", "size", "&&", "lpid", "!=", "grp", "->", "lrank_to_lpid", "[", "z", "]", ".", "lpid", ";", "++", "z", ")", ";", "return", "(", "z", "<", "size", ")", ";", "}" ]
\brief validate whether a lpid is in a given group Searches the group lpid list for a match.
[ "\\", "brief", "validate", "whether", "a", "lpid", "is", "in", "a", "given", "group", "Searches", "the", "group", "lpid", "list", "for", "a", "match", "." ]
[]
[ { "param": "lpid", "type": "int" }, { "param": "grp", "type": "MPID_Group" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lpid", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "grp", "type": "MPID_Group", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
recv_sm_cb
void
void recv_sm_cb(void *cd, const DCQuad *_mi, unsigned ct, size_t or, const char *sb, const size_t sl) { MPID_Win *win; char *rb; MPIDU_Onesided_ctl_t *mc = (MPIDU_Onesided_ctl_t *)_mi; MPIDU_Onesided_info_t *mi = (MPIDU_Onesided_info_t *)_mi; // assert(mc->mpid_ctl_w0 == mi->mpid_info_w0); switch (mc->mpid_ctl_w0) { /* The following all use msginfo as DCMF_Control_t (DCQuad[1]) */ case MPID_MSGTYPE_COMPLETE: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); MPID_assert_debug(sl == 0); MPID_Win_get_ptr((MPI_Win)mc->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); win->_dev.coll_info[win->_dev.comm_ptr->rank].rma_sends += mc->mpid_ctl_w3; ++win->_dev.my_sync_done; break; case MPID_MSGTYPE_POST: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); MPID_assert_debug(sl == 0); MPID_Win_get_ptr((MPI_Win)mc->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); ++win->_dev.my_sync_begin; break; case MPID_MSGTYPE_LOCK: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); lock_cb(mc, or); break; case MPID_MSGTYPE_UNLOCK: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); unlk_cb(mc, or); break; case MPID_MSGTYPE_LOCKACK: case MPID_MSGTYPE_UNLOCKACK: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); MPID_Win_get_ptr((MPI_Win)mc->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); ++win->_dev.my_sync_done; break; /* The following all use msginfo as DCQuad[2] */ case MPID_MSGTYPE_PUT: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { /** \todo exact error handling */ } #ifdef USE_DCMF_PUT /* In this case, the message is a completion notification */ rma_recvs_cb(win, mi->mpid_info_w2, or, mi->mpid_info_w3); #else /* ! USE_DCMF_PUT */ MPID_assert_debug(sl != 0); memcpy((char *)mi->mpid_info_w3, sb, sl); rma_recvs_cb(win, mi->mpid_info_w2, or, 1); #endif /* ! USE_DCMF_PUT */ break; case MPID_MSGTYPE_DT_MAP: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); rb = MPID_Prepare_rem_dt(mi); if (rb) { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w0; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = mi->mpid_info_w3; memcpy(rb, sb, sl); MPID_Recvdone1_rem_dt(&xtra); } break; case MPID_MSGTYPE_DT_IOV: #ifdef NOT_USED MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); rb = mpid_update_rem_dt(mi->mpid_info_w2, mi->mpid_info_w3, mi->mpid_info_w1); if (rb) { memcpy(rb, sb, sl); mpid_recvdone2_rem_dt(_mi); } break; #endif /* NOT_USED */ MPID_abort(); case MPID_MSGTYPE_ACC: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { /** \todo exact error handling */ } target_accumulate(mi, sb, or); break; /* Not supported message types */ case MPID_MSGTYPE_GET: /* GET can't generate these */ MPID_abort(); default: /* * Don't know what to do with this... we have some data * (possibly) but don't have a target address to copy it * to (or know what else to do with it). */ break; } }
/** * \brief Receive callback for RMA protocol and operations messages * * "Small" message callback - the entire message is already here. * Process it now and return. * * \param[in] _mi Pointer to msginfo * \param[in] ct Number of DCQuad's in msginfo * \param[in] or Rank of origin * \param[in] sb Pointer to send buffer (data received) * \param[in] sl Length (bytes) of data * \return nothing * * \ref msginfo_usage */
\brief Receive callback for RMA protocol and operations messages "Small" message callback - the entire message is already here. Process it now and return.
[ "\\", "brief", "Receive", "callback", "for", "RMA", "protocol", "and", "operations", "messages", "\"", "Small", "\"", "message", "callback", "-", "the", "entire", "message", "is", "already", "here", ".", "Process", "it", "now", "and", "return", "." ]
void recv_sm_cb(void *cd, const DCQuad *_mi, unsigned ct, size_t or, const char *sb, const size_t sl) { MPID_Win *win; char *rb; MPIDU_Onesided_ctl_t *mc = (MPIDU_Onesided_ctl_t *)_mi; MPIDU_Onesided_info_t *mi = (MPIDU_Onesided_info_t *)_mi; switch (mc->mpid_ctl_w0) { case MPID_MSGTYPE_COMPLETE: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); MPID_assert_debug(sl == 0); MPID_Win_get_ptr((MPI_Win)mc->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); win->_dev.coll_info[win->_dev.comm_ptr->rank].rma_sends += mc->mpid_ctl_w3; ++win->_dev.my_sync_done; break; case MPID_MSGTYPE_POST: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); MPID_assert_debug(sl == 0); MPID_Win_get_ptr((MPI_Win)mc->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); ++win->_dev.my_sync_begin; break; case MPID_MSGTYPE_LOCK: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); lock_cb(mc, or); break; case MPID_MSGTYPE_UNLOCK: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); unlk_cb(mc, or); break; case MPID_MSGTYPE_LOCKACK: case MPID_MSGTYPE_UNLOCKACK: MPID_assert_debug(ct == MPIDU_1SCTL_NQUADS); MPID_Win_get_ptr((MPI_Win)mc->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); ++win->_dev.my_sync_done; break; case MPID_MSGTYPE_PUT: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { } #ifdef USE_DCMF_PUT rma_recvs_cb(win, mi->mpid_info_w2, or, mi->mpid_info_w3); #else MPID_assert_debug(sl != 0); memcpy((char *)mi->mpid_info_w3, sb, sl); rma_recvs_cb(win, mi->mpid_info_w2, or, 1); #endif break; case MPID_MSGTYPE_DT_MAP: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); rb = MPID_Prepare_rem_dt(mi); if (rb) { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w0; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = mi->mpid_info_w3; memcpy(rb, sb, sl); MPID_Recvdone1_rem_dt(&xtra); } break; case MPID_MSGTYPE_DT_IOV: #ifdef NOT_USED MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); rb = mpid_update_rem_dt(mi->mpid_info_w2, mi->mpid_info_w3, mi->mpid_info_w1); if (rb) { memcpy(rb, sb, sl); mpid_recvdone2_rem_dt(_mi); } break; #endif MPID_abort(); case MPID_MSGTYPE_ACC: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { } target_accumulate(mi, sb, or); break; case MPID_MSGTYPE_GET: MPID_abort(); default: break; } }
[ "void", "recv_sm_cb", "(", "void", "*", "cd", ",", "const", "DCQuad", "*", "_mi", ",", "unsigned", "ct", ",", "size_t", "or", ",", "const", "char", "*", "sb", ",", "const", "size_t", "sl", ")", "{", "MPID_Win", "*", "win", ";", "char", "*", "rb", ";", "MPIDU_Onesided_ctl_t", "*", "mc", "=", "(", "MPIDU_Onesided_ctl_t", "*", ")", "_mi", ";", "MPIDU_Onesided_info_t", "*", "mi", "=", "(", "MPIDU_Onesided_info_t", "*", ")", "_mi", ";", "switch", "(", "mc", "->", "mpid_ctl_w0", ")", "{", "case", "MPID_MSGTYPE_COMPLETE", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SCTL_NQUADS", ")", ";", "MPID_assert_debug", "(", "sl", "==", "0", ")", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "mc", "->", "mpid_ctl_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "win", "->", "_dev", ".", "coll_info", "[", "win", "->", "_dev", ".", "comm_ptr", "->", "rank", "]", ".", "rma_sends", "+=", "mc", "->", "mpid_ctl_w3", ";", "++", "win", "->", "_dev", ".", "my_sync_done", ";", "break", ";", "case", "MPID_MSGTYPE_POST", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SCTL_NQUADS", ")", ";", "MPID_assert_debug", "(", "sl", "==", "0", ")", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "mc", "->", "mpid_ctl_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "++", "win", "->", "_dev", ".", "my_sync_begin", ";", "break", ";", "case", "MPID_MSGTYPE_LOCK", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SCTL_NQUADS", ")", ";", "lock_cb", "(", "mc", ",", "or", ")", ";", "break", ";", "case", "MPID_MSGTYPE_UNLOCK", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SCTL_NQUADS", ")", ";", "unlk_cb", "(", "mc", ",", "or", ")", ";", "break", ";", "case", "MPID_MSGTYPE_LOCKACK", ":", "case", "MPID_MSGTYPE_UNLOCKACK", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SCTL_NQUADS", ")", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "mc", "->", "mpid_ctl_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "++", "win", "->", "_dev", ".", "my_sync_done", ";", "break", ";", "case", "MPID_MSGTYPE_PUT", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "mi", "->", "mpid_info_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "MPIDU_assert_PUTOK", "(", "win", ")", ";", "if", "(", "win", "->", "_dev", ".", "epoch_assert", "&", "MPI_MODE_NOPUT", ")", "{", "}", "#ifdef", "USE_DCMF_PUT", "rma_recvs_cb", "(", "win", ",", "mi", "->", "mpid_info_w2", ",", "or", ",", "mi", "->", "mpid_info_w3", ")", ";", "#else", "MPID_assert_debug", "(", "sl", "!=", "0", ")", ";", "memcpy", "(", "(", "char", "*", ")", "mi", "->", "mpid_info_w3", ",", "sb", ",", "sl", ")", ";", "rma_recvs_cb", "(", "win", ",", "mi", "->", "mpid_info_w2", ",", "or", ",", "1", ")", ";", "#endif", "break", ";", "case", "MPID_MSGTYPE_DT_MAP", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "rb", "=", "MPID_Prepare_rem_dt", "(", "mi", ")", ";", "if", "(", "rb", ")", "{", "MPIDU_Onesided_xtra_t", "xtra", ";", "xtra", ".", "mpid_xtra_w0", "=", "mi", "->", "mpid_info_w0", ";", "xtra", ".", "mpid_xtra_w1", "=", "mi", "->", "mpid_info_w1", ";", "xtra", ".", "mpid_xtra_w2", "=", "mi", "->", "mpid_info_w2", ";", "xtra", ".", "mpid_xtra_w3", "=", "mi", "->", "mpid_info_w3", ";", "memcpy", "(", "rb", ",", "sb", ",", "sl", ")", ";", "MPID_Recvdone1_rem_dt", "(", "&", "xtra", ")", ";", "}", "break", ";", "case", "MPID_MSGTYPE_DT_IOV", ":", "#ifdef", "NOT_USED", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "rb", "=", "mpid_update_rem_dt", "(", "mi", "->", "mpid_info_w2", ",", "mi", "->", "mpid_info_w3", ",", "mi", "->", "mpid_info_w1", ")", ";", "if", "(", "rb", ")", "{", "memcpy", "(", "rb", ",", "sb", ",", "sl", ")", ";", "mpid_recvdone2_rem_dt", "(", "_mi", ")", ";", "}", "break", ";", "#endif", "MPID_abort", "(", ")", ";", "case", "MPID_MSGTYPE_ACC", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "mi", "->", "mpid_info_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "MPIDU_assert_PUTOK", "(", "win", ")", ";", "if", "(", "win", "->", "_dev", ".", "epoch_assert", "&", "MPI_MODE_NOPUT", ")", "{", "}", "target_accumulate", "(", "mi", ",", "sb", ",", "or", ")", ";", "break", ";", "case", "MPID_MSGTYPE_GET", ":", "MPID_abort", "(", ")", ";", "default", ":", "break", ";", "}", "}" ]
\brief Receive callback for RMA protocol and operations messages "Small" message callback - the entire message is already here.
[ "\\", "brief", "Receive", "callback", "for", "RMA", "protocol", "and", "operations", "messages", "\"", "Small", "\"", "message", "callback", "-", "the", "entire", "message", "is", "already", "here", "." ]
[ "// assert(mc->mpid_ctl_w0 == mi->mpid_info_w0);", "/* The following all use msginfo as DCMF_Control_t (DCQuad[1]) */", "/* The following all use msginfo as DCQuad[2] */", "/** \\todo exact error handling */", "/* In this case, the message is a completion notification */", "/* ! USE_DCMF_PUT */", "/* ! USE_DCMF_PUT */", "/* NOT_USED */", "/** \\todo exact error handling */", "/* Not supported message types */", "/* GET can't generate these */", "/*\n * Don't know what to do with this... we have some data\n * (possibly) but don't have a target address to copy it\n * to (or know what else to do with it).\n */" ]
[ { "param": "cd", "type": "void" }, { "param": "_mi", "type": "DCQuad" }, { "param": "ct", "type": "unsigned" }, { "param": "or", "type": "size_t" }, { "param": "sb", "type": "char" }, { "param": "sl", "type": "size_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cd", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "_mi", "type": "DCQuad", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ct", "type": "unsigned", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "or", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sb", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sl", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
recv_cb
DCMF_Request_t
DCMF_Request_t *recv_cb(void *cd, const DCQuad *_mi, unsigned ct, size_t or, const size_t sl, size_t *rl, char **rb, DCMF_Callback_t *cb) { DCMF_Request_t *req; MPID_Win *win; MPIDU_Onesided_info_t *mi = (MPIDU_Onesided_info_t *)_mi; switch (mi->mpid_info_w0) { /* The following all use msginfo as DCQuad[2] */ case MPID_MSGTYPE_PUT: #ifdef USE_DCMF_PUT MPID_abort(); #else /* ! USE_DCMF_PUT */ MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { /** \todo exact error handling */ } MPID_assert_debug(mi->mpid_info_w3 >= (size_t)win->base && mi->mpid_info_w3 + sl <= (size_t)win->base + win->size); *rl = sl; *rb = (char *)mi->mpid_info_w3; { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w3; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = or; req = MPIDU_get_req(&xtra, NULL); } cb->clientdata = req; cb->function = rma_rqc_cb; return req; #endif /* ! USE_DCMF_PUT */ case MPID_MSGTYPE_DT_MAP: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); *rb = MPID_Prepare_rem_dt(mi); if (!*rb) { return NULL; } *rl = sl; { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w0; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = mi->mpid_info_w3; req = MPIDU_get_req(&xtra, NULL); } cb->clientdata = req; cb->function = dtc1_rqc_cb; return req; case MPID_MSGTYPE_DT_IOV: #ifdef NOT_USED MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); *rb = mpid_update_rem_dt(mi->mpid_info_w2, mi->mpid_info_w3, mi->mpid_info_w1); if (!*rb) { return NULL; } *rl = sl; { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w0; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = mi->mpid_info_w3; req = MPIDU_get_req(&xtra, NULL); } cb->clientdata = req; cb->function = dtc2_rqc_cb; return req; #endif /* NOT_USED */ MPID_abort(); case MPID_MSGTYPE_ACC: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); { /* block */ MPIDU_Onesided_info_t *info; MPIDU_Onesided_xtra_t xtra = {0}; MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { /** \todo exact error handling */ } /** \note These embedded DCQuads are not directly * used in any communications. */ MPIDU_MALLOC(info, MPIDU_Onesided_info_t, sizeof(MPIDU_Onesided_info_t) + sl, e, "MPID_MSGTYPE_ACC"); MPID_assert_debug(info != NULL); *rb = (char *)(info + 1); *rl = sl; memcpy(info, mi, sizeof(MPIDU_Onesided_info_t)); xtra.mpid_xtra_w2 = (size_t)info; xtra.mpid_xtra_w3 = or; req = MPIDU_get_req(&xtra, NULL); cb->clientdata = req; cb->function = accum_cb; return req; } /* block */ /* The following all use msginfo as DCMF_Control_t (DCQuad[1]) */ case MPID_MSGTYPE_POST: case MPID_MSGTYPE_COMPLETE: /* Win_post/Win_complete messages are always small. */ case MPID_MSGTYPE_LOCK: case MPID_MSGTYPE_UNLOCK: case MPID_MSGTYPE_LOCKACK: case MPID_MSGTYPE_UNLOCKACK: MPID_abort(); case MPID_MSGTYPE_GET: /* GET can't generate these */ MPID_abort(); default: break; } return NULL; }
/** * \brief Receive callback for RMA operations messages * * "Message receive initiated" callback. * This one should never get called for protocol messages. * Setup buffers, get a request object, and return so receive can begin. * In some cases (e.g. MPID_MSGTYPE_ACC) the processing is done in the * receive completion callback, otherwise that callback just frees * the request and cleans up (updates counters). * * \param[in] _mi Pointer to msginfo * \param[in] ct Number of DCQuad's in msginfo * \param[in] or Rank of origin * \param[in] sl Length (bytes) of sent data * \param[out] rl Length (bytes) of data to receive * \param[out] rb receive buffer * \param[out] cb callback to invoke after receive * \return Pointer to DCMF request object to use for receive, * or NULL to discard received data * * \ref msginfo_usage */
\brief Receive callback for RMA operations messages "Message receive initiated" callback. This one should never get called for protocol messages. Setup buffers, get a request object, and return so receive can begin. In some cases the processing is done in the receive completion callback, otherwise that callback just frees the request and cleans up (updates counters).
[ "\\", "brief", "Receive", "callback", "for", "RMA", "operations", "messages", "\"", "Message", "receive", "initiated", "\"", "callback", ".", "This", "one", "should", "never", "get", "called", "for", "protocol", "messages", ".", "Setup", "buffers", "get", "a", "request", "object", "and", "return", "so", "receive", "can", "begin", ".", "In", "some", "cases", "the", "processing", "is", "done", "in", "the", "receive", "completion", "callback", "otherwise", "that", "callback", "just", "frees", "the", "request", "and", "cleans", "up", "(", "updates", "counters", ")", "." ]
DCMF_Request_t *recv_cb(void *cd, const DCQuad *_mi, unsigned ct, size_t or, const size_t sl, size_t *rl, char **rb, DCMF_Callback_t *cb) { DCMF_Request_t *req; MPID_Win *win; MPIDU_Onesided_info_t *mi = (MPIDU_Onesided_info_t *)_mi; switch (mi->mpid_info_w0) { case MPID_MSGTYPE_PUT: #ifdef USE_DCMF_PUT MPID_abort(); #else MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { } MPID_assert_debug(mi->mpid_info_w3 >= (size_t)win->base && mi->mpid_info_w3 + sl <= (size_t)win->base + win->size); *rl = sl; *rb = (char *)mi->mpid_info_w3; { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w3; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = or; req = MPIDU_get_req(&xtra, NULL); } cb->clientdata = req; cb->function = rma_rqc_cb; return req; #endif case MPID_MSGTYPE_DT_MAP: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); *rb = MPID_Prepare_rem_dt(mi); if (!*rb) { return NULL; } *rl = sl; { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w0; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = mi->mpid_info_w3; req = MPIDU_get_req(&xtra, NULL); } cb->clientdata = req; cb->function = dtc1_rqc_cb; return req; case MPID_MSGTYPE_DT_IOV: #ifdef NOT_USED MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); *rb = mpid_update_rem_dt(mi->mpid_info_w2, mi->mpid_info_w3, mi->mpid_info_w1); if (!*rb) { return NULL; } *rl = sl; { MPIDU_Onesided_xtra_t xtra; xtra.mpid_xtra_w0 = mi->mpid_info_w0; xtra.mpid_xtra_w1 = mi->mpid_info_w1; xtra.mpid_xtra_w2 = mi->mpid_info_w2; xtra.mpid_xtra_w3 = mi->mpid_info_w3; req = MPIDU_get_req(&xtra, NULL); } cb->clientdata = req; cb->function = dtc2_rqc_cb; return req; #endif MPID_abort(); case MPID_MSGTYPE_ACC: MPID_assert_debug(ct == MPIDU_1SINFO_NQUADS); { MPIDU_Onesided_info_t *info; MPIDU_Onesided_xtra_t xtra = {0}; MPID_Win_get_ptr((MPI_Win)mi->mpid_info_w1, win); MPID_assert_debug(win != NULL); MPIDU_assert_PUTOK(win); if (win->_dev.epoch_assert & MPI_MODE_NOPUT) { } MPIDU_MALLOC(info, MPIDU_Onesided_info_t, sizeof(MPIDU_Onesided_info_t) + sl, e, "MPID_MSGTYPE_ACC"); MPID_assert_debug(info != NULL); *rb = (char *)(info + 1); *rl = sl; memcpy(info, mi, sizeof(MPIDU_Onesided_info_t)); xtra.mpid_xtra_w2 = (size_t)info; xtra.mpid_xtra_w3 = or; req = MPIDU_get_req(&xtra, NULL); cb->clientdata = req; cb->function = accum_cb; return req; } case MPID_MSGTYPE_POST: case MPID_MSGTYPE_COMPLETE: case MPID_MSGTYPE_LOCK: case MPID_MSGTYPE_UNLOCK: case MPID_MSGTYPE_LOCKACK: case MPID_MSGTYPE_UNLOCKACK: MPID_abort(); case MPID_MSGTYPE_GET: MPID_abort(); default: break; } return NULL; }
[ "DCMF_Request_t", "*", "recv_cb", "(", "void", "*", "cd", ",", "const", "DCQuad", "*", "_mi", ",", "unsigned", "ct", ",", "size_t", "or", ",", "const", "size_t", "sl", ",", "size_t", "*", "rl", ",", "char", "*", "*", "rb", ",", "DCMF_Callback_t", "*", "cb", ")", "{", "DCMF_Request_t", "*", "req", ";", "MPID_Win", "*", "win", ";", "MPIDU_Onesided_info_t", "*", "mi", "=", "(", "MPIDU_Onesided_info_t", "*", ")", "_mi", ";", "switch", "(", "mi", "->", "mpid_info_w0", ")", "{", "case", "MPID_MSGTYPE_PUT", ":", "#ifdef", "USE_DCMF_PUT", "MPID_abort", "(", ")", ";", "#else", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "mi", "->", "mpid_info_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "MPIDU_assert_PUTOK", "(", "win", ")", ";", "if", "(", "win", "->", "_dev", ".", "epoch_assert", "&", "MPI_MODE_NOPUT", ")", "{", "}", "MPID_assert_debug", "(", "mi", "->", "mpid_info_w3", ">=", "(", "size_t", ")", "win", "->", "base", "&&", "mi", "->", "mpid_info_w3", "+", "sl", "<=", "(", "size_t", ")", "win", "->", "base", "+", "win", "->", "size", ")", ";", "*", "rl", "=", "sl", ";", "*", "rb", "=", "(", "char", "*", ")", "mi", "->", "mpid_info_w3", ";", "{", "MPIDU_Onesided_xtra_t", "xtra", ";", "xtra", ".", "mpid_xtra_w0", "=", "mi", "->", "mpid_info_w3", ";", "xtra", ".", "mpid_xtra_w1", "=", "mi", "->", "mpid_info_w1", ";", "xtra", ".", "mpid_xtra_w2", "=", "mi", "->", "mpid_info_w2", ";", "xtra", ".", "mpid_xtra_w3", "=", "or", ";", "req", "=", "MPIDU_get_req", "(", "&", "xtra", ",", "NULL", ")", ";", "}", "cb", "->", "clientdata", "=", "req", ";", "cb", "->", "function", "=", "rma_rqc_cb", ";", "return", "req", ";", "#endif", "case", "MPID_MSGTYPE_DT_MAP", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "*", "rb", "=", "MPID_Prepare_rem_dt", "(", "mi", ")", ";", "if", "(", "!", "*", "rb", ")", "{", "return", "NULL", ";", "}", "*", "rl", "=", "sl", ";", "{", "MPIDU_Onesided_xtra_t", "xtra", ";", "xtra", ".", "mpid_xtra_w0", "=", "mi", "->", "mpid_info_w0", ";", "xtra", ".", "mpid_xtra_w1", "=", "mi", "->", "mpid_info_w1", ";", "xtra", ".", "mpid_xtra_w2", "=", "mi", "->", "mpid_info_w2", ";", "xtra", ".", "mpid_xtra_w3", "=", "mi", "->", "mpid_info_w3", ";", "req", "=", "MPIDU_get_req", "(", "&", "xtra", ",", "NULL", ")", ";", "}", "cb", "->", "clientdata", "=", "req", ";", "cb", "->", "function", "=", "dtc1_rqc_cb", ";", "return", "req", ";", "case", "MPID_MSGTYPE_DT_IOV", ":", "#ifdef", "NOT_USED", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "*", "rb", "=", "mpid_update_rem_dt", "(", "mi", "->", "mpid_info_w2", ",", "mi", "->", "mpid_info_w3", ",", "mi", "->", "mpid_info_w1", ")", ";", "if", "(", "!", "*", "rb", ")", "{", "return", "NULL", ";", "}", "*", "rl", "=", "sl", ";", "{", "MPIDU_Onesided_xtra_t", "xtra", ";", "xtra", ".", "mpid_xtra_w0", "=", "mi", "->", "mpid_info_w0", ";", "xtra", ".", "mpid_xtra_w1", "=", "mi", "->", "mpid_info_w1", ";", "xtra", ".", "mpid_xtra_w2", "=", "mi", "->", "mpid_info_w2", ";", "xtra", ".", "mpid_xtra_w3", "=", "mi", "->", "mpid_info_w3", ";", "req", "=", "MPIDU_get_req", "(", "&", "xtra", ",", "NULL", ")", ";", "}", "cb", "->", "clientdata", "=", "req", ";", "cb", "->", "function", "=", "dtc2_rqc_cb", ";", "return", "req", ";", "#endif", "MPID_abort", "(", ")", ";", "case", "MPID_MSGTYPE_ACC", ":", "MPID_assert_debug", "(", "ct", "==", "MPIDU_1SINFO_NQUADS", ")", ";", "{", "MPIDU_Onesided_info_t", "*", "info", ";", "MPIDU_Onesided_xtra_t", "xtra", "=", "{", "0", "}", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "mi", "->", "mpid_info_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "MPIDU_assert_PUTOK", "(", "win", ")", ";", "if", "(", "win", "->", "_dev", ".", "epoch_assert", "&", "MPI_MODE_NOPUT", ")", "{", "}", "MPIDU_MALLOC", "(", "info", ",", "MPIDU_Onesided_info_t", ",", "sizeof", "(", "MPIDU_Onesided_info_t", ")", "+", "sl", ",", "e", ",", "\"", "\"", ")", ";", "MPID_assert_debug", "(", "info", "!=", "NULL", ")", ";", "*", "rb", "=", "(", "char", "*", ")", "(", "info", "+", "1", ")", ";", "*", "rl", "=", "sl", ";", "memcpy", "(", "info", ",", "mi", ",", "sizeof", "(", "MPIDU_Onesided_info_t", ")", ")", ";", "xtra", ".", "mpid_xtra_w2", "=", "(", "size_t", ")", "info", ";", "xtra", ".", "mpid_xtra_w3", "=", "or", ";", "req", "=", "MPIDU_get_req", "(", "&", "xtra", ",", "NULL", ")", ";", "cb", "->", "clientdata", "=", "req", ";", "cb", "->", "function", "=", "accum_cb", ";", "return", "req", ";", "}", "case", "MPID_MSGTYPE_POST", ":", "case", "MPID_MSGTYPE_COMPLETE", ":", "case", "MPID_MSGTYPE_LOCK", ":", "case", "MPID_MSGTYPE_UNLOCK", ":", "case", "MPID_MSGTYPE_LOCKACK", ":", "case", "MPID_MSGTYPE_UNLOCKACK", ":", "MPID_abort", "(", ")", ";", "case", "MPID_MSGTYPE_GET", ":", "MPID_abort", "(", ")", ";", "default", ":", "break", ";", "}", "return", "NULL", ";", "}" ]
\brief Receive callback for RMA operations messages "Message receive initiated" callback.
[ "\\", "brief", "Receive", "callback", "for", "RMA", "operations", "messages", "\"", "Message", "receive", "initiated", "\"", "callback", "." ]
[ "/* The following all use msginfo as DCQuad[2] */", "/* ! USE_DCMF_PUT */", "/** \\todo exact error handling */", "/* ! USE_DCMF_PUT */", "/* NOT_USED */", "/* block */", "/** \\todo exact error handling */", "/** \\note These embedded DCQuads are not directly\n * used in any communications. */", "/* block */", "/* The following all use msginfo as DCMF_Control_t (DCQuad[1]) */", "/* Win_post/Win_complete messages are always small. */", "/* GET can't generate these */" ]
[ { "param": "cd", "type": "void" }, { "param": "_mi", "type": "DCQuad" }, { "param": "ct", "type": "unsigned" }, { "param": "or", "type": "size_t" }, { "param": "sl", "type": "size_t" }, { "param": "rl", "type": "size_t" }, { "param": "rb", "type": "char" }, { "param": "cb", "type": "DCMF_Callback_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cd", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "_mi", "type": "DCQuad", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ct", "type": "unsigned", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "or", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sl", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rl", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rb", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cb", "type": "DCMF_Callback_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
epoch_clear
void
void epoch_clear(MPID_Win *win) { int x; int size = MPIDU_comm_size(win); win->_dev.epoch_type = MPID_EPOTYPE_NONE; win->_dev.epoch_rma_ok = 0; win->_dev.my_rma_recvs = 0; win->_dev.my_sync_done = 0; win->_dev.my_sync_begin = 0; for (x = 0; x < size; ++x) { win->_dev.coll_info[x].rma_sends = 0; } }
/** * \brief Reset all counters and indicators related to active RMA epochs * * Assumes all synchronization and wait-for-completion have been done. * Sets epoch type to "NONE". * * \param[in] win Window whose epoch is finished */
\brief Reset all counters and indicators related to active RMA epochs Assumes all synchronization and wait-for-completion have been done. Sets epoch type to "NONE". \param[in] win Window whose epoch is finished
[ "\\", "brief", "Reset", "all", "counters", "and", "indicators", "related", "to", "active", "RMA", "epochs", "Assumes", "all", "synchronization", "and", "wait", "-", "for", "-", "completion", "have", "been", "done", ".", "Sets", "epoch", "type", "to", "\"", "NONE", "\"", ".", "\\", "param", "[", "in", "]", "win", "Window", "whose", "epoch", "is", "finished" ]
void epoch_clear(MPID_Win *win) { int x; int size = MPIDU_comm_size(win); win->_dev.epoch_type = MPID_EPOTYPE_NONE; win->_dev.epoch_rma_ok = 0; win->_dev.my_rma_recvs = 0; win->_dev.my_sync_done = 0; win->_dev.my_sync_begin = 0; for (x = 0; x < size; ++x) { win->_dev.coll_info[x].rma_sends = 0; } }
[ "void", "epoch_clear", "(", "MPID_Win", "*", "win", ")", "{", "int", "x", ";", "int", "size", "=", "MPIDU_comm_size", "(", "win", ")", ";", "win", "->", "_dev", ".", "epoch_type", "=", "MPID_EPOTYPE_NONE", ";", "win", "->", "_dev", ".", "epoch_rma_ok", "=", "0", ";", "win", "->", "_dev", ".", "my_rma_recvs", "=", "0", ";", "win", "->", "_dev", ".", "my_sync_done", "=", "0", ";", "win", "->", "_dev", ".", "my_sync_begin", "=", "0", ";", "for", "(", "x", "=", "0", ";", "x", "<", "size", ";", "++", "x", ")", "{", "win", "->", "_dev", ".", "coll_info", "[", "x", "]", ".", "rma_sends", "=", "0", ";", "}", "}" ]
\brief Reset all counters and indicators related to active RMA epochs Assumes all synchronization and wait-for-completion have been done.
[ "\\", "brief", "Reset", "all", "counters", "and", "indicators", "related", "to", "active", "RMA", "epochs", "Assumes", "all", "synchronization", "and", "wait", "-", "for", "-", "completion", "have", "been", "done", "." ]
[]
[ { "param": "win", "type": "MPID_Win" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "MPID_Win", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2f588c6860a2ce97aef14107e5aa125cc3cb251e
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_rma_common.c
[ "Intel", "mpich2", "Unlicense" ]
C
mpid_queue_datatype
int
int mpid_queue_datatype(MPI_Datatype dt, int o_lpid, int t_lpid, volatile unsigned *pending, DCMF_Consistency *consistency) { MPIDU_Onesided_info_t *info; MPIDU_Onesided_xtra_t xtra = {0}; DCMF_Callback_t cb_send; DCMF_Request_t *reqp; int mpi_errno = MPI_SUCCESS; mpid_dt_info dti; if (MPIDU_check_dt(t_lpid, dt, &dti)) { /* we've previously sent this datatype to that target */ return mpi_errno; } /** \todo need to ensure we don't LOWER consistency... */ *consistency = DCMF_WEAK_CONSISTENCY; xtra.mpid_xtra_w0 = (size_t)pending; reqp = MPIDU_get_req(&xtra, &info); info->mpid_info_w0 = MPID_MSGTYPE_DT_MAP; info->mpid_info_w1 = dti.map_len; info->mpid_info_w2 = o_lpid; info->mpid_info_w3 = dt; info->mpid_info_w4 = dti.dtp->extent; info->mpid_info_w5 = dti.dtp->eltype; info->mpid_info_w6 = dti.dtp->element_size; ++(*pending); cb_send.function = done_rqc_cb; cb_send.clientdata = reqp; mpi_errno = DCMF_Send(&bg1s_sn_proto, reqp, cb_send, *consistency, t_lpid, dti.map_len * sizeof(*dti.map), (char *)dti.map, info->info, MPIDU_1SINFO_NQUADS); if (mpi_errno) { return(mpi_errno); } reqp = MPIDU_get_req(&xtra, &info); info->mpid_info_w0 = MPID_MSGTYPE_DT_IOV; info->mpid_info_w1 = dti.iov_len; info->mpid_info_w2 = o_lpid; info->mpid_info_w3 = dt; info->mpid_info_w4 = dti.dtp->extent; info->mpid_info_w5 = dti.dtp->eltype; info->mpid_info_w6 = dti.dtp->element_size; ++(*pending); cb_send.function = done_rqc_cb; cb_send.clientdata = reqp; mpi_errno = DCMF_Send(&bg1s_sn_proto, reqp, cb_send, *consistency, t_lpid, dti.iov_len * sizeof(*dti.iov), (char *)dti.iov, info->info, MPIDU_1SINFO_NQUADS); return mpi_errno; }
/** * \brief Send local datatype to target node * * Routine to send target datatype to target node. * These sends are handled by recv callbacks above... * * \param[in] dt datatype handle to send * \param[in] o_lpid Origin lpid * \param[in] t_lpid Target lpid * \param[out] pending Pointer to send done counter * \param[in,out] consistency Pointer for consistency used for sends (out) * \return MPI_SUCCESS, or error returned by DCMF_Send. * * \ref msginfo_usage\n * \ref dtcache_design */
\brief Send local datatype to target node Routine to send target datatype to target node. These sends are handled by recv callbacks above
[ "\\", "brief", "Send", "local", "datatype", "to", "target", "node", "Routine", "to", "send", "target", "datatype", "to", "target", "node", ".", "These", "sends", "are", "handled", "by", "recv", "callbacks", "above" ]
int mpid_queue_datatype(MPI_Datatype dt, int o_lpid, int t_lpid, volatile unsigned *pending, DCMF_Consistency *consistency) { MPIDU_Onesided_info_t *info; MPIDU_Onesided_xtra_t xtra = {0}; DCMF_Callback_t cb_send; DCMF_Request_t *reqp; int mpi_errno = MPI_SUCCESS; mpid_dt_info dti; if (MPIDU_check_dt(t_lpid, dt, &dti)) { return mpi_errno; } *consistency = DCMF_WEAK_CONSISTENCY; xtra.mpid_xtra_w0 = (size_t)pending; reqp = MPIDU_get_req(&xtra, &info); info->mpid_info_w0 = MPID_MSGTYPE_DT_MAP; info->mpid_info_w1 = dti.map_len; info->mpid_info_w2 = o_lpid; info->mpid_info_w3 = dt; info->mpid_info_w4 = dti.dtp->extent; info->mpid_info_w5 = dti.dtp->eltype; info->mpid_info_w6 = dti.dtp->element_size; ++(*pending); cb_send.function = done_rqc_cb; cb_send.clientdata = reqp; mpi_errno = DCMF_Send(&bg1s_sn_proto, reqp, cb_send, *consistency, t_lpid, dti.map_len * sizeof(*dti.map), (char *)dti.map, info->info, MPIDU_1SINFO_NQUADS); if (mpi_errno) { return(mpi_errno); } reqp = MPIDU_get_req(&xtra, &info); info->mpid_info_w0 = MPID_MSGTYPE_DT_IOV; info->mpid_info_w1 = dti.iov_len; info->mpid_info_w2 = o_lpid; info->mpid_info_w3 = dt; info->mpid_info_w4 = dti.dtp->extent; info->mpid_info_w5 = dti.dtp->eltype; info->mpid_info_w6 = dti.dtp->element_size; ++(*pending); cb_send.function = done_rqc_cb; cb_send.clientdata = reqp; mpi_errno = DCMF_Send(&bg1s_sn_proto, reqp, cb_send, *consistency, t_lpid, dti.iov_len * sizeof(*dti.iov), (char *)dti.iov, info->info, MPIDU_1SINFO_NQUADS); return mpi_errno; }
[ "int", "mpid_queue_datatype", "(", "MPI_Datatype", "dt", ",", "int", "o_lpid", ",", "int", "t_lpid", ",", "volatile", "unsigned", "*", "pending", ",", "DCMF_Consistency", "*", "consistency", ")", "{", "MPIDU_Onesided_info_t", "*", "info", ";", "MPIDU_Onesided_xtra_t", "xtra", "=", "{", "0", "}", ";", "DCMF_Callback_t", "cb_send", ";", "DCMF_Request_t", "*", "reqp", ";", "int", "mpi_errno", "=", "MPI_SUCCESS", ";", "mpid_dt_info", "dti", ";", "if", "(", "MPIDU_check_dt", "(", "t_lpid", ",", "dt", ",", "&", "dti", ")", ")", "{", "return", "mpi_errno", ";", "}", "*", "consistency", "=", "DCMF_WEAK_CONSISTENCY", ";", "xtra", ".", "mpid_xtra_w0", "=", "(", "size_t", ")", "pending", ";", "reqp", "=", "MPIDU_get_req", "(", "&", "xtra", ",", "&", "info", ")", ";", "info", "->", "mpid_info_w0", "=", "MPID_MSGTYPE_DT_MAP", ";", "info", "->", "mpid_info_w1", "=", "dti", ".", "map_len", ";", "info", "->", "mpid_info_w2", "=", "o_lpid", ";", "info", "->", "mpid_info_w3", "=", "dt", ";", "info", "->", "mpid_info_w4", "=", "dti", ".", "dtp", "->", "extent", ";", "info", "->", "mpid_info_w5", "=", "dti", ".", "dtp", "->", "eltype", ";", "info", "->", "mpid_info_w6", "=", "dti", ".", "dtp", "->", "element_size", ";", "++", "(", "*", "pending", ")", ";", "cb_send", ".", "function", "=", "done_rqc_cb", ";", "cb_send", ".", "clientdata", "=", "reqp", ";", "mpi_errno", "=", "DCMF_Send", "(", "&", "bg1s_sn_proto", ",", "reqp", ",", "cb_send", ",", "*", "consistency", ",", "t_lpid", ",", "dti", ".", "map_len", "*", "sizeof", "(", "*", "dti", ".", "map", ")", ",", "(", "char", "*", ")", "dti", ".", "map", ",", "info", "->", "info", ",", "MPIDU_1SINFO_NQUADS", ")", ";", "if", "(", "mpi_errno", ")", "{", "return", "(", "mpi_errno", ")", ";", "}", "reqp", "=", "MPIDU_get_req", "(", "&", "xtra", ",", "&", "info", ")", ";", "info", "->", "mpid_info_w0", "=", "MPID_MSGTYPE_DT_IOV", ";", "info", "->", "mpid_info_w1", "=", "dti", ".", "iov_len", ";", "info", "->", "mpid_info_w2", "=", "o_lpid", ";", "info", "->", "mpid_info_w3", "=", "dt", ";", "info", "->", "mpid_info_w4", "=", "dti", ".", "dtp", "->", "extent", ";", "info", "->", "mpid_info_w5", "=", "dti", ".", "dtp", "->", "eltype", ";", "info", "->", "mpid_info_w6", "=", "dti", ".", "dtp", "->", "element_size", ";", "++", "(", "*", "pending", ")", ";", "cb_send", ".", "function", "=", "done_rqc_cb", ";", "cb_send", ".", "clientdata", "=", "reqp", ";", "mpi_errno", "=", "DCMF_Send", "(", "&", "bg1s_sn_proto", ",", "reqp", ",", "cb_send", ",", "*", "consistency", ",", "t_lpid", ",", "dti", ".", "iov_len", "*", "sizeof", "(", "*", "dti", ".", "iov", ")", ",", "(", "char", "*", ")", "dti", ".", "iov", ",", "info", "->", "info", ",", "MPIDU_1SINFO_NQUADS", ")", ";", "return", "mpi_errno", ";", "}" ]
\brief Send local datatype to target node Routine to send target datatype to target node.
[ "\\", "brief", "Send", "local", "datatype", "to", "target", "node", "Routine", "to", "send", "target", "datatype", "to", "target", "node", "." ]
[ "/* we've previously sent this datatype to that target */", "/** \\todo need to ensure we don't LOWER consistency... */" ]
[ { "param": "dt", "type": "MPI_Datatype" }, { "param": "o_lpid", "type": "int" }, { "param": "t_lpid", "type": "int" }, { "param": "pending", "type": "unsigned" }, { "param": "consistency", "type": "DCMF_Consistency" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dt", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "o_lpid", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "t_lpid", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pending", "type": "unsigned", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "consistency", "type": "DCMF_Consistency", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5cd9ae2b26b1731410aa1864ba553468c9ed0efe
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpi/romio/adio/common/ad_fstype.c
[ "Intel", "mpich2", "Unlicense" ]
C
ADIO_FileSysType_parentdir
void
static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep) { int err; char *dir = NULL, *slash; struct stat statbuf; err = lstat(filename, &statbuf); if (err || (!S_ISLNK(statbuf.st_mode))) { /* no such file, or file is not a link; these are the "normal" * cases where we can just return the parent directory. */ dir = ADIOI_Strdup(filename); } else { /* filename is a symlink. we've presumably already tried * to stat it and found it to be missing (dangling link), * but this code doesn't care if the target is really there * or not. */ int namelen; char *linkbuf; linkbuf = ADIOI_Malloc(PATH_MAX+1); namelen = readlink(filename, linkbuf, PATH_MAX+1); if (namelen == -1) { /* something strange has happened between the time that * we determined that this was a link and the time that * we attempted to read it; punt and use the old name. */ dir = ADIOI_Strdup(filename); } else { /* successfully read the link */ linkbuf[namelen] = '\0'; /* readlink doesn't null terminate */ dir = ADIOI_Strdup(linkbuf); ADIOI_Free(linkbuf); } } slash = strrchr(dir, '/'); if (!slash) ADIOI_Strncpy(dir, ".", 2); else { if (slash == dir) *(dir + 1) = '\0'; else *slash = '\0'; } *dirnamep = dir; return; }
/* ADIO_FileSysType_parentdir * * Returns pointer to string in dirnamep; that string is allocated with * strdup and must be free()'d. */
ADIO_FileSysType_parentdir Returns pointer to string in dirnamep; that string is allocated with strdup and must be free()'d.
[ "ADIO_FileSysType_parentdir", "Returns", "pointer", "to", "string", "in", "dirnamep", ";", "that", "string", "is", "allocated", "with", "strdup", "and", "must", "be", "free", "()", "'", "d", "." ]
static void ADIO_FileSysType_parentdir(char *filename, char **dirnamep) { int err; char *dir = NULL, *slash; struct stat statbuf; err = lstat(filename, &statbuf); if (err || (!S_ISLNK(statbuf.st_mode))) { dir = ADIOI_Strdup(filename); } else { int namelen; char *linkbuf; linkbuf = ADIOI_Malloc(PATH_MAX+1); namelen = readlink(filename, linkbuf, PATH_MAX+1); if (namelen == -1) { dir = ADIOI_Strdup(filename); } else { linkbuf[namelen] = '\0'; dir = ADIOI_Strdup(linkbuf); ADIOI_Free(linkbuf); } } slash = strrchr(dir, '/'); if (!slash) ADIOI_Strncpy(dir, ".", 2); else { if (slash == dir) *(dir + 1) = '\0'; else *slash = '\0'; } *dirnamep = dir; return; }
[ "static", "void", "ADIO_FileSysType_parentdir", "(", "char", "*", "filename", ",", "char", "*", "*", "dirnamep", ")", "{", "int", "err", ";", "char", "*", "dir", "=", "NULL", ",", "*", "slash", ";", "struct", "stat", "statbuf", ";", "err", "=", "lstat", "(", "filename", ",", "&", "statbuf", ")", ";", "if", "(", "err", "||", "(", "!", "S_ISLNK", "(", "statbuf", ".", "st_mode", ")", ")", ")", "{", "dir", "=", "ADIOI_Strdup", "(", "filename", ")", ";", "}", "else", "{", "int", "namelen", ";", "char", "*", "linkbuf", ";", "linkbuf", "=", "ADIOI_Malloc", "(", "PATH_MAX", "+", "1", ")", ";", "namelen", "=", "readlink", "(", "filename", ",", "linkbuf", ",", "PATH_MAX", "+", "1", ")", ";", "if", "(", "namelen", "==", "-1", ")", "{", "dir", "=", "ADIOI_Strdup", "(", "filename", ")", ";", "}", "else", "{", "linkbuf", "[", "namelen", "]", "=", "'", "\\0", "'", ";", "dir", "=", "ADIOI_Strdup", "(", "linkbuf", ")", ";", "ADIOI_Free", "(", "linkbuf", ")", ";", "}", "}", "slash", "=", "strrchr", "(", "dir", ",", "'", "'", ")", ";", "if", "(", "!", "slash", ")", "ADIOI_Strncpy", "(", "dir", ",", "\"", "\"", ",", "2", ")", ";", "else", "{", "if", "(", "slash", "==", "dir", ")", "*", "(", "dir", "+", "1", ")", "=", "'", "\\0", "'", ";", "else", "*", "slash", "=", "'", "\\0", "'", ";", "}", "*", "dirnamep", "=", "dir", ";", "return", ";", "}" ]
ADIO_FileSysType_parentdir Returns pointer to string in dirnamep; that string is allocated with strdup and must be free()'d.
[ "ADIO_FileSysType_parentdir", "Returns", "pointer", "to", "string", "in", "dirnamep", ";", "that", "string", "is", "allocated", "with", "strdup", "and", "must", "be", "free", "()", "'", "d", "." ]
[ "/* no such file, or file is not a link; these are the \"normal\"\n\t * cases where we can just return the parent directory.\n\t */", "/* filename is a symlink. we've presumably already tried\n\t * to stat it and found it to be missing (dangling link),\n\t * but this code doesn't care if the target is really there\n\t * or not.\n\t */", "/* something strange has happened between the time that\n\t * we determined that this was a link and the time that\n\t * we attempted to read it; punt and use the old name.\n\t */", "/* successfully read the link */", "/* readlink doesn't null terminate */" ]
[ { "param": "filename", "type": "char" }, { "param": "dirnamep", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dirnamep", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5cd9ae2b26b1731410aa1864ba553468c9ed0efe
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpi/romio/adio/common/ad_fstype.c
[ "Intel", "mpich2", "Unlicense" ]
C
ADIO_FileSysType_fncall
void
static void ADIO_FileSysType_fncall(char *filename, int *fstype, int *error_code) { #ifndef ROMIO_NTFS char *dir; int err; #endif #ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE struct statvfs vfsbuf; #endif #ifdef HAVE_STRUCT_STATFS struct statfs fsbuf; #endif #ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE struct stat sbuf; #endif static char myname[] = "ADIO_RESOLVEFILETYPE_FNCALL"; *error_code = MPI_SUCCESS; #ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE do { err = statvfs(filename, &vfsbuf); } while (err && (errno == ESTALE)); if (err && (errno == ENOENT)) { /* ENOENT may be returned in two cases: * 1) no directory entry for "filename" * 2) "filename" is a dangling symbolic link * * ADIO_FileSysType_parentdir tries to deal with both cases. */ ADIO_FileSysType_parentdir(filename, &dir); err = statvfs(dir, &vfsbuf); ADIOI_Free(dir); } /* --BEGIN ERROR HANDLING-- */ if (err) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); return; } /* --END ERROR HANDLING-- */ /* FPRINTF(stderr, "%s\n", vfsbuf.f_basetype); */ if (!strncmp(vfsbuf.f_basetype, "nfs", 3)) { *fstype = ADIO_NFS; return; } if (!strncmp(vfsbuf.f_basetype, "xfs", 3)) { *fstype = ADIO_XFS; return; } # ifdef ROMIO_UFS /* if UFS support is enabled, default to that */ *fstype = ADIO_UFS; return; # endif /* --BEGIN ERROR HANDLING-- */ *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); /* --END ERROR HANDLING-- */ #endif /* STATVFS APPROACH */ #ifdef HAVE_STRUCT_STATFS do { err = statfs(filename, &fsbuf); } while (err && (errno == ESTALE)); if (err && (errno == ENOENT)) { ADIO_FileSysType_parentdir(filename, &dir); err = statfs(dir, &fsbuf); ADIOI_Free(dir); } /* --BEGIN ERROR HANDLING-- */ if (err) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); return; } /* --END ERROR HANDLING-- */ # ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME if ( !strncmp("nfs",fsbuf.f_fstypename,3) ) { *fstype = ADIO_NFS; return; } # endif # ifdef ROMIO_BGL /* BlueGene is a special case: all file systems are AD_BGL, except for * certain exceptions */ /* Bluegene needs to read enviroment variables before selecting the file system*/ ad_bgl_get_env_vars(); *fstype = ADIO_BGL; check_for_lockless_exceptions(fsbuf.f_type, fstype); *error_code = MPI_SUCCESS; return; # endif /* FPRINTF(stderr, "%d\n", fsbuf.f_type);*/ # ifdef NFS_SUPER_MAGIC if (fsbuf.f_type == NFS_SUPER_MAGIC) { *fstype = ADIO_NFS; return; } # endif #ifdef ROMIO_LUSTRE # ifndef LL_SUPER_MAGIC # define LL_SUPER_MAGIC 0x0BD00BD0 # endif if (fsbuf.f_type == LL_SUPER_MAGIC) { *fstype = ADIO_LUSTRE; return; } #endif # ifdef PAN_KERNEL_FS_CLIENT_SUPER_MAGIC if (fsbuf.f_type == PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) { *fstype = ADIO_PANFS; return; } # endif # ifdef MOUNT_NFS if (fsbuf.f_type == MOUNT_NFS) { *fstype = ADIO_NFS; return; } # endif # ifdef MOUNT_PFS if (fsbuf.f_type == MOUNT_PFS) { *fstype = ADIO_PFS; return; } # endif # ifdef PVFS_SUPER_MAGIC if (fsbuf.f_type == PVFS_SUPER_MAGIC) { *fstype = ADIO_PVFS; return; } # endif # ifdef PVFS2_SUPER_MAGIC if (fsbuf.f_type == PVFS2_SUPER_MAGIC) { *fstype = ADIO_PVFS2; return; } # endif # ifdef XFS_SUPER_MAGIC if (fsbuf.f_type == XFS_SUPER_MAGIC) { *fstype = ADIO_XFS; return; } # endif # ifdef ROMIO_UFS /* if UFS support is enabled, default to that */ *fstype = ADIO_UFS; return; # endif /* --BEGIN ERROR HANDLING-- */ *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); /* --END ERROR HANDLING-- */ #endif /* STATFS APPROACH */ #ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE do { err = stat(filename, &sbuf); } while (err && (errno == ESTALE)); if (err && (errno == ENOENT)) { ADIO_FileSysType_parentdir(filename, &dir); err = stat(dir, &sbuf); ADIOI_Free(dir); } if (err) { /* --BEGIN ERROR HANDLING-- */ *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); /* --END ERROR HANDLING-- */ return; } else { if (!strcmp(sbuf.st_fstype, "nfs")) *fstype = ADIO_NFS; else *fstype = ADIO_SFS; /* assuming SX4 for now */ } #endif /* STAT APPROACH */ #ifdef ROMIO_NTFS ADIOI_UNREFERENCED_ARG(filename); ADIOI_UNREFERENCED_ARG(error_code); *fstype = ADIO_NTFS; /* only supported FS on Windows */ #elif defined(ROMIO_NFS) *fstype = ADIO_NFS; #elif defined(ROMIO_UFS) *fstype = ADIO_UFS; #else /* --BEGIN ERROR HANDLING-- */ *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); /* --END ERROR HANDLING-- */ #endif }
/* ADIO_FileSysType_fncall - determines the file system type for a given file using a system-dependent function call Input Parameters: . filename - pointer to file name character array Output Parameters: . fstype - location in which to store file system type (ADIO_XXX) . error_code - location in which to store error code MPI_SUCCESS is stored in the location pointed to by error_code on success. This function is used by MPI_File_open() and MPI_File_delete() to determine file system type. Most other functions use the type which is stored when the file is opened. */
determines the file system type for a given file using a system-dependent function call Input Parameters: . filename - pointer to file name character array Output Parameters: . fstype - location in which to store file system type (ADIO_XXX) . error_code - location in which to store error code MPI_SUCCESS is stored in the location pointed to by error_code on success. This function is used by MPI_File_open() and MPI_File_delete() to determine file system type. Most other functions use the type which is stored when the file is opened.
[ "determines", "the", "file", "system", "type", "for", "a", "given", "file", "using", "a", "system", "-", "dependent", "function", "call", "Input", "Parameters", ":", ".", "filename", "-", "pointer", "to", "file", "name", "character", "array", "Output", "Parameters", ":", ".", "fstype", "-", "location", "in", "which", "to", "store", "file", "system", "type", "(", "ADIO_XXX", ")", ".", "error_code", "-", "location", "in", "which", "to", "store", "error", "code", "MPI_SUCCESS", "is", "stored", "in", "the", "location", "pointed", "to", "by", "error_code", "on", "success", ".", "This", "function", "is", "used", "by", "MPI_File_open", "()", "and", "MPI_File_delete", "()", "to", "determine", "file", "system", "type", ".", "Most", "other", "functions", "use", "the", "type", "which", "is", "stored", "when", "the", "file", "is", "opened", "." ]
static void ADIO_FileSysType_fncall(char *filename, int *fstype, int *error_code) { #ifndef ROMIO_NTFS char *dir; int err; #endif #ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE struct statvfs vfsbuf; #endif #ifdef HAVE_STRUCT_STATFS struct statfs fsbuf; #endif #ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE struct stat sbuf; #endif static char myname[] = "ADIO_RESOLVEFILETYPE_FNCALL"; *error_code = MPI_SUCCESS; #ifdef ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE do { err = statvfs(filename, &vfsbuf); } while (err && (errno == ESTALE)); if (err && (errno == ENOENT)) { ADIO_FileSysType_parentdir(filename, &dir); err = statvfs(dir, &vfsbuf); ADIOI_Free(dir); } if (err) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); return; } if (!strncmp(vfsbuf.f_basetype, "nfs", 3)) { *fstype = ADIO_NFS; return; } if (!strncmp(vfsbuf.f_basetype, "xfs", 3)) { *fstype = ADIO_XFS; return; } # ifdef ROMIO_UFS *fstype = ADIO_UFS; return; # endif *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); #endif #ifdef HAVE_STRUCT_STATFS do { err = statfs(filename, &fsbuf); } while (err && (errno == ESTALE)); if (err && (errno == ENOENT)) { ADIO_FileSysType_parentdir(filename, &dir); err = statfs(dir, &fsbuf); ADIOI_Free(dir); } if (err) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); return; } # ifdef ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME if ( !strncmp("nfs",fsbuf.f_fstypename,3) ) { *fstype = ADIO_NFS; return; } # endif # ifdef ROMIO_BGL ad_bgl_get_env_vars(); *fstype = ADIO_BGL; check_for_lockless_exceptions(fsbuf.f_type, fstype); *error_code = MPI_SUCCESS; return; # endif # ifdef NFS_SUPER_MAGIC if (fsbuf.f_type == NFS_SUPER_MAGIC) { *fstype = ADIO_NFS; return; } # endif #ifdef ROMIO_LUSTRE # ifndef LL_SUPER_MAGIC # define LL_SUPER_MAGIC 0x0BD00BD0 # endif if (fsbuf.f_type == LL_SUPER_MAGIC) { *fstype = ADIO_LUSTRE; return; } #endif # ifdef PAN_KERNEL_FS_CLIENT_SUPER_MAGIC if (fsbuf.f_type == PAN_KERNEL_FS_CLIENT_SUPER_MAGIC) { *fstype = ADIO_PANFS; return; } # endif # ifdef MOUNT_NFS if (fsbuf.f_type == MOUNT_NFS) { *fstype = ADIO_NFS; return; } # endif # ifdef MOUNT_PFS if (fsbuf.f_type == MOUNT_PFS) { *fstype = ADIO_PFS; return; } # endif # ifdef PVFS_SUPER_MAGIC if (fsbuf.f_type == PVFS_SUPER_MAGIC) { *fstype = ADIO_PVFS; return; } # endif # ifdef PVFS2_SUPER_MAGIC if (fsbuf.f_type == PVFS2_SUPER_MAGIC) { *fstype = ADIO_PVFS2; return; } # endif # ifdef XFS_SUPER_MAGIC if (fsbuf.f_type == XFS_SUPER_MAGIC) { *fstype = ADIO_XFS; return; } # endif # ifdef ROMIO_UFS *fstype = ADIO_UFS; return; # endif *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); #endif #ifdef ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE do { err = stat(filename, &sbuf); } while (err && (errno == ESTALE)); if (err && (errno == ENOENT)) { ADIO_FileSysType_parentdir(filename, &dir); err = stat(dir, &sbuf); ADIOI_Free(dir); } if (err) { *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); return; } else { if (!strcmp(sbuf.st_fstype, "nfs")) *fstype = ADIO_NFS; else *fstype = ADIO_SFS; } #endif #ifdef ROMIO_NTFS ADIOI_UNREFERENCED_ARG(filename); ADIOI_UNREFERENCED_ARG(error_code); *fstype = ADIO_NTFS; #elif defined(ROMIO_NFS) *fstype = ADIO_NFS; #elif defined(ROMIO_UFS) *fstype = ADIO_UFS; #else *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); #endif }
[ "static", "void", "ADIO_FileSysType_fncall", "(", "char", "*", "filename", ",", "int", "*", "fstype", ",", "int", "*", "error_code", ")", "{", "#ifndef", "ROMIO_NTFS", "char", "*", "dir", ";", "int", "err", ";", "#endif", "#ifdef", "ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE", "struct", "statvfs", "vfsbuf", ";", "#endif", "#ifdef", "HAVE_STRUCT_STATFS", "struct", "statfs", "fsbuf", ";", "#endif", "#ifdef", "ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE", "struct", "stat", "sbuf", ";", "#endif", "static", "char", "myname", "[", "]", "=", "\"", "\"", ";", "*", "error_code", "=", "MPI_SUCCESS", ";", "#ifdef", "ROMIO_HAVE_STRUCT_STATVFS_WITH_F_BASETYPE", "do", "{", "err", "=", "statvfs", "(", "filename", ",", "&", "vfsbuf", ")", ";", "}", "while", "(", "err", "&&", "(", "errno", "==", "ESTALE", ")", ")", ";", "if", "(", "err", "&&", "(", "errno", "==", "ENOENT", ")", ")", "{", "ADIO_FileSysType_parentdir", "(", "filename", ",", "&", "dir", ")", ";", "err", "=", "statvfs", "(", "dir", ",", "&", "vfsbuf", ")", ";", "ADIOI_Free", "(", "dir", ")", ";", "}", "if", "(", "err", ")", "{", "*", "error_code", "=", "MPIO_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "myname", ",", "__LINE__", ",", "MPI_ERR_NO_SUCH_FILE", ",", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", ";", "return", ";", "}", "if", "(", "!", "strncmp", "(", "vfsbuf", ".", "f_basetype", ",", "\"", "\"", ",", "3", ")", ")", "{", "*", "fstype", "=", "ADIO_NFS", ";", "return", ";", "}", "if", "(", "!", "strncmp", "(", "vfsbuf", ".", "f_basetype", ",", "\"", "\"", ",", "3", ")", ")", "{", "*", "fstype", "=", "ADIO_XFS", ";", "return", ";", "}", "# ifdef", "ROMIO_UFS", "*", "fstype", "=", "ADIO_UFS", ";", "return", ";", "# endif", "*", "error_code", "=", "MPIO_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "myname", ",", "__LINE__", ",", "MPI_ERR_NO_SUCH_FILE", ",", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", ";", "#endif", "#ifdef", "HAVE_STRUCT_STATFS", "do", "{", "err", "=", "statfs", "(", "filename", ",", "&", "fsbuf", ")", ";", "}", "while", "(", "err", "&&", "(", "errno", "==", "ESTALE", ")", ")", ";", "if", "(", "err", "&&", "(", "errno", "==", "ENOENT", ")", ")", "{", "ADIO_FileSysType_parentdir", "(", "filename", ",", "&", "dir", ")", ";", "err", "=", "statfs", "(", "dir", ",", "&", "fsbuf", ")", ";", "ADIOI_Free", "(", "dir", ")", ";", "}", "if", "(", "err", ")", "{", "*", "error_code", "=", "MPIO_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "myname", ",", "__LINE__", ",", "MPI_ERR_NO_SUCH_FILE", ",", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", ";", "return", ";", "}", "# ifdef", "ROMIO_HAVE_STRUCT_STATFS_WITH_F_FSTYPENAME", "if", "(", "!", "strncmp", "(", "\"", "\"", ",", "fsbuf", ".", "f_fstypename", ",", "3", ")", ")", "{", "*", "fstype", "=", "ADIO_NFS", ";", "return", ";", "}", "# endif", "# ifdef", "ROMIO_BGL", "ad_bgl_get_env_vars", "(", ")", ";", "*", "fstype", "=", "ADIO_BGL", ";", "check_for_lockless_exceptions", "(", "fsbuf", ".", "f_type", ",", "fstype", ")", ";", "*", "error_code", "=", "MPI_SUCCESS", ";", "return", ";", "# endif", "# ifdef", "NFS_SUPER_MAGIC", "if", "(", "fsbuf", ".", "f_type", "==", "NFS_SUPER_MAGIC", ")", "{", "*", "fstype", "=", "ADIO_NFS", ";", "return", ";", "}", "# endif", "#ifdef", "ROMIO_LUSTRE", "# ifndef", "LL_SUPER_MAGIC", "# define", "LL_SUPER_MAGIC", " 0x0BD00BD0", "\n", "# endif", "if", "(", "fsbuf", ".", "f_type", "==", "LL_SUPER_MAGIC", ")", "{", "*", "fstype", "=", "ADIO_LUSTRE", ";", "return", ";", "}", "#endif", "# ifdef", "PAN_KERNEL_FS_CLIENT_SUPER_MAGIC", "if", "(", "fsbuf", ".", "f_type", "==", "PAN_KERNEL_FS_CLIENT_SUPER_MAGIC", ")", "{", "*", "fstype", "=", "ADIO_PANFS", ";", "return", ";", "}", "# endif", "# ifdef", "MOUNT_NFS", "if", "(", "fsbuf", ".", "f_type", "==", "MOUNT_NFS", ")", "{", "*", "fstype", "=", "ADIO_NFS", ";", "return", ";", "}", "# endif", "# ifdef", "MOUNT_PFS", "if", "(", "fsbuf", ".", "f_type", "==", "MOUNT_PFS", ")", "{", "*", "fstype", "=", "ADIO_PFS", ";", "return", ";", "}", "# endif", "# ifdef", "PVFS_SUPER_MAGIC", "if", "(", "fsbuf", ".", "f_type", "==", "PVFS_SUPER_MAGIC", ")", "{", "*", "fstype", "=", "ADIO_PVFS", ";", "return", ";", "}", "# endif", "# ifdef", "PVFS2_SUPER_MAGIC", "if", "(", "fsbuf", ".", "f_type", "==", "PVFS2_SUPER_MAGIC", ")", "{", "*", "fstype", "=", "ADIO_PVFS2", ";", "return", ";", "}", "# endif", "# ifdef", "XFS_SUPER_MAGIC", "if", "(", "fsbuf", ".", "f_type", "==", "XFS_SUPER_MAGIC", ")", "{", "*", "fstype", "=", "ADIO_XFS", ";", "return", ";", "}", "# endif", "# ifdef", "ROMIO_UFS", "*", "fstype", "=", "ADIO_UFS", ";", "return", ";", "# endif", "*", "error_code", "=", "MPIO_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "myname", ",", "__LINE__", ",", "MPI_ERR_NO_SUCH_FILE", ",", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", ";", "#endif", "#ifdef", "ROMIO_HAVE_STRUCT_STAT_WITH_ST_FSTYPE", "do", "{", "err", "=", "stat", "(", "filename", ",", "&", "sbuf", ")", ";", "}", "while", "(", "err", "&&", "(", "errno", "==", "ESTALE", ")", ")", ";", "if", "(", "err", "&&", "(", "errno", "==", "ENOENT", ")", ")", "{", "ADIO_FileSysType_parentdir", "(", "filename", ",", "&", "dir", ")", ";", "err", "=", "stat", "(", "dir", ",", "&", "sbuf", ")", ";", "ADIOI_Free", "(", "dir", ")", ";", "}", "if", "(", "err", ")", "{", "*", "error_code", "=", "MPIO_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "myname", ",", "__LINE__", ",", "MPI_ERR_NO_SUCH_FILE", ",", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", ";", "return", ";", "}", "else", "{", "if", "(", "!", "strcmp", "(", "sbuf", ".", "st_fstype", ",", "\"", "\"", ")", ")", "*", "fstype", "=", "ADIO_NFS", ";", "else", "*", "fstype", "=", "ADIO_SFS", ";", "}", "#endif", "#ifdef", "ROMIO_NTFS", "ADIOI_UNREFERENCED_ARG", "(", "filename", ")", ";", "ADIOI_UNREFERENCED_ARG", "(", "error_code", ")", ";", "*", "fstype", "=", "ADIO_NTFS", ";", "#elif", "defined", "(", "ROMIO_NFS", ")", "\n", "*", "fstype", "=", "ADIO_NFS", ";", "#elif", "defined", "(", "ROMIO_UFS", ")", "\n", "*", "fstype", "=", "ADIO_UFS", ";", "#else", "*", "error_code", "=", "MPIO_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "myname", ",", "__LINE__", ",", "MPI_ERR_NO_SUCH_FILE", ",", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", ";", "#endif", "}" ]
ADIO_FileSysType_fncall - determines the file system type for a given file using a system-dependent function call
[ "ADIO_FileSysType_fncall", "-", "determines", "the", "file", "system", "type", "for", "a", "given", "file", "using", "a", "system", "-", "dependent", "function", "call" ]
[ "/* ENOENT may be returned in two cases:\n\t * 1) no directory entry for \"filename\"\n\t * 2) \"filename\" is a dangling symbolic link\n\t *\n\t * ADIO_FileSysType_parentdir tries to deal with both cases.\n\t */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* FPRINTF(stderr, \"%s\\n\", vfsbuf.f_basetype); */", "/* if UFS support is enabled, default to that */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* STATVFS APPROACH */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* BlueGene is a special case: all file systems are AD_BGL, except for\n * certain exceptions */", "/* Bluegene needs to read enviroment variables before selecting the file system*/", "/* FPRINTF(stderr, \"%d\\n\", fsbuf.f_type);*/", "/* if UFS support is enabled, default to that */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* STATFS APPROACH */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* assuming SX4 for now */", "/* STAT APPROACH */", "/* only supported FS on Windows */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */" ]
[ { "param": "filename", "type": "char" }, { "param": "fstype", "type": "int" }, { "param": "error_code", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fstype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "error_code", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5cd9ae2b26b1731410aa1864ba553468c9ed0efe
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpi/romio/adio/common/ad_fstype.c
[ "Intel", "mpich2", "Unlicense" ]
C
ADIO_FileSysType_fncall_scalable
void
static void ADIO_FileSysType_fncall_scalable(MPI_Comm comm, char *filename, int * file_system, int * error_code) { int rank; int buf[2]; MPI_Comm_rank(comm, &rank); if (rank == 0) { ADIO_FileSysType_fncall(filename, file_system, error_code); buf[0] = *file_system; buf[1] = *error_code; } MPI_Bcast(buf, 2, MPI_INT, 0, comm); *file_system = buf[0]; *error_code = buf[1]; }
/* all proceeses opening, creating, or deleting a file end up invoking several * stat system calls (unless a fs prefix is given). Cary out this file system * detection in a more scalable way by having rank 0 stat the file and broadcast the result (fs type and error code) to the other mpi processes */
all proceeses opening, creating, or deleting a file end up invoking several stat system calls (unless a fs prefix is given). Cary out this file system detection in a more scalable way by having rank 0 stat the file and broadcast the result (fs type and error code) to the other mpi processes
[ "all", "proceeses", "opening", "creating", "or", "deleting", "a", "file", "end", "up", "invoking", "several", "stat", "system", "calls", "(", "unless", "a", "fs", "prefix", "is", "given", ")", ".", "Cary", "out", "this", "file", "system", "detection", "in", "a", "more", "scalable", "way", "by", "having", "rank", "0", "stat", "the", "file", "and", "broadcast", "the", "result", "(", "fs", "type", "and", "error", "code", ")", "to", "the", "other", "mpi", "processes" ]
static void ADIO_FileSysType_fncall_scalable(MPI_Comm comm, char *filename, int * file_system, int * error_code) { int rank; int buf[2]; MPI_Comm_rank(comm, &rank); if (rank == 0) { ADIO_FileSysType_fncall(filename, file_system, error_code); buf[0] = *file_system; buf[1] = *error_code; } MPI_Bcast(buf, 2, MPI_INT, 0, comm); *file_system = buf[0]; *error_code = buf[1]; }
[ "static", "void", "ADIO_FileSysType_fncall_scalable", "(", "MPI_Comm", "comm", ",", "char", "*", "filename", ",", "int", "*", "file_system", ",", "int", "*", "error_code", ")", "{", "int", "rank", ";", "int", "buf", "[", "2", "]", ";", "MPI_Comm_rank", "(", "comm", ",", "&", "rank", ")", ";", "if", "(", "rank", "==", "0", ")", "{", "ADIO_FileSysType_fncall", "(", "filename", ",", "file_system", ",", "error_code", ")", ";", "buf", "[", "0", "]", "=", "*", "file_system", ";", "buf", "[", "1", "]", "=", "*", "error_code", ";", "}", "MPI_Bcast", "(", "buf", ",", "2", ",", "MPI_INT", ",", "0", ",", "comm", ")", ";", "*", "file_system", "=", "buf", "[", "0", "]", ";", "*", "error_code", "=", "buf", "[", "1", "]", ";", "}" ]
all proceeses opening, creating, or deleting a file end up invoking several stat system calls (unless a fs prefix is given).
[ "all", "proceeses", "opening", "creating", "or", "deleting", "a", "file", "end", "up", "invoking", "several", "stat", "system", "calls", "(", "unless", "a", "fs", "prefix", "is", "given", ")", "." ]
[]
[ { "param": "comm", "type": "MPI_Comm" }, { "param": "filename", "type": "char" }, { "param": "file_system", "type": "int" }, { "param": "error_code", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "comm", "type": "MPI_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file_system", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "error_code", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5cd9ae2b26b1731410aa1864ba553468c9ed0efe
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpi/romio/adio/common/ad_fstype.c
[ "Intel", "mpich2", "Unlicense" ]
C
ADIO_FileSysType_prefix
void
static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code) { static char myname[] = "ADIO_RESOLVEFILETYPE_PREFIX"; *error_code = MPI_SUCCESS; if (!strncmp(filename, "pfs:", 4) || !strncmp(filename, "PFS:", 4)) { *fstype = ADIO_PFS; } else if (!strncmp(filename, "piofs:", 6) || !strncmp(filename, "PIOFS:", 6)) { *fstype = ADIO_PIOFS; } else if (!strncmp(filename, "ufs:", 4) || !strncmp(filename, "UFS:", 4)) { *fstype = ADIO_UFS; } else if (!strncmp(filename, "nfs:", 4) || !strncmp(filename, "NFS:", 4)) { *fstype = ADIO_NFS; } else if (!strncmp(filename, "panfs:", 6) || !strncmp(filename, "PANFS:", 6)) { *fstype = ADIO_PANFS; } else if (!strncmp(filename, "hfs:", 4) || !strncmp(filename, "HFS:", 4)) { *fstype = ADIO_HFS; } else if (!strncmp(filename, "xfs:", 4) || !strncmp(filename, "XFS:", 4)) { *fstype = ADIO_XFS; } else if (!strncmp(filename, "sfs:", 4) || !strncmp(filename, "SFS:", 4)) { *fstype = ADIO_SFS; } else if (!strncmp(filename, "pvfs:", 5) || !strncmp(filename, "PVFS:", 5)) { *fstype = ADIO_PVFS; } else if (!strncmp(filename, "pvfs2:", 6)||!strncmp(filename, "PVFS2:", 6)) { *fstype = ADIO_PVFS2; } else if (!strncmp(filename, "zoidfs:", 7)|| !strncmp(filename, "ZOIDFS:", 7)) { *fstype = ADIO_ZOIDFS; } else if (!strncmp(filename, "testfs:", 7) || !strncmp(filename, "TESTFS:", 7)) { *fstype = ADIO_TESTFS; } else if (!strncmp(filename, "ftp:", 4) || !strncmp(filename, "gsiftp:", 7)) { *fstype = ADIO_GRIDFTP; } else if (!strncmp(filename, "lustre:", 7) || !strncmp(filename, "LUSTRE:", 7)) { *fstype = ADIO_LUSTRE; } else if (!strncmp(filename, "bgl:", 4) || !strncmp(filename, "BGL:", 4)) { *fstype = ADIO_BGL; } else if (!strncmp(filename, "bglockless:", 11) || !strncmp(filename, "BGLOCKLESS:", 11)) { *fstype = ADIO_BGLOCKLESS; } else { #ifdef ROMIO_NTFS *fstype = ADIO_NTFS; #else *fstype = 0; /* --BEGIN ERROR HANDLING-- */ *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); /* --END ERROR HANDLING-- */ #endif } }
/* ADIO_FileSysType_prefix - determines file system type for a file using a prefix on the file name. upper layer should have already determined that a prefix is present. Input Parameters: . filename - path to file, including prefix (xxx:) Output Parameters: . fstype - pointer to integer in which to store file system type (ADIO_XXX) . error_code - pointer to integer in which to store error code Returns MPI_SUCCESS in error_code on success. Filename not having a prefix is considered an error. Except for on Windows systems where the default is NTFS. */
determines file system type for a file using a prefix on the file name. upper layer should have already determined that a prefix is present. Input Parameters: . filename - path to file, including prefix (xxx:) Output Parameters: . fstype - pointer to integer in which to store file system type (ADIO_XXX) . error_code - pointer to integer in which to store error code
[ "determines", "file", "system", "type", "for", "a", "file", "using", "a", "prefix", "on", "the", "file", "name", ".", "upper", "layer", "should", "have", "already", "determined", "that", "a", "prefix", "is", "present", ".", "Input", "Parameters", ":", ".", "filename", "-", "path", "to", "file", "including", "prefix", "(", "xxx", ":", ")", "Output", "Parameters", ":", ".", "fstype", "-", "pointer", "to", "integer", "in", "which", "to", "store", "file", "system", "type", "(", "ADIO_XXX", ")", ".", "error_code", "-", "pointer", "to", "integer", "in", "which", "to", "store", "error", "code" ]
static void ADIO_FileSysType_prefix(char *filename, int *fstype, int *error_code) { static char myname[] = "ADIO_RESOLVEFILETYPE_PREFIX"; *error_code = MPI_SUCCESS; if (!strncmp(filename, "pfs:", 4) || !strncmp(filename, "PFS:", 4)) { *fstype = ADIO_PFS; } else if (!strncmp(filename, "piofs:", 6) || !strncmp(filename, "PIOFS:", 6)) { *fstype = ADIO_PIOFS; } else if (!strncmp(filename, "ufs:", 4) || !strncmp(filename, "UFS:", 4)) { *fstype = ADIO_UFS; } else if (!strncmp(filename, "nfs:", 4) || !strncmp(filename, "NFS:", 4)) { *fstype = ADIO_NFS; } else if (!strncmp(filename, "panfs:", 6) || !strncmp(filename, "PANFS:", 6)) { *fstype = ADIO_PANFS; } else if (!strncmp(filename, "hfs:", 4) || !strncmp(filename, "HFS:", 4)) { *fstype = ADIO_HFS; } else if (!strncmp(filename, "xfs:", 4) || !strncmp(filename, "XFS:", 4)) { *fstype = ADIO_XFS; } else if (!strncmp(filename, "sfs:", 4) || !strncmp(filename, "SFS:", 4)) { *fstype = ADIO_SFS; } else if (!strncmp(filename, "pvfs:", 5) || !strncmp(filename, "PVFS:", 5)) { *fstype = ADIO_PVFS; } else if (!strncmp(filename, "pvfs2:", 6)||!strncmp(filename, "PVFS2:", 6)) { *fstype = ADIO_PVFS2; } else if (!strncmp(filename, "zoidfs:", 7)|| !strncmp(filename, "ZOIDFS:", 7)) { *fstype = ADIO_ZOIDFS; } else if (!strncmp(filename, "testfs:", 7) || !strncmp(filename, "TESTFS:", 7)) { *fstype = ADIO_TESTFS; } else if (!strncmp(filename, "ftp:", 4) || !strncmp(filename, "gsiftp:", 7)) { *fstype = ADIO_GRIDFTP; } else if (!strncmp(filename, "lustre:", 7) || !strncmp(filename, "LUSTRE:", 7)) { *fstype = ADIO_LUSTRE; } else if (!strncmp(filename, "bgl:", 4) || !strncmp(filename, "BGL:", 4)) { *fstype = ADIO_BGL; } else if (!strncmp(filename, "bglockless:", 11) || !strncmp(filename, "BGLOCKLESS:", 11)) { *fstype = ADIO_BGLOCKLESS; } else { #ifdef ROMIO_NTFS *fstype = ADIO_NTFS; #else *fstype = 0; *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filename", "**filename %s", filename); #endif } }
[ "static", "void", "ADIO_FileSysType_prefix", "(", "char", "*", "filename", ",", "int", "*", "fstype", ",", "int", "*", "error_code", ")", "{", "static", "char", "myname", "[", "]", "=", "\"", "\"", ";", "*", "error_code", "=", "MPI_SUCCESS", ";", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", ")", "{", "*", "fstype", "=", "ADIO_PFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "6", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "6", ")", ")", "{", "*", "fstype", "=", "ADIO_PIOFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", ")", "{", "*", "fstype", "=", "ADIO_UFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", ")", "{", "*", "fstype", "=", "ADIO_NFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "6", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "6", ")", ")", "{", "*", "fstype", "=", "ADIO_PANFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", ")", "{", "*", "fstype", "=", "ADIO_HFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", ")", "{", "*", "fstype", "=", "ADIO_XFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", ")", "{", "*", "fstype", "=", "ADIO_SFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "5", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "5", ")", ")", "{", "*", "fstype", "=", "ADIO_PVFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "6", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "6", ")", ")", "{", "*", "fstype", "=", "ADIO_PVFS2", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "7", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "7", ")", ")", "{", "*", "fstype", "=", "ADIO_ZOIDFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "7", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "7", ")", ")", "{", "*", "fstype", "=", "ADIO_TESTFS", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "7", ")", ")", "{", "*", "fstype", "=", "ADIO_GRIDFTP", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "7", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "7", ")", ")", "{", "*", "fstype", "=", "ADIO_LUSTRE", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "4", ")", ")", "{", "*", "fstype", "=", "ADIO_BGL", ";", "}", "else", "if", "(", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "11", ")", "||", "!", "strncmp", "(", "filename", ",", "\"", "\"", ",", "11", ")", ")", "{", "*", "fstype", "=", "ADIO_BGLOCKLESS", ";", "}", "else", "{", "#ifdef", "ROMIO_NTFS", "*", "fstype", "=", "ADIO_NTFS", ";", "#else", "*", "fstype", "=", "0", ";", "*", "error_code", "=", "MPIO_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "myname", ",", "__LINE__", ",", "MPI_ERR_NO_SUCH_FILE", ",", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", ";", "#endif", "}", "}" ]
ADIO_FileSysType_prefix - determines file system type for a file using a prefix on the file name.
[ "ADIO_FileSysType_prefix", "-", "determines", "file", "system", "type", "for", "a", "file", "using", "a", "prefix", "on", "the", "file", "name", "." ]
[ "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */" ]
[ { "param": "filename", "type": "char" }, { "param": "fstype", "type": "int" }, { "param": "error_code", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fstype", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "error_code", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d34a6a228f14eef02f63e45271dc3f28c25f71d
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_win_lock.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_pop_waiter
int
static int MPIDU_pop_waiter(MPID_Win *win, int *rank, int *type, MPIDU_Onesided_ctl_t *ackinfo) { struct mpid_lock_waiter wp; struct mpid_resource *lq = MPIDU_WIN_LOCK_QUEUE(win)->blocks; int lt; if (lq == NULL || lq->next_used == NULL) { return 1; /* no one waiting */ } if (MPIDU_peek_element(MPIDU_WIN_LOCK_QUEUE(win), &wp)) { return 1; /* no one waiting */ } if (!rank && !type && wp.lock_type != 0) { return 1; /* not our marker... */ } lt = local_lock_type(win); if (lt == MPI_LOCK_EXCLUSIVE || (lt != 0 && lt != wp.lock_type)) { return 1; /* not a compatible waiter */ } (void)MPIDU_pop_element(MPIDU_WIN_LOCK_QUEUE(win), NULL); if (rank) { *rank = wp.waiter_rank; } if (type) { *type = wp.lock_type; } if (ackinfo) { *ackinfo = wp.ackinfo; } return 0; }
/** * \brief Conditionally pops next waiter off lock wait queue. * * Returns the next waiter on the window lock, provided its desired * lock type is compatible with the current lock status. * Fills in rank, type, and ackinfo with pertinent data, * on success. Called by unlock (recv callback). If lock status * (after the unlock) is (still) shared, then the next waiter must * want shared (probably not a likely scenario since it should have * been granted the lock when requested). However, this check ensures * that an exclusive lock waiter cannot grab a lock that is still in * shared mode. Typically called from unlock receive callback. * * \param[in] win Pointer to MPID_Win structure * \param[out] rank Rank of origin (locker) * \param[out] type Type of lock being requested * \param[out] ackinfo Additional info from original lock call (may be NULL) * \return 0 if lock waiter was popped, or * 1 if the queue was empty or next waiter incompatible * * \ref lock_design\n * \ref rsrc_design\n * \ref lock_wait_design */
\brief Conditionally pops next waiter off lock wait queue. Returns the next waiter on the window lock, provided its desired lock type is compatible with the current lock status. Fills in rank, type, and ackinfo with pertinent data, on success. Called by unlock (recv callback). If lock status (after the unlock) is (still) shared, then the next waiter must want shared (probably not a likely scenario since it should have been granted the lock when requested). However, this check ensures that an exclusive lock waiter cannot grab a lock that is still in shared mode. Typically called from unlock receive callback.
[ "\\", "brief", "Conditionally", "pops", "next", "waiter", "off", "lock", "wait", "queue", ".", "Returns", "the", "next", "waiter", "on", "the", "window", "lock", "provided", "its", "desired", "lock", "type", "is", "compatible", "with", "the", "current", "lock", "status", ".", "Fills", "in", "rank", "type", "and", "ackinfo", "with", "pertinent", "data", "on", "success", ".", "Called", "by", "unlock", "(", "recv", "callback", ")", ".", "If", "lock", "status", "(", "after", "the", "unlock", ")", "is", "(", "still", ")", "shared", "then", "the", "next", "waiter", "must", "want", "shared", "(", "probably", "not", "a", "likely", "scenario", "since", "it", "should", "have", "been", "granted", "the", "lock", "when", "requested", ")", ".", "However", "this", "check", "ensures", "that", "an", "exclusive", "lock", "waiter", "cannot", "grab", "a", "lock", "that", "is", "still", "in", "shared", "mode", ".", "Typically", "called", "from", "unlock", "receive", "callback", "." ]
static int MPIDU_pop_waiter(MPID_Win *win, int *rank, int *type, MPIDU_Onesided_ctl_t *ackinfo) { struct mpid_lock_waiter wp; struct mpid_resource *lq = MPIDU_WIN_LOCK_QUEUE(win)->blocks; int lt; if (lq == NULL || lq->next_used == NULL) { return 1; } if (MPIDU_peek_element(MPIDU_WIN_LOCK_QUEUE(win), &wp)) { return 1; } if (!rank && !type && wp.lock_type != 0) { return 1; } lt = local_lock_type(win); if (lt == MPI_LOCK_EXCLUSIVE || (lt != 0 && lt != wp.lock_type)) { return 1; } (void)MPIDU_pop_element(MPIDU_WIN_LOCK_QUEUE(win), NULL); if (rank) { *rank = wp.waiter_rank; } if (type) { *type = wp.lock_type; } if (ackinfo) { *ackinfo = wp.ackinfo; } return 0; }
[ "static", "int", "MPIDU_pop_waiter", "(", "MPID_Win", "*", "win", ",", "int", "*", "rank", ",", "int", "*", "type", ",", "MPIDU_Onesided_ctl_t", "*", "ackinfo", ")", "{", "struct", "mpid_lock_waiter", "wp", ";", "struct", "mpid_resource", "*", "lq", "=", "MPIDU_WIN_LOCK_QUEUE", "(", "win", ")", "->", "blocks", ";", "int", "lt", ";", "if", "(", "lq", "==", "NULL", "||", "lq", "->", "next_used", "==", "NULL", ")", "{", "return", "1", ";", "}", "if", "(", "MPIDU_peek_element", "(", "MPIDU_WIN_LOCK_QUEUE", "(", "win", ")", ",", "&", "wp", ")", ")", "{", "return", "1", ";", "}", "if", "(", "!", "rank", "&&", "!", "type", "&&", "wp", ".", "lock_type", "!=", "0", ")", "{", "return", "1", ";", "}", "lt", "=", "local_lock_type", "(", "win", ")", ";", "if", "(", "lt", "==", "MPI_LOCK_EXCLUSIVE", "||", "(", "lt", "!=", "0", "&&", "lt", "!=", "wp", ".", "lock_type", ")", ")", "{", "return", "1", ";", "}", "(", "void", ")", "MPIDU_pop_element", "(", "MPIDU_WIN_LOCK_QUEUE", "(", "win", ")", ",", "NULL", ")", ";", "if", "(", "rank", ")", "{", "*", "rank", "=", "wp", ".", "waiter_rank", ";", "}", "if", "(", "type", ")", "{", "*", "type", "=", "wp", ".", "lock_type", ";", "}", "if", "(", "ackinfo", ")", "{", "*", "ackinfo", "=", "wp", ".", "ackinfo", ";", "}", "return", "0", ";", "}" ]
\brief Conditionally pops next waiter off lock wait queue.
[ "\\", "brief", "Conditionally", "pops", "next", "waiter", "off", "lock", "wait", "queue", "." ]
[ "/* no one waiting */", "/* no one waiting */", "/* not our marker... */", "/* not a compatible waiter */" ]
[ { "param": "win", "type": "MPID_Win" }, { "param": "rank", "type": "int" }, { "param": "type", "type": "int" }, { "param": "ackinfo", "type": "MPIDU_Onesided_ctl_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "MPID_Win", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rank", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ackinfo", "type": "MPIDU_Onesided_ctl_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d34a6a228f14eef02f63e45271dc3f28c25f71d
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_win_lock.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_Spin_lock_free
void
void MPIDU_Spin_lock_free(MPID_Win *win) { MPIDU_add_waiter(win, 0, 0, NULL); MPIDU_Progress_spin(!MPID_LOCK_IS_FREE(win)); MPIDU_pop_waiter(win, NULL, NULL, NULL); }
/** * \brief Progress (advance) wait for window lock to be released * * Adds a dummy waiter to the lock wait queue, so ensure that * unlock will eventually give us a chance. * * Called from various epoch-start code to ensure no other node is * accessing our window while we are in another epoch. * * \todo Probably sohuld assert that the popped waiter, * if any, was our NULL one. * * \param[in] win Pointer to MPID_Win object * \return nothing */
\brief Progress (advance) wait for window lock to be released Adds a dummy waiter to the lock wait queue, so ensure that unlock will eventually give us a chance. Called from various epoch-start code to ensure no other node is accessing our window while we are in another epoch. \todo Probably sohuld assert that the popped waiter, if any, was our NULL one. \param[in] win Pointer to MPID_Win object \return nothing
[ "\\", "brief", "Progress", "(", "advance", ")", "wait", "for", "window", "lock", "to", "be", "released", "Adds", "a", "dummy", "waiter", "to", "the", "lock", "wait", "queue", "so", "ensure", "that", "unlock", "will", "eventually", "give", "us", "a", "chance", ".", "Called", "from", "various", "epoch", "-", "start", "code", "to", "ensure", "no", "other", "node", "is", "accessing", "our", "window", "while", "we", "are", "in", "another", "epoch", ".", "\\", "todo", "Probably", "sohuld", "assert", "that", "the", "popped", "waiter", "if", "any", "was", "our", "NULL", "one", ".", "\\", "param", "[", "in", "]", "win", "Pointer", "to", "MPID_Win", "object", "\\", "return", "nothing" ]
void MPIDU_Spin_lock_free(MPID_Win *win) { MPIDU_add_waiter(win, 0, 0, NULL); MPIDU_Progress_spin(!MPID_LOCK_IS_FREE(win)); MPIDU_pop_waiter(win, NULL, NULL, NULL); }
[ "void", "MPIDU_Spin_lock_free", "(", "MPID_Win", "*", "win", ")", "{", "MPIDU_add_waiter", "(", "win", ",", "0", ",", "0", ",", "NULL", ")", ";", "MPIDU_Progress_spin", "(", "!", "MPID_LOCK_IS_FREE", "(", "win", ")", ")", ";", "MPIDU_pop_waiter", "(", "win", ",", "NULL", ",", "NULL", ",", "NULL", ")", ";", "}" ]
\brief Progress (advance) wait for window lock to be released Adds a dummy waiter to the lock wait queue, so ensure that unlock will eventually give us a chance.
[ "\\", "brief", "Progress", "(", "advance", ")", "wait", "for", "window", "lock", "to", "be", "released", "Adds", "a", "dummy", "waiter", "to", "the", "lock", "wait", "queue", "so", "ensure", "that", "unlock", "will", "eventually", "give", "us", "a", "chance", "." ]
[]
[ { "param": "win", "type": "MPID_Win" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "MPID_Win", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d34a6a228f14eef02f63e45271dc3f28c25f71d
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_win_lock.c
[ "Intel", "mpich2", "Unlicense" ]
C
mpid_match_unlk
int
static int mpid_match_unlk(void *v1, void *v2, void *v3) { struct mpid_unlk_entry *w1 = (struct mpid_unlk_entry *)v1; struct mpid_unlk_entry *w2 = (struct mpid_unlk_entry *)v2; return (w1->rank != w2->rank || w1->rmas < w2->rmas); }
/** * \brief Callback function to match unlock wait queue entry * * 'v1' is a struct mpid_unlk_entry with rank and rmas filled in with * desired origin rank and current RMA ops count from origin. * 'v2' is the (currrent) struct mpid_unlk_entry being examined as * a potential match. * * Returns success (match) if an unlock element exists with origin rank * and the expected RMA ops count from that rank has been reached. * * \param[in] v1 Desired unlock queue pseudo-element * \param[in] v2 Unlock queue element to compare with 'v1' * \param[in] v3 not used * \return boolean indicating if 'v2' matches 'v1'. * * \ref unlk_wait_design */
\brief Callback function to match unlock wait queue entry 'v1' is a struct mpid_unlk_entry with rank and rmas filled in with desired origin rank and current RMA ops count from origin. 'v2' is the (currrent) struct mpid_unlk_entry being examined as a potential match. Returns success (match) if an unlock element exists with origin rank and the expected RMA ops count from that rank has been reached.
[ "\\", "brief", "Callback", "function", "to", "match", "unlock", "wait", "queue", "entry", "'", "v1", "'", "is", "a", "struct", "mpid_unlk_entry", "with", "rank", "and", "rmas", "filled", "in", "with", "desired", "origin", "rank", "and", "current", "RMA", "ops", "count", "from", "origin", ".", "'", "v2", "'", "is", "the", "(", "currrent", ")", "struct", "mpid_unlk_entry", "being", "examined", "as", "a", "potential", "match", ".", "Returns", "success", "(", "match", ")", "if", "an", "unlock", "element", "exists", "with", "origin", "rank", "and", "the", "expected", "RMA", "ops", "count", "from", "that", "rank", "has", "been", "reached", "." ]
static int mpid_match_unlk(void *v1, void *v2, void *v3) { struct mpid_unlk_entry *w1 = (struct mpid_unlk_entry *)v1; struct mpid_unlk_entry *w2 = (struct mpid_unlk_entry *)v2; return (w1->rank != w2->rank || w1->rmas < w2->rmas); }
[ "static", "int", "mpid_match_unlk", "(", "void", "*", "v1", ",", "void", "*", "v2", ",", "void", "*", "v3", ")", "{", "struct", "mpid_unlk_entry", "*", "w1", "=", "(", "struct", "mpid_unlk_entry", "*", ")", "v1", ";", "struct", "mpid_unlk_entry", "*", "w2", "=", "(", "struct", "mpid_unlk_entry", "*", ")", "v2", ";", "return", "(", "w1", "->", "rank", "!=", "w2", "->", "rank", "||", "w1", "->", "rmas", "<", "w2", "->", "rmas", ")", ";", "}" ]
\brief Callback function to match unlock wait queue entry 'v1' is a struct mpid_unlk_entry with rank and rmas filled in with desired origin rank and current RMA ops count from origin.
[ "\\", "brief", "Callback", "function", "to", "match", "unlock", "wait", "queue", "entry", "'", "v1", "'", "is", "a", "struct", "mpid_unlk_entry", "with", "rank", "and", "rmas", "filled", "in", "with", "desired", "origin", "rank", "and", "current", "RMA", "ops", "count", "from", "origin", "." ]
[]
[ { "param": "v1", "type": "void" }, { "param": "v2", "type": "void" }, { "param": "v3", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v2", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v3", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d34a6a228f14eef02f63e45271dc3f28c25f71d
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_win_lock.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDU_locate_unlk
null
static struct mpid_unlk_entry *MPIDU_locate_unlk(MPID_Win *win, int rank, MPIDU_Onesided_ctl_t *ctl) { struct mpid_unlk_entry el, *ep; struct mpid_element *pp = NULL; el.rank = rank; el.rmas = win->_dev.coll_info[rank].rma_sends; ep = MPIDU_find_element(MPIDU_WIN_UNLK_QUEUE(win), mpid_match_unlk, NULL, &el, &pp); if (ep) { if (ctl) { ctl->mpid_ctl_w0 = MPID_MSGTYPE_UNLOCK; ctl->mpid_ctl_w1 = win->handle; ctl->mpid_ctl_w2 = ep->rank; ctl->mpid_ctl_w3 = ep->rmas; } MPIDU_free_element(MPIDU_WIN_UNLK_QUEUE(win), ep, pp); } return ep; }
/** * \brief Locate the desired unlocker if it is waiting * * Does not return success unless the RMA ops counters match. * * \param[in] win Pointer to window * \param[in] rank Origin rank (unlocker) * \param[out] ctl Reconstructed UNLOCK message, if unlocker found * * \ref unlk_wait_design * \ref msginfo_usage */
\brief Locate the desired unlocker if it is waiting Does not return success unless the RMA ops counters match. \param[in] win Pointer to window \param[in] rank Origin rank (unlocker) \param[out] ctl Reconstructed UNLOCK message, if unlocker found
[ "\\", "brief", "Locate", "the", "desired", "unlocker", "if", "it", "is", "waiting", "Does", "not", "return", "success", "unless", "the", "RMA", "ops", "counters", "match", ".", "\\", "param", "[", "in", "]", "win", "Pointer", "to", "window", "\\", "param", "[", "in", "]", "rank", "Origin", "rank", "(", "unlocker", ")", "\\", "param", "[", "out", "]", "ctl", "Reconstructed", "UNLOCK", "message", "if", "unlocker", "found" ]
static struct mpid_unlk_entry *MPIDU_locate_unlk(MPID_Win *win, int rank, MPIDU_Onesided_ctl_t *ctl) { struct mpid_unlk_entry el, *ep; struct mpid_element *pp = NULL; el.rank = rank; el.rmas = win->_dev.coll_info[rank].rma_sends; ep = MPIDU_find_element(MPIDU_WIN_UNLK_QUEUE(win), mpid_match_unlk, NULL, &el, &pp); if (ep) { if (ctl) { ctl->mpid_ctl_w0 = MPID_MSGTYPE_UNLOCK; ctl->mpid_ctl_w1 = win->handle; ctl->mpid_ctl_w2 = ep->rank; ctl->mpid_ctl_w3 = ep->rmas; } MPIDU_free_element(MPIDU_WIN_UNLK_QUEUE(win), ep, pp); } return ep; }
[ "static", "struct", "mpid_unlk_entry", "*", "MPIDU_locate_unlk", "(", "MPID_Win", "*", "win", ",", "int", "rank", ",", "MPIDU_Onesided_ctl_t", "*", "ctl", ")", "{", "struct", "mpid_unlk_entry", "el", ",", "*", "ep", ";", "struct", "mpid_element", "*", "pp", "=", "NULL", ";", "el", ".", "rank", "=", "rank", ";", "el", ".", "rmas", "=", "win", "->", "_dev", ".", "coll_info", "[", "rank", "]", ".", "rma_sends", ";", "ep", "=", "MPIDU_find_element", "(", "MPIDU_WIN_UNLK_QUEUE", "(", "win", ")", ",", "mpid_match_unlk", ",", "NULL", ",", "&", "el", ",", "&", "pp", ")", ";", "if", "(", "ep", ")", "{", "if", "(", "ctl", ")", "{", "ctl", "->", "mpid_ctl_w0", "=", "MPID_MSGTYPE_UNLOCK", ";", "ctl", "->", "mpid_ctl_w1", "=", "win", "->", "handle", ";", "ctl", "->", "mpid_ctl_w2", "=", "ep", "->", "rank", ";", "ctl", "->", "mpid_ctl_w3", "=", "ep", "->", "rmas", ";", "}", "MPIDU_free_element", "(", "MPIDU_WIN_UNLK_QUEUE", "(", "win", ")", ",", "ep", ",", "pp", ")", ";", "}", "return", "ep", ";", "}" ]
\brief Locate the desired unlocker if it is waiting Does not return success unless the RMA ops counters match.
[ "\\", "brief", "Locate", "the", "desired", "unlocker", "if", "it", "is", "waiting", "Does", "not", "return", "success", "unless", "the", "RMA", "ops", "counters", "match", "." ]
[]
[ { "param": "win", "type": "MPID_Win" }, { "param": "rank", "type": "int" }, { "param": "ctl", "type": "MPIDU_Onesided_ctl_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "MPID_Win", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rank", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ctl", "type": "MPIDU_Onesided_ctl_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d34a6a228f14eef02f63e45271dc3f28c25f71d
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_win_lock.c
[ "Intel", "mpich2", "Unlicense" ]
C
rma_recvs_cb
void
void rma_recvs_cb(MPID_Win *win, int orig, int lpid, int count) { win->_dev.my_rma_recvs += count; if (!MPID_LOCK_IS_FREE(win)) { struct mpid_unlk_entry *ep; MPIDU_Onesided_ctl_t ctl; win->_dev.coll_info[orig].rma_sends += count; ep = MPIDU_locate_unlk(win, orig, &ctl); if (ep) { unlk_cb(&ctl, lpid); } } }
/** * \brief Callback invoked to count an RMA operation received * * Increments window's \e my_rma_recvs counter. * If window lock is held, then also increment RMA counter * for specific origin node, and check whether this RMA op * completes the epoch and an unlock is waiting to be processed. * * We use \e rma_sends to count received RMA ops because we * know we won't be using that to count sent RMA ops since * we cannot be in an access epoch while in a LOCK exposure epoch. * * Called from both the "long message" completion callbacks and * the "short message" receive callback, in case of PUT or * ACCUMULATE only. * * \param[in] win Pointer to MPID_Win object * \param[in] orig Rank of originator of RMA operation * \param[in] lpid lpid of originator of RMA operation * \return nothing */
\brief Callback invoked to count an RMA operation received Increments window's \e my_rma_recvs counter. If window lock is held, then also increment RMA counter for specific origin node, and check whether this RMA op completes the epoch and an unlock is waiting to be processed. We use \e rma_sends to count received RMA ops because we know we won't be using that to count sent RMA ops since we cannot be in an access epoch while in a LOCK exposure epoch. Called from both the "long message" completion callbacks and the "short message" receive callback, in case of PUT or ACCUMULATE only. \param[in] win Pointer to MPID_Win object \param[in] orig Rank of originator of RMA operation \param[in] lpid lpid of originator of RMA operation \return nothing
[ "\\", "brief", "Callback", "invoked", "to", "count", "an", "RMA", "operation", "received", "Increments", "window", "'", "s", "\\", "e", "my_rma_recvs", "counter", ".", "If", "window", "lock", "is", "held", "then", "also", "increment", "RMA", "counter", "for", "specific", "origin", "node", "and", "check", "whether", "this", "RMA", "op", "completes", "the", "epoch", "and", "an", "unlock", "is", "waiting", "to", "be", "processed", ".", "We", "use", "\\", "e", "rma_sends", "to", "count", "received", "RMA", "ops", "because", "we", "know", "we", "won", "'", "t", "be", "using", "that", "to", "count", "sent", "RMA", "ops", "since", "we", "cannot", "be", "in", "an", "access", "epoch", "while", "in", "a", "LOCK", "exposure", "epoch", ".", "Called", "from", "both", "the", "\"", "long", "message", "\"", "completion", "callbacks", "and", "the", "\"", "short", "message", "\"", "receive", "callback", "in", "case", "of", "PUT", "or", "ACCUMULATE", "only", ".", "\\", "param", "[", "in", "]", "win", "Pointer", "to", "MPID_Win", "object", "\\", "param", "[", "in", "]", "orig", "Rank", "of", "originator", "of", "RMA", "operation", "\\", "param", "[", "in", "]", "lpid", "lpid", "of", "originator", "of", "RMA", "operation", "\\", "return", "nothing" ]
void rma_recvs_cb(MPID_Win *win, int orig, int lpid, int count) { win->_dev.my_rma_recvs += count; if (!MPID_LOCK_IS_FREE(win)) { struct mpid_unlk_entry *ep; MPIDU_Onesided_ctl_t ctl; win->_dev.coll_info[orig].rma_sends += count; ep = MPIDU_locate_unlk(win, orig, &ctl); if (ep) { unlk_cb(&ctl, lpid); } } }
[ "void", "rma_recvs_cb", "(", "MPID_Win", "*", "win", ",", "int", "orig", ",", "int", "lpid", ",", "int", "count", ")", "{", "win", "->", "_dev", ".", "my_rma_recvs", "+=", "count", ";", "if", "(", "!", "MPID_LOCK_IS_FREE", "(", "win", ")", ")", "{", "struct", "mpid_unlk_entry", "*", "ep", ";", "MPIDU_Onesided_ctl_t", "ctl", ";", "win", "->", "_dev", ".", "coll_info", "[", "orig", "]", ".", "rma_sends", "+=", "count", ";", "ep", "=", "MPIDU_locate_unlk", "(", "win", ",", "orig", ",", "&", "ctl", ")", ";", "if", "(", "ep", ")", "{", "unlk_cb", "(", "&", "ctl", ",", "lpid", ")", ";", "}", "}", "}" ]
\brief Callback invoked to count an RMA operation received Increments window's \e my_rma_recvs counter.
[ "\\", "brief", "Callback", "invoked", "to", "count", "an", "RMA", "operation", "received", "Increments", "window", "'", "s", "\\", "e", "my_rma_recvs", "counter", "." ]
[]
[ { "param": "win", "type": "MPID_Win" }, { "param": "orig", "type": "int" }, { "param": "lpid", "type": "int" }, { "param": "count", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "MPID_Win", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "orig", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lpid", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d34a6a228f14eef02f63e45271dc3f28c25f71d
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_win_lock.c
[ "Intel", "mpich2", "Unlicense" ]
C
epoch_end_cb
void
void epoch_end_cb(MPID_Win *win) { int rank, type, lpid; MPIDU_Onesided_ctl_t info; int ret; /* * Wake up any waiting lockers. * * This works in the case of a shared-lock release when not all * lockers have released (no compatible waiter will be found). * * This also works in the case of non-lock epochs ending. * * An epoch-start call will spin waiting for lock to be released. * Before spinning, it will queue a waiter with lock type 0 (none), * so that this loop will not block progress indefinitely. */ while (MPIDU_pop_waiter(win, &rank, &type, &info) == 0 && type != 0) { /* compatible waiter found */ ret = local_lock(win, rank, type); MPID_assert_debug(ret != 0); if (info.mpid_ctl_w0 == 0) { /* local request */ ++win->_dev.my_sync_done; } else { win->_dev.epoch_rma_ok = 1; lpid = info.mpid_ctl_w2; (void) DCMF_Control(&bg1s_ct_proto, win->_dev.my_cstcy, lpid, &info.ctl); } } }
/** * \brief Epoch End callback. * * Called whenever epoch_type is set to MPID_EPOTYPE_NONE, i.e. an * access/exposure epoch ends. Also called when the window lock is * released (by the origin node). * * This is used to prevent locks from being acquired while some other * access/exposure epoch is active on a window, and queues the lock * attempt until such time as the epoch has ended. * * \param[in] win Pointer to MPID_Win whose epoch has ended */
\brief Epoch End callback. Called whenever epoch_type is set to MPID_EPOTYPE_NONE, i.e. an access/exposure epoch ends. Also called when the window lock is released (by the origin node). This is used to prevent locks from being acquired while some other access/exposure epoch is active on a window, and queues the lock attempt until such time as the epoch has ended. \param[in] win Pointer to MPID_Win whose epoch has ended
[ "\\", "brief", "Epoch", "End", "callback", ".", "Called", "whenever", "epoch_type", "is", "set", "to", "MPID_EPOTYPE_NONE", "i", ".", "e", ".", "an", "access", "/", "exposure", "epoch", "ends", ".", "Also", "called", "when", "the", "window", "lock", "is", "released", "(", "by", "the", "origin", "node", ")", ".", "This", "is", "used", "to", "prevent", "locks", "from", "being", "acquired", "while", "some", "other", "access", "/", "exposure", "epoch", "is", "active", "on", "a", "window", "and", "queues", "the", "lock", "attempt", "until", "such", "time", "as", "the", "epoch", "has", "ended", ".", "\\", "param", "[", "in", "]", "win", "Pointer", "to", "MPID_Win", "whose", "epoch", "has", "ended" ]
void epoch_end_cb(MPID_Win *win) { int rank, type, lpid; MPIDU_Onesided_ctl_t info; int ret; while (MPIDU_pop_waiter(win, &rank, &type, &info) == 0 && type != 0) { ret = local_lock(win, rank, type); MPID_assert_debug(ret != 0); if (info.mpid_ctl_w0 == 0) { ++win->_dev.my_sync_done; } else { win->_dev.epoch_rma_ok = 1; lpid = info.mpid_ctl_w2; (void) DCMF_Control(&bg1s_ct_proto, win->_dev.my_cstcy, lpid, &info.ctl); } } }
[ "void", "epoch_end_cb", "(", "MPID_Win", "*", "win", ")", "{", "int", "rank", ",", "type", ",", "lpid", ";", "MPIDU_Onesided_ctl_t", "info", ";", "int", "ret", ";", "while", "(", "MPIDU_pop_waiter", "(", "win", ",", "&", "rank", ",", "&", "type", ",", "&", "info", ")", "==", "0", "&&", "type", "!=", "0", ")", "{", "ret", "=", "local_lock", "(", "win", ",", "rank", ",", "type", ")", ";", "MPID_assert_debug", "(", "ret", "!=", "0", ")", ";", "if", "(", "info", ".", "mpid_ctl_w0", "==", "0", ")", "{", "++", "win", "->", "_dev", ".", "my_sync_done", ";", "}", "else", "{", "win", "->", "_dev", ".", "epoch_rma_ok", "=", "1", ";", "lpid", "=", "info", ".", "mpid_ctl_w2", ";", "(", "void", ")", "DCMF_Control", "(", "&", "bg1s_ct_proto", ",", "win", "->", "_dev", ".", "my_cstcy", ",", "lpid", ",", "&", "info", ".", "ctl", ")", ";", "}", "}", "}" ]
\brief Epoch End callback.
[ "\\", "brief", "Epoch", "End", "callback", "." ]
[ "/*\n * Wake up any waiting lockers.\n *\n * This works in the case of a shared-lock release when not all\n * lockers have released (no compatible waiter will be found).\n *\n * This also works in the case of non-lock epochs ending.\n *\n * An epoch-start call will spin waiting for lock to be released.\n * Before spinning, it will queue a waiter with lock type 0 (none),\n * so that this loop will not block progress indefinitely.\n */", "/* compatible waiter found */", "/* local request */" ]
[ { "param": "win", "type": "MPID_Win" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "win", "type": "MPID_Win", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d34a6a228f14eef02f63e45271dc3f28c25f71d
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/onesided/mpid_win_lock.c
[ "Intel", "mpich2", "Unlicense" ]
C
unlk_cb
void
void unlk_cb(const MPIDU_Onesided_ctl_t *info, int lpid) { MPID_Win *win; unsigned ret; int orig, rmas; MPID_assert_debug(info->mpid_ctl_w0 == MPID_MSGTYPE_UNLOCK); MPID_Win_get_ptr((MPI_Win)info->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); orig = info->mpid_ctl_w2; rmas = info->mpid_ctl_w3; ret = ((rmas && win->_dev.coll_info[orig].rma_sends < rmas) || local_unlock(win, orig)); if (ret) { /* lock was released */ MPIDU_Onesided_ctl_t ack; if (MPID_LOCK_IS_FREE(win)) { epoch_clear(win); } epoch_end_cb(win); ack.mpid_ctl_w0 = MPID_MSGTYPE_UNLOCKACK; ack.mpid_ctl_w1 = win->_dev.coll_info[orig].win_handle; ack.mpid_ctl_w2 = mpid_my_lpid; ack.mpid_ctl_w3 = 0; (void) DCMF_Control(&bg1s_ct_proto, win->_dev.my_cstcy, lpid, &ack.ctl); } else { MPIDU_add_unlk(win, orig, info); } }
/** * \brief Unlock receive callback. * * Attempts to release the lock. * If the lock cannot be released (due to outstanding RMA ops not * yet received) then the unlocker is placed on a queue where its * request will be re-evaluated when RMA ops are received. * If lock can be released, any lock waiters are woken up in * \e epoch_end_cb() and an MPID_MSGTYPE_UNLOCKACK is sent to the unlocker. * * \param[in] info Pointer to msginfo from origin (unlocker) * \param[in] lpid lpid of origin node (unlocker) * \return nothing * * \ref msginfo_usage\n * \ref lock_design */
\brief Unlock receive callback. Attempts to release the lock. If the lock cannot be released (due to outstanding RMA ops not yet received) then the unlocker is placed on a queue where its request will be re-evaluated when RMA ops are received. If lock can be released, any lock waiters are woken up in \e epoch_end_cb() and an MPID_MSGTYPE_UNLOCKACK is sent to the unlocker. \param[in] info Pointer to msginfo from origin (unlocker) \param[in] lpid lpid of origin node (unlocker) \return nothing
[ "\\", "brief", "Unlock", "receive", "callback", ".", "Attempts", "to", "release", "the", "lock", ".", "If", "the", "lock", "cannot", "be", "released", "(", "due", "to", "outstanding", "RMA", "ops", "not", "yet", "received", ")", "then", "the", "unlocker", "is", "placed", "on", "a", "queue", "where", "its", "request", "will", "be", "re", "-", "evaluated", "when", "RMA", "ops", "are", "received", ".", "If", "lock", "can", "be", "released", "any", "lock", "waiters", "are", "woken", "up", "in", "\\", "e", "epoch_end_cb", "()", "and", "an", "MPID_MSGTYPE_UNLOCKACK", "is", "sent", "to", "the", "unlocker", ".", "\\", "param", "[", "in", "]", "info", "Pointer", "to", "msginfo", "from", "origin", "(", "unlocker", ")", "\\", "param", "[", "in", "]", "lpid", "lpid", "of", "origin", "node", "(", "unlocker", ")", "\\", "return", "nothing" ]
void unlk_cb(const MPIDU_Onesided_ctl_t *info, int lpid) { MPID_Win *win; unsigned ret; int orig, rmas; MPID_assert_debug(info->mpid_ctl_w0 == MPID_MSGTYPE_UNLOCK); MPID_Win_get_ptr((MPI_Win)info->mpid_ctl_w1, win); MPID_assert_debug(win != NULL); orig = info->mpid_ctl_w2; rmas = info->mpid_ctl_w3; ret = ((rmas && win->_dev.coll_info[orig].rma_sends < rmas) || local_unlock(win, orig)); if (ret) { MPIDU_Onesided_ctl_t ack; if (MPID_LOCK_IS_FREE(win)) { epoch_clear(win); } epoch_end_cb(win); ack.mpid_ctl_w0 = MPID_MSGTYPE_UNLOCKACK; ack.mpid_ctl_w1 = win->_dev.coll_info[orig].win_handle; ack.mpid_ctl_w2 = mpid_my_lpid; ack.mpid_ctl_w3 = 0; (void) DCMF_Control(&bg1s_ct_proto, win->_dev.my_cstcy, lpid, &ack.ctl); } else { MPIDU_add_unlk(win, orig, info); } }
[ "void", "unlk_cb", "(", "const", "MPIDU_Onesided_ctl_t", "*", "info", ",", "int", "lpid", ")", "{", "MPID_Win", "*", "win", ";", "unsigned", "ret", ";", "int", "orig", ",", "rmas", ";", "MPID_assert_debug", "(", "info", "->", "mpid_ctl_w0", "==", "MPID_MSGTYPE_UNLOCK", ")", ";", "MPID_Win_get_ptr", "(", "(", "MPI_Win", ")", "info", "->", "mpid_ctl_w1", ",", "win", ")", ";", "MPID_assert_debug", "(", "win", "!=", "NULL", ")", ";", "orig", "=", "info", "->", "mpid_ctl_w2", ";", "rmas", "=", "info", "->", "mpid_ctl_w3", ";", "ret", "=", "(", "(", "rmas", "&&", "win", "->", "_dev", ".", "coll_info", "[", "orig", "]", ".", "rma_sends", "<", "rmas", ")", "||", "local_unlock", "(", "win", ",", "orig", ")", ")", ";", "if", "(", "ret", ")", "{", "MPIDU_Onesided_ctl_t", "ack", ";", "if", "(", "MPID_LOCK_IS_FREE", "(", "win", ")", ")", "{", "epoch_clear", "(", "win", ")", ";", "}", "epoch_end_cb", "(", "win", ")", ";", "ack", ".", "mpid_ctl_w0", "=", "MPID_MSGTYPE_UNLOCKACK", ";", "ack", ".", "mpid_ctl_w1", "=", "win", "->", "_dev", ".", "coll_info", "[", "orig", "]", ".", "win_handle", ";", "ack", ".", "mpid_ctl_w2", "=", "mpid_my_lpid", ";", "ack", ".", "mpid_ctl_w3", "=", "0", ";", "(", "void", ")", "DCMF_Control", "(", "&", "bg1s_ct_proto", ",", "win", "->", "_dev", ".", "my_cstcy", ",", "lpid", ",", "&", "ack", ".", "ctl", ")", ";", "}", "else", "{", "MPIDU_add_unlk", "(", "win", ",", "orig", ",", "info", ")", ";", "}", "}" ]
\brief Unlock receive callback.
[ "\\", "brief", "Unlock", "receive", "callback", "." ]
[ "/* lock was released */" ]
[ { "param": "info", "type": "MPIDU_Onesided_ctl_t" }, { "param": "lpid", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "info", "type": "MPIDU_Onesided_ctl_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lpid", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71073f27f7a8f75c490f708927a3ac3d8b32c378
graingert/MPICH2-Armel-Raspberry-Pi-1
src/pm/smpd/mp_parse_command_line.c
[ "Intel", "mpich2", "Unlicense" ]
C
NeedToMap
SMPD_BOOL
SMPD_BOOL NeedToMap(char *pszFullPath, char *pDrive, char *pszShare) { DWORD dwResult; DWORD dwLength; char pBuffer[4096]; REMOTE_NAME_INFO *info = (REMOTE_NAME_INFO*)pBuffer; char pszTemp[SMPD_MAX_EXE_LENGTH]; if (*pszFullPath == '"') { strncpy(pszTemp, &pszFullPath[1], SMPD_MAX_EXE_LENGTH); pszTemp[SMPD_MAX_EXE_LENGTH-1] = '\0'; if (pszTemp[strlen(pszTemp)-1] == '"') pszTemp[strlen(pszTemp)-1] = '\0'; pszFullPath = pszTemp; } dwLength = 4096; info->lpConnectionName = NULL; info->lpRemainingPath = NULL; info->lpUniversalName = NULL; dwResult = WNetGetUniversalName(pszFullPath, REMOTE_NAME_INFO_LEVEL, info, &dwLength); if (dwResult == NO_ERROR) { *pDrive = *pszFullPath; strcpy(pszShare, info->lpConnectionName); return SMPD_TRUE; } /*printf("WNetGetUniversalName: '%s'\n error %d\n", pszExe, dwResult);*/ return SMPD_FALSE; }
/* check to see if a path is on a network mapped drive and would need to be mapped on a remote system */
check to see if a path is on a network mapped drive and would need to be mapped on a remote system
[ "check", "to", "see", "if", "a", "path", "is", "on", "a", "network", "mapped", "drive", "and", "would", "need", "to", "be", "mapped", "on", "a", "remote", "system" ]
SMPD_BOOL NeedToMap(char *pszFullPath, char *pDrive, char *pszShare) { DWORD dwResult; DWORD dwLength; char pBuffer[4096]; REMOTE_NAME_INFO *info = (REMOTE_NAME_INFO*)pBuffer; char pszTemp[SMPD_MAX_EXE_LENGTH]; if (*pszFullPath == '"') { strncpy(pszTemp, &pszFullPath[1], SMPD_MAX_EXE_LENGTH); pszTemp[SMPD_MAX_EXE_LENGTH-1] = '\0'; if (pszTemp[strlen(pszTemp)-1] == '"') pszTemp[strlen(pszTemp)-1] = '\0'; pszFullPath = pszTemp; } dwLength = 4096; info->lpConnectionName = NULL; info->lpRemainingPath = NULL; info->lpUniversalName = NULL; dwResult = WNetGetUniversalName(pszFullPath, REMOTE_NAME_INFO_LEVEL, info, &dwLength); if (dwResult == NO_ERROR) { *pDrive = *pszFullPath; strcpy(pszShare, info->lpConnectionName); return SMPD_TRUE; } return SMPD_FALSE; }
[ "SMPD_BOOL", "NeedToMap", "(", "char", "*", "pszFullPath", ",", "char", "*", "pDrive", ",", "char", "*", "pszShare", ")", "{", "DWORD", "dwResult", ";", "DWORD", "dwLength", ";", "char", "pBuffer", "[", "4096", "]", ";", "REMOTE_NAME_INFO", "*", "info", "=", "(", "REMOTE_NAME_INFO", "*", ")", "pBuffer", ";", "char", "pszTemp", "[", "SMPD_MAX_EXE_LENGTH", "]", ";", "if", "(", "*", "pszFullPath", "==", "'", "'", ")", "{", "strncpy", "(", "pszTemp", ",", "&", "pszFullPath", "[", "1", "]", ",", "SMPD_MAX_EXE_LENGTH", ")", ";", "pszTemp", "[", "SMPD_MAX_EXE_LENGTH", "-", "1", "]", "=", "'", "\\0", "'", ";", "if", "(", "pszTemp", "[", "strlen", "(", "pszTemp", ")", "-", "1", "]", "==", "'", "'", ")", "pszTemp", "[", "strlen", "(", "pszTemp", ")", "-", "1", "]", "=", "'", "\\0", "'", ";", "pszFullPath", "=", "pszTemp", ";", "}", "dwLength", "=", "4096", ";", "info", "->", "lpConnectionName", "=", "NULL", ";", "info", "->", "lpRemainingPath", "=", "NULL", ";", "info", "->", "lpUniversalName", "=", "NULL", ";", "dwResult", "=", "WNetGetUniversalName", "(", "pszFullPath", ",", "REMOTE_NAME_INFO_LEVEL", ",", "info", ",", "&", "dwLength", ")", ";", "if", "(", "dwResult", "==", "NO_ERROR", ")", "{", "*", "pDrive", "=", "*", "pszFullPath", ";", "strcpy", "(", "pszShare", ",", "info", "->", "lpConnectionName", ")", ";", "return", "SMPD_TRUE", ";", "}", "return", "SMPD_FALSE", ";", "}" ]
check to see if a path is on a network mapped drive and would need to be mapped on a remote system
[ "check", "to", "see", "if", "a", "path", "is", "on", "a", "network", "mapped", "drive", "and", "would", "need", "to", "be", "mapped", "on", "a", "remote", "system" ]
[ "/*printf(\"WNetGetUniversalName: '%s'\\n error %d\\n\", pszExe, dwResult);*/" ]
[ { "param": "pszFullPath", "type": "char" }, { "param": "pDrive", "type": "char" }, { "param": "pszShare", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pszFullPath", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pDrive", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pszShare", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71073f27f7a8f75c490f708927a3ac3d8b32c378
graingert/MPICH2-Armel-Raspberry-Pi-1
src/pm/smpd/mp_parse_command_line.c
[ "Intel", "mpich2", "Unlicense" ]
C
ExeToUnc
void
void ExeToUnc(char *pszExe, int length) { DWORD dwResult; DWORD dwLength; char pBuffer[4096]; REMOTE_NAME_INFO *info = (REMOTE_NAME_INFO*)pBuffer; char pszTemp[SMPD_MAX_EXE_LENGTH]; SMPD_BOOL bQuoted = SMPD_FALSE; char *pszOriginal; pszOriginal = pszExe; if (*pszExe == '"') { bQuoted = SMPD_TRUE; strncpy(pszTemp, &pszExe[1], SMPD_MAX_EXE_LENGTH); pszTemp[SMPD_MAX_EXE_LENGTH-1] = '\0'; if (pszTemp[strlen(pszTemp)-1] == '"') pszTemp[strlen(pszTemp)-1] = '\0'; pszExe = pszTemp; } dwLength = 4096; info->lpConnectionName = NULL; info->lpRemainingPath = NULL; info->lpUniversalName = NULL; dwResult = WNetGetUniversalName(pszExe, REMOTE_NAME_INFO_LEVEL, info, &dwLength); if (dwResult == NO_ERROR) { if (bQuoted) snprintf(pszOriginal, length, "\"%s\"", info->lpUniversalName); else { strncpy(pszOriginal, info->lpUniversalName, length); pszOriginal[length-1] = '\0'; } } }
/* convert an executable name to a universal naming convention version so that it can be used on a remote system */
convert an executable name to a universal naming convention version so that it can be used on a remote system
[ "convert", "an", "executable", "name", "to", "a", "universal", "naming", "convention", "version", "so", "that", "it", "can", "be", "used", "on", "a", "remote", "system" ]
void ExeToUnc(char *pszExe, int length) { DWORD dwResult; DWORD dwLength; char pBuffer[4096]; REMOTE_NAME_INFO *info = (REMOTE_NAME_INFO*)pBuffer; char pszTemp[SMPD_MAX_EXE_LENGTH]; SMPD_BOOL bQuoted = SMPD_FALSE; char *pszOriginal; pszOriginal = pszExe; if (*pszExe == '"') { bQuoted = SMPD_TRUE; strncpy(pszTemp, &pszExe[1], SMPD_MAX_EXE_LENGTH); pszTemp[SMPD_MAX_EXE_LENGTH-1] = '\0'; if (pszTemp[strlen(pszTemp)-1] == '"') pszTemp[strlen(pszTemp)-1] = '\0'; pszExe = pszTemp; } dwLength = 4096; info->lpConnectionName = NULL; info->lpRemainingPath = NULL; info->lpUniversalName = NULL; dwResult = WNetGetUniversalName(pszExe, REMOTE_NAME_INFO_LEVEL, info, &dwLength); if (dwResult == NO_ERROR) { if (bQuoted) snprintf(pszOriginal, length, "\"%s\"", info->lpUniversalName); else { strncpy(pszOriginal, info->lpUniversalName, length); pszOriginal[length-1] = '\0'; } } }
[ "void", "ExeToUnc", "(", "char", "*", "pszExe", ",", "int", "length", ")", "{", "DWORD", "dwResult", ";", "DWORD", "dwLength", ";", "char", "pBuffer", "[", "4096", "]", ";", "REMOTE_NAME_INFO", "*", "info", "=", "(", "REMOTE_NAME_INFO", "*", ")", "pBuffer", ";", "char", "pszTemp", "[", "SMPD_MAX_EXE_LENGTH", "]", ";", "SMPD_BOOL", "bQuoted", "=", "SMPD_FALSE", ";", "char", "*", "pszOriginal", ";", "pszOriginal", "=", "pszExe", ";", "if", "(", "*", "pszExe", "==", "'", "'", ")", "{", "bQuoted", "=", "SMPD_TRUE", ";", "strncpy", "(", "pszTemp", ",", "&", "pszExe", "[", "1", "]", ",", "SMPD_MAX_EXE_LENGTH", ")", ";", "pszTemp", "[", "SMPD_MAX_EXE_LENGTH", "-", "1", "]", "=", "'", "\\0", "'", ";", "if", "(", "pszTemp", "[", "strlen", "(", "pszTemp", ")", "-", "1", "]", "==", "'", "'", ")", "pszTemp", "[", "strlen", "(", "pszTemp", ")", "-", "1", "]", "=", "'", "\\0", "'", ";", "pszExe", "=", "pszTemp", ";", "}", "dwLength", "=", "4096", ";", "info", "->", "lpConnectionName", "=", "NULL", ";", "info", "->", "lpRemainingPath", "=", "NULL", ";", "info", "->", "lpUniversalName", "=", "NULL", ";", "dwResult", "=", "WNetGetUniversalName", "(", "pszExe", ",", "REMOTE_NAME_INFO_LEVEL", ",", "info", ",", "&", "dwLength", ")", ";", "if", "(", "dwResult", "==", "NO_ERROR", ")", "{", "if", "(", "bQuoted", ")", "snprintf", "(", "pszOriginal", ",", "length", ",", "\"", "\\\"", "\\\"", "\"", ",", "info", "->", "lpUniversalName", ")", ";", "else", "{", "strncpy", "(", "pszOriginal", ",", "info", "->", "lpUniversalName", ",", "length", ")", ";", "pszOriginal", "[", "length", "-", "1", "]", "=", "'", "\\0", "'", ";", "}", "}", "}" ]
convert an executable name to a universal naming convention version so that it can be used on a remote system
[ "convert", "an", "executable", "name", "to", "a", "universal", "naming", "convention", "version", "so", "that", "it", "can", "be", "used", "on", "a", "remote", "system" ]
[]
[ { "param": "pszExe", "type": "char" }, { "param": "length", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pszExe", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "length", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
71073f27f7a8f75c490f708927a3ac3d8b32c378
graingert/MPICH2-Armel-Raspberry-Pi-1
src/pm/smpd/mp_parse_command_line.c
[ "Intel", "mpich2", "Unlicense" ]
C
read_user_affinity_map
int
static int read_user_affinity_map(char *option) { char *p = NULL, *q = NULL, *context = NULL; int i=0, map_sz = 0; if(smpd_process.affinity_map != NULL){ printf("Error: duplicate user affinity map option\n"); return SMPD_FAIL; } if(option == NULL){ printf("Error: NULL user affinity option\n"); return SMPD_FAIL; } /* option = "user:1,2,3" */ p = option; p = strtok_s(p, ":", &context); if(p == NULL){ printf("Error parsing user affinity map\n"); return SMPD_FAIL; } p = strtok_s(NULL, ":", &context); if(p == NULL){ printf("Error parsing user affinity map\n"); return SMPD_FAIL; } /* p should now point to the affinity map separated by comma's */ map_sz = 1; q = p; /* parse to find the number of elements in the map */ while(*q != '\0'){ if(*q == ','){ map_sz++; } q++; } /* Allocate the mem for map */ smpd_process.affinity_map = (int *)MPIU_Malloc(sizeof(int) * map_sz); if(smpd_process.affinity_map == NULL){ printf("Unable to allocate memory for affinity map\n"); return SMPD_FAIL; } smpd_process.affinity_map_sz = map_sz; context = NULL; p = strtok_s(p, ",", &context); i = 0; while(p != NULL){ /* FIXME: We don't detect overflow case in atoi */ smpd_process.affinity_map[i++] = atoi(p); p = strtok_s(NULL, ",", &context); } smpd_dbg_printf("The user affinity map is : [ "); for(i=0; i<map_sz; i++){ smpd_dbg_printf(" %d ,",smpd_process.affinity_map[i]); } smpd_dbg_printf(" ] \n"); return SMPD_SUCCESS; }
/* This function reads the user binding option and sets the affinity map. * The user option is of the form "user:a,b,c" where a, b, c are integers denoting * the cores in the affinity map */
This function reads the user binding option and sets the affinity map. The user option is of the form "user:a,b,c" where a, b, c are integers denoting the cores in the affinity map
[ "This", "function", "reads", "the", "user", "binding", "option", "and", "sets", "the", "affinity", "map", ".", "The", "user", "option", "is", "of", "the", "form", "\"", "user", ":", "a", "b", "c", "\"", "where", "a", "b", "c", "are", "integers", "denoting", "the", "cores", "in", "the", "affinity", "map" ]
static int read_user_affinity_map(char *option) { char *p = NULL, *q = NULL, *context = NULL; int i=0, map_sz = 0; if(smpd_process.affinity_map != NULL){ printf("Error: duplicate user affinity map option\n"); return SMPD_FAIL; } if(option == NULL){ printf("Error: NULL user affinity option\n"); return SMPD_FAIL; } p = option; p = strtok_s(p, ":", &context); if(p == NULL){ printf("Error parsing user affinity map\n"); return SMPD_FAIL; } p = strtok_s(NULL, ":", &context); if(p == NULL){ printf("Error parsing user affinity map\n"); return SMPD_FAIL; } map_sz = 1; q = p; while(*q != '\0'){ if(*q == ','){ map_sz++; } q++; } smpd_process.affinity_map = (int *)MPIU_Malloc(sizeof(int) * map_sz); if(smpd_process.affinity_map == NULL){ printf("Unable to allocate memory for affinity map\n"); return SMPD_FAIL; } smpd_process.affinity_map_sz = map_sz; context = NULL; p = strtok_s(p, ",", &context); i = 0; while(p != NULL){ smpd_process.affinity_map[i++] = atoi(p); p = strtok_s(NULL, ",", &context); } smpd_dbg_printf("The user affinity map is : [ "); for(i=0; i<map_sz; i++){ smpd_dbg_printf(" %d ,",smpd_process.affinity_map[i]); } smpd_dbg_printf(" ] \n"); return SMPD_SUCCESS; }
[ "static", "int", "read_user_affinity_map", "(", "char", "*", "option", ")", "{", "char", "*", "p", "=", "NULL", ",", "*", "q", "=", "NULL", ",", "*", "context", "=", "NULL", ";", "int", "i", "=", "0", ",", "map_sz", "=", "0", ";", "if", "(", "smpd_process", ".", "affinity_map", "!=", "NULL", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "return", "SMPD_FAIL", ";", "}", "if", "(", "option", "==", "NULL", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "return", "SMPD_FAIL", ";", "}", "p", "=", "option", ";", "p", "=", "strtok_s", "(", "p", ",", "\"", "\"", ",", "&", "context", ")", ";", "if", "(", "p", "==", "NULL", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "return", "SMPD_FAIL", ";", "}", "p", "=", "strtok_s", "(", "NULL", ",", "\"", "\"", ",", "&", "context", ")", ";", "if", "(", "p", "==", "NULL", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "return", "SMPD_FAIL", ";", "}", "map_sz", "=", "1", ";", "q", "=", "p", ";", "while", "(", "*", "q", "!=", "'", "\\0", "'", ")", "{", "if", "(", "*", "q", "==", "'", "'", ")", "{", "map_sz", "++", ";", "}", "q", "++", ";", "}", "smpd_process", ".", "affinity_map", "=", "(", "int", "*", ")", "MPIU_Malloc", "(", "sizeof", "(", "int", ")", "*", "map_sz", ")", ";", "if", "(", "smpd_process", ".", "affinity_map", "==", "NULL", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "return", "SMPD_FAIL", ";", "}", "smpd_process", ".", "affinity_map_sz", "=", "map_sz", ";", "context", "=", "NULL", ";", "p", "=", "strtok_s", "(", "p", ",", "\"", "\"", ",", "&", "context", ")", ";", "i", "=", "0", ";", "while", "(", "p", "!=", "NULL", ")", "{", "smpd_process", ".", "affinity_map", "[", "i", "++", "]", "=", "atoi", "(", "p", ")", ";", "p", "=", "strtok_s", "(", "NULL", ",", "\"", "\"", ",", "&", "context", ")", ";", "}", "smpd_dbg_printf", "(", "\"", "\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "map_sz", ";", "i", "++", ")", "{", "smpd_dbg_printf", "(", "\"", "\"", ",", "smpd_process", ".", "affinity_map", "[", "i", "]", ")", ";", "}", "smpd_dbg_printf", "(", "\"", "\\n", "\"", ")", ";", "return", "SMPD_SUCCESS", ";", "}" ]
This function reads the user binding option and sets the affinity map.
[ "This", "function", "reads", "the", "user", "binding", "option", "and", "sets", "the", "affinity", "map", "." ]
[ "/* option = \"user:1,2,3\" */", "/* p should now point to the affinity map separated by comma's */", "/* parse to find the number of elements in the map */", "/* Allocate the mem for map */", "/* FIXME: We don't detect overflow case in atoi */" ]
[ { "param": "option", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "option", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1be3a09ae383de646a4279f56f0bc7ea48f388d7
graingert/MPICH2-Armel-Raspberry-Pi-1
src/pm/hydra/tools/topo/hwloc/hwloc/tests/hwloc_object_userdata.c
[ "Intel", "mpich2", "Unlicense" ]
C
check
void
static void check(hwloc_topology_t topology) { unsigned depth; unsigned i,j; depth = hwloc_topology_get_depth(topology); for(i=0; i<depth; i++) { for(j=0; j<hwloc_get_nbobjs_by_depth(topology, i); j++) { assert(hwloc_get_obj_by_depth(topology, i, j)->userdata == NULL); } } }
/* check that object userdata is properly initialized */
check that object userdata is properly initialized
[ "check", "that", "object", "userdata", "is", "properly", "initialized" ]
static void check(hwloc_topology_t topology) { unsigned depth; unsigned i,j; depth = hwloc_topology_get_depth(topology); for(i=0; i<depth; i++) { for(j=0; j<hwloc_get_nbobjs_by_depth(topology, i); j++) { assert(hwloc_get_obj_by_depth(topology, i, j)->userdata == NULL); } } }
[ "static", "void", "check", "(", "hwloc_topology_t", "topology", ")", "{", "unsigned", "depth", ";", "unsigned", "i", ",", "j", ";", "depth", "=", "hwloc_topology_get_depth", "(", "topology", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "depth", ";", "i", "++", ")", "{", "for", "(", "j", "=", "0", ";", "j", "<", "hwloc_get_nbobjs_by_depth", "(", "topology", ",", "i", ")", ";", "j", "++", ")", "{", "assert", "(", "hwloc_get_obj_by_depth", "(", "topology", ",", "i", ",", "j", ")", "->", "userdata", "==", "NULL", ")", ";", "}", "}", "}" ]
check that object userdata is properly initialized
[ "check", "that", "object", "userdata", "is", "properly", "initialized" ]
[]
[ { "param": "topology", "type": "hwloc_topology_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "topology", "type": "hwloc_topology_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1006e05de604200a0722f8096b8c7b93407acefe
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpe2/src/logging/src/clog_commset.c
[ "Intel", "mpich2", "Unlicense" ]
C
CLOG_CommSet_init
void
void CLOG_CommSet_init( CLOG_CommSet_t *commset ) { int *extra_state = NULL; /* unused variable */ CLOG_Uuid_init(); /* create LID_Key */ PMPI_Comm_create_keyval( MPI_COMM_NULL_COPY_FN, MPI_COMM_NULL_DELETE_FN, &(commset->LID_key), extra_state ); PMPI_Comm_size( MPI_COMM_WORLD, &(commset->world_size) ); PMPI_Comm_rank( MPI_COMM_WORLD, &(commset->world_rank) ); CLOG_CommSet_add_intracomm( commset, MPI_COMM_WORLD ); CLOG_CommSet_add_intracomm( commset, MPI_COMM_SELF ); commset->IDs4world = &(commset->table[0]); commset->IDs4self = &(commset->table[1]); }
/* CLOG_CommSet_init() should only be called if MPI is involved. */
CLOG_CommSet_init() should only be called if MPI is involved.
[ "CLOG_CommSet_init", "()", "should", "only", "be", "called", "if", "MPI", "is", "involved", "." ]
void CLOG_CommSet_init( CLOG_CommSet_t *commset ) { int *extra_state = NULL; CLOG_Uuid_init(); PMPI_Comm_create_keyval( MPI_COMM_NULL_COPY_FN, MPI_COMM_NULL_DELETE_FN, &(commset->LID_key), extra_state ); PMPI_Comm_size( MPI_COMM_WORLD, &(commset->world_size) ); PMPI_Comm_rank( MPI_COMM_WORLD, &(commset->world_rank) ); CLOG_CommSet_add_intracomm( commset, MPI_COMM_WORLD ); CLOG_CommSet_add_intracomm( commset, MPI_COMM_SELF ); commset->IDs4world = &(commset->table[0]); commset->IDs4self = &(commset->table[1]); }
[ "void", "CLOG_CommSet_init", "(", "CLOG_CommSet_t", "*", "commset", ")", "{", "int", "*", "extra_state", "=", "NULL", ";", "CLOG_Uuid_init", "(", ")", ";", "PMPI_Comm_create_keyval", "(", "MPI_COMM_NULL_COPY_FN", ",", "MPI_COMM_NULL_DELETE_FN", ",", "&", "(", "commset", "->", "LID_key", ")", ",", "extra_state", ")", ";", "PMPI_Comm_size", "(", "MPI_COMM_WORLD", ",", "&", "(", "commset", "->", "world_size", ")", ")", ";", "PMPI_Comm_rank", "(", "MPI_COMM_WORLD", ",", "&", "(", "commset", "->", "world_rank", ")", ")", ";", "CLOG_CommSet_add_intracomm", "(", "commset", ",", "MPI_COMM_WORLD", ")", ";", "CLOG_CommSet_add_intracomm", "(", "commset", ",", "MPI_COMM_SELF", ")", ";", "commset", "->", "IDs4world", "=", "&", "(", "commset", "->", "table", "[", "0", "]", ")", ";", "commset", "->", "IDs4self", "=", "&", "(", "commset", "->", "table", "[", "1", "]", ")", ";", "}" ]
CLOG_CommSet_init() should only be called if MPI is involved.
[ "CLOG_CommSet_init", "()", "should", "only", "be", "called", "if", "MPI", "is", "involved", "." ]
[ "/* unused variable */", "/* create LID_Key */" ]
[ { "param": "commset", "type": "CLOG_CommSet_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "commset", "type": "CLOG_CommSet_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1006e05de604200a0722f8096b8c7b93407acefe
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpe2/src/logging/src/clog_commset.c
[ "Intel", "mpich2", "Unlicense" ]
C
CLOG_CommSet_add_intracomm
CLOG_CommIDs_t
const CLOG_CommIDs_t *CLOG_CommSet_add_intracomm( CLOG_CommSet_t *commset, MPI_Comm intracomm ) { CLOG_CommIDs_t *intracommIDs; /* Update the next available table entry in CLOG_CommSet_t */ intracommIDs = CLOG_CommSet_get_new_IDs( commset, 1 ); intracommIDs->kind = CLOG_COMM_KIND_INTRA; /* Set the input MPI_Comm's LID_key attribute with new local CommID's LID */ /* Use CLOG_Pint, sizeof(CLOG_Pint) = sizeof(void *), instead of MPI_Aint (MPI_Aint >= CLOG_Pint) */ PMPI_Comm_set_attr( intracomm, commset->LID_key, (void *) (CLOG_Pint) intracommIDs->local_ID ); /* Set the Comm field */ intracommIDs->comm = intracomm; PMPI_Comm_rank( intracommIDs->comm, &(intracommIDs->comm_rank) ); /* Set the global Comm ID */ if ( intracommIDs->comm_rank == 0 ) CLOG_Uuid_generate( intracommIDs->global_ID ); PMPI_Bcast( intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, intracomm ); #if defined( CLOG_COMMSET_PRINT ) char uuid_str[CLOG_UUID_STR_SIZE] = {0}; CLOG_Uuid_sprint( intracommIDs->global_ID, uuid_str ); fprintf( stdout, "comm_rank=%d, comm_global_ID=%s\n", intracommIDs->comm_rank, uuid_str ); #endif return intracommIDs; }
/* This function should be used on every newly created communicator The input argument MPI_Comm is assumed to be not MPI_COMM_NULL */
This function should be used on every newly created communicator The input argument MPI_Comm is assumed to be not MPI_COMM_NULL
[ "This", "function", "should", "be", "used", "on", "every", "newly", "created", "communicator", "The", "input", "argument", "MPI_Comm", "is", "assumed", "to", "be", "not", "MPI_COMM_NULL" ]
const CLOG_CommIDs_t *CLOG_CommSet_add_intracomm( CLOG_CommSet_t *commset, MPI_Comm intracomm ) { CLOG_CommIDs_t *intracommIDs; intracommIDs = CLOG_CommSet_get_new_IDs( commset, 1 ); intracommIDs->kind = CLOG_COMM_KIND_INTRA; PMPI_Comm_set_attr( intracomm, commset->LID_key, (void *) (CLOG_Pint) intracommIDs->local_ID ); intracommIDs->comm = intracomm; PMPI_Comm_rank( intracommIDs->comm, &(intracommIDs->comm_rank) ); if ( intracommIDs->comm_rank == 0 ) CLOG_Uuid_generate( intracommIDs->global_ID ); PMPI_Bcast( intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, intracomm ); #if defined( CLOG_COMMSET_PRINT ) char uuid_str[CLOG_UUID_STR_SIZE] = {0}; CLOG_Uuid_sprint( intracommIDs->global_ID, uuid_str ); fprintf( stdout, "comm_rank=%d, comm_global_ID=%s\n", intracommIDs->comm_rank, uuid_str ); #endif return intracommIDs; }
[ "const", "CLOG_CommIDs_t", "*", "CLOG_CommSet_add_intracomm", "(", "CLOG_CommSet_t", "*", "commset", ",", "MPI_Comm", "intracomm", ")", "{", "CLOG_CommIDs_t", "*", "intracommIDs", ";", "intracommIDs", "=", "CLOG_CommSet_get_new_IDs", "(", "commset", ",", "1", ")", ";", "intracommIDs", "->", "kind", "=", "CLOG_COMM_KIND_INTRA", ";", "PMPI_Comm_set_attr", "(", "intracomm", ",", "commset", "->", "LID_key", ",", "(", "void", "*", ")", "(", "CLOG_Pint", ")", "intracommIDs", "->", "local_ID", ")", ";", "intracommIDs", "->", "comm", "=", "intracomm", ";", "PMPI_Comm_rank", "(", "intracommIDs", "->", "comm", ",", "&", "(", "intracommIDs", "->", "comm_rank", ")", ")", ";", "if", "(", "intracommIDs", "->", "comm_rank", "==", "0", ")", "CLOG_Uuid_generate", "(", "intracommIDs", "->", "global_ID", ")", ";", "PMPI_Bcast", "(", "intracommIDs", "->", "global_ID", ",", "CLOG_UUID_SIZE", ",", "MPI_CHAR", ",", "0", ",", "intracomm", ")", ";", "#if", "defined", "(", "CLOG_COMMSET_PRINT", ")", "\n", "char", "uuid_str", "[", "CLOG_UUID_STR_SIZE", "]", "=", "{", "0", "}", ";", "CLOG_Uuid_sprint", "(", "intracommIDs", "->", "global_ID", ",", "uuid_str", ")", ";", "fprintf", "(", "stdout", ",", "\"", "\\n", "\"", ",", "intracommIDs", "->", "comm_rank", ",", "uuid_str", ")", ";", "#endif", "return", "intracommIDs", ";", "}" ]
This function should be used on every newly created communicator The input argument MPI_Comm is assumed to be not MPI_COMM_NULL
[ "This", "function", "should", "be", "used", "on", "every", "newly", "created", "communicator", "The", "input", "argument", "MPI_Comm", "is", "assumed", "to", "be", "not", "MPI_COMM_NULL" ]
[ "/* Update the next available table entry in CLOG_CommSet_t */", "/* Set the input MPI_Comm's LID_key attribute with new local CommID's LID */", "/*\n Use CLOG_Pint, sizeof(CLOG_Pint) = sizeof(void *),\n instead of MPI_Aint (MPI_Aint >= CLOG_Pint)\n */", "/* Set the Comm field */", "/* Set the global Comm ID */" ]
[ { "param": "commset", "type": "CLOG_CommSet_t" }, { "param": "intracomm", "type": "MPI_Comm" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "commset", "type": "CLOG_CommSet_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "intracomm", "type": "MPI_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1006e05de604200a0722f8096b8c7b93407acefe
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpe2/src/logging/src/clog_commset.c
[ "Intel", "mpich2", "Unlicense" ]
C
CLOG_CommSet_add_intercomm
CLOG_CommIDs_t
const CLOG_CommIDs_t* CLOG_CommSet_add_intercomm( CLOG_CommSet_t *commset, MPI_Comm intercomm, const CLOG_CommIDs_t *intracommIDs ) { CLOG_CommIDs_t *intercommIDs; CLOG_CommIDs_t *local_intracommIDs, *remote_intracommIDs; CLOG_CommIDs_t *orig_intracommIDs, intracommIDs_val; MPI_Status status; MPI_Request request; int is_intercomm; /* Confirm if input intercomm is really an intercommunicator */ PMPI_Comm_test_inter( intercomm, &is_intercomm ); if ( !is_intercomm ) return CLOG_CommSet_add_intracomm( commset, intercomm ); /* Since CLOG_CommSet_get_new_IDs() may call realloc() which may invalidate any CLOG_CommIDs_t pointer, copy the content of input intracommIDs pointer to a local buffer. */ orig_intracommIDs = &intracommIDs_val; memcpy( orig_intracommIDs, intracommIDs, sizeof(CLOG_CommIDs_t) ); /* Set the next available table entry in CLOG_CommSet_t with intercomm */ intercommIDs = CLOG_CommSet_get_new_IDs( commset, 3 ); intercommIDs->kind = CLOG_COMM_KIND_INTER; /* Set the input MPI_Comm's LID_key attribute with new local CommID */ /* Use CLOG_Pint, sizeof(CLOG_Pint) = sizeof(void *), instead of MPI_Aint (MPI_Aint >= CLOG_Pint) */ PMPI_Comm_set_attr( intercomm, commset->LID_key, (void *) (CLOG_Pint) intercommIDs->local_ID ); /* Set the Comm field with the intercomm's info */ intercommIDs->comm = intercomm; PMPI_Comm_rank( intercommIDs->comm, &(intercommIDs->comm_rank) ); /* Set the global Comm ID based on intercomm's local group rank */ if ( intercommIDs->comm_rank == 0 ) CLOG_Uuid_generate( intercommIDs->global_ID ); /* Broadcast the (local side of) intercomm ID within local intracomm, i.e. orig_intracommIDs->comm */ PMPI_Bcast( intercommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, orig_intracommIDs->comm ); #if defined( CLOG_COMMSET_PRINT ) char uuid_str[CLOG_UUID_STR_SIZE] = {0}; CLOG_Uuid_sprint( intercommIDs->global_ID, uuid_str ); fprintf( stdout, "comm_rank=%d, comm_global_ID=%s\n", intercommIDs->comm_rank, uuid_str ); #endif /* Set the next available table entry with the LOCAL intracomm's info */ local_intracommIDs = intercommIDs + 1; local_intracommIDs->kind = CLOG_COMM_KIND_LOCAL; local_intracommIDs->local_ID = orig_intracommIDs->local_ID; CLOG_Uuid_copy( orig_intracommIDs->global_ID, local_intracommIDs->global_ID ); local_intracommIDs->comm = orig_intracommIDs->comm; local_intracommIDs->comm_rank = orig_intracommIDs->comm_rank; /* NOTE: LOCAL intracommIDs->comm_rank == intercommIDs->comm_rank */ /* Set the next available table entry with the REMOTE intracomm's info */ remote_intracommIDs = intercommIDs + 2; remote_intracommIDs->kind = CLOG_COMM_KIND_REMOTE; /* Broadcast local_intracommIDs's GID to everyone in remote_intracomm, i.e. Send local_intracommIDs' GID from the root of local intracomms to the root of the remote intracomms and save it as remote_intracommIDs' GID. Then broadcast the received GID to the rest of intracomm. */ if ( intercommIDs->comm_rank == 0 ) { PMPI_Irecv( remote_intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, 9999, intercomm, &request ); PMPI_Send( local_intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, 9999, intercomm ); PMPI_Wait( &request, &status ); } PMPI_Bcast( remote_intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, orig_intracommIDs->comm ); /* Since REMOTE intracomm is NOT known or undefinable in LOCAL intracomm, (that is why we have intercomm). Set comm and comm_rank to NULL */ remote_intracommIDs->comm = MPI_COMM_NULL; remote_intracommIDs->comm_rank = -1; /* Set the related CLOG_CommIDs_t* to the local and remote intracommIDs */ intercommIDs->next = local_intracommIDs; local_intracommIDs->next = remote_intracommIDs; return intercommIDs; }
/* Assume that "intracomm" be the LOCAL communicator of the "intercomm". */
Assume that "intracomm" be the LOCAL communicator of the "intercomm".
[ "Assume", "that", "\"", "intracomm", "\"", "be", "the", "LOCAL", "communicator", "of", "the", "\"", "intercomm", "\"", "." ]
const CLOG_CommIDs_t* CLOG_CommSet_add_intercomm( CLOG_CommSet_t *commset, MPI_Comm intercomm, const CLOG_CommIDs_t *intracommIDs ) { CLOG_CommIDs_t *intercommIDs; CLOG_CommIDs_t *local_intracommIDs, *remote_intracommIDs; CLOG_CommIDs_t *orig_intracommIDs, intracommIDs_val; MPI_Status status; MPI_Request request; int is_intercomm; PMPI_Comm_test_inter( intercomm, &is_intercomm ); if ( !is_intercomm ) return CLOG_CommSet_add_intracomm( commset, intercomm ); orig_intracommIDs = &intracommIDs_val; memcpy( orig_intracommIDs, intracommIDs, sizeof(CLOG_CommIDs_t) ); intercommIDs = CLOG_CommSet_get_new_IDs( commset, 3 ); intercommIDs->kind = CLOG_COMM_KIND_INTER; PMPI_Comm_set_attr( intercomm, commset->LID_key, (void *) (CLOG_Pint) intercommIDs->local_ID ); intercommIDs->comm = intercomm; PMPI_Comm_rank( intercommIDs->comm, &(intercommIDs->comm_rank) ); if ( intercommIDs->comm_rank == 0 ) CLOG_Uuid_generate( intercommIDs->global_ID ); PMPI_Bcast( intercommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, orig_intracommIDs->comm ); #if defined( CLOG_COMMSET_PRINT ) char uuid_str[CLOG_UUID_STR_SIZE] = {0}; CLOG_Uuid_sprint( intercommIDs->global_ID, uuid_str ); fprintf( stdout, "comm_rank=%d, comm_global_ID=%s\n", intercommIDs->comm_rank, uuid_str ); #endif local_intracommIDs = intercommIDs + 1; local_intracommIDs->kind = CLOG_COMM_KIND_LOCAL; local_intracommIDs->local_ID = orig_intracommIDs->local_ID; CLOG_Uuid_copy( orig_intracommIDs->global_ID, local_intracommIDs->global_ID ); local_intracommIDs->comm = orig_intracommIDs->comm; local_intracommIDs->comm_rank = orig_intracommIDs->comm_rank; remote_intracommIDs = intercommIDs + 2; remote_intracommIDs->kind = CLOG_COMM_KIND_REMOTE; if ( intercommIDs->comm_rank == 0 ) { PMPI_Irecv( remote_intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, 9999, intercomm, &request ); PMPI_Send( local_intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, 9999, intercomm ); PMPI_Wait( &request, &status ); } PMPI_Bcast( remote_intracommIDs->global_ID, CLOG_UUID_SIZE, MPI_CHAR, 0, orig_intracommIDs->comm ); remote_intracommIDs->comm = MPI_COMM_NULL; remote_intracommIDs->comm_rank = -1; intercommIDs->next = local_intracommIDs; local_intracommIDs->next = remote_intracommIDs; return intercommIDs; }
[ "const", "CLOG_CommIDs_t", "*", "CLOG_CommSet_add_intercomm", "(", "CLOG_CommSet_t", "*", "commset", ",", "MPI_Comm", "intercomm", ",", "const", "CLOG_CommIDs_t", "*", "intracommIDs", ")", "{", "CLOG_CommIDs_t", "*", "intercommIDs", ";", "CLOG_CommIDs_t", "*", "local_intracommIDs", ",", "*", "remote_intracommIDs", ";", "CLOG_CommIDs_t", "*", "orig_intracommIDs", ",", "intracommIDs_val", ";", "MPI_Status", "status", ";", "MPI_Request", "request", ";", "int", "is_intercomm", ";", "PMPI_Comm_test_inter", "(", "intercomm", ",", "&", "is_intercomm", ")", ";", "if", "(", "!", "is_intercomm", ")", "return", "CLOG_CommSet_add_intracomm", "(", "commset", ",", "intercomm", ")", ";", "orig_intracommIDs", "=", "&", "intracommIDs_val", ";", "memcpy", "(", "orig_intracommIDs", ",", "intracommIDs", ",", "sizeof", "(", "CLOG_CommIDs_t", ")", ")", ";", "intercommIDs", "=", "CLOG_CommSet_get_new_IDs", "(", "commset", ",", "3", ")", ";", "intercommIDs", "->", "kind", "=", "CLOG_COMM_KIND_INTER", ";", "PMPI_Comm_set_attr", "(", "intercomm", ",", "commset", "->", "LID_key", ",", "(", "void", "*", ")", "(", "CLOG_Pint", ")", "intercommIDs", "->", "local_ID", ")", ";", "intercommIDs", "->", "comm", "=", "intercomm", ";", "PMPI_Comm_rank", "(", "intercommIDs", "->", "comm", ",", "&", "(", "intercommIDs", "->", "comm_rank", ")", ")", ";", "if", "(", "intercommIDs", "->", "comm_rank", "==", "0", ")", "CLOG_Uuid_generate", "(", "intercommIDs", "->", "global_ID", ")", ";", "PMPI_Bcast", "(", "intercommIDs", "->", "global_ID", ",", "CLOG_UUID_SIZE", ",", "MPI_CHAR", ",", "0", ",", "orig_intracommIDs", "->", "comm", ")", ";", "#if", "defined", "(", "CLOG_COMMSET_PRINT", ")", "\n", "char", "uuid_str", "[", "CLOG_UUID_STR_SIZE", "]", "=", "{", "0", "}", ";", "CLOG_Uuid_sprint", "(", "intercommIDs", "->", "global_ID", ",", "uuid_str", ")", ";", "fprintf", "(", "stdout", ",", "\"", "\\n", "\"", ",", "intercommIDs", "->", "comm_rank", ",", "uuid_str", ")", ";", "#endif", "local_intracommIDs", "=", "intercommIDs", "+", "1", ";", "local_intracommIDs", "->", "kind", "=", "CLOG_COMM_KIND_LOCAL", ";", "local_intracommIDs", "->", "local_ID", "=", "orig_intracommIDs", "->", "local_ID", ";", "CLOG_Uuid_copy", "(", "orig_intracommIDs", "->", "global_ID", ",", "local_intracommIDs", "->", "global_ID", ")", ";", "local_intracommIDs", "->", "comm", "=", "orig_intracommIDs", "->", "comm", ";", "local_intracommIDs", "->", "comm_rank", "=", "orig_intracommIDs", "->", "comm_rank", ";", "remote_intracommIDs", "=", "intercommIDs", "+", "2", ";", "remote_intracommIDs", "->", "kind", "=", "CLOG_COMM_KIND_REMOTE", ";", "if", "(", "intercommIDs", "->", "comm_rank", "==", "0", ")", "{", "PMPI_Irecv", "(", "remote_intracommIDs", "->", "global_ID", ",", "CLOG_UUID_SIZE", ",", "MPI_CHAR", ",", "0", ",", "9999", ",", "intercomm", ",", "&", "request", ")", ";", "PMPI_Send", "(", "local_intracommIDs", "->", "global_ID", ",", "CLOG_UUID_SIZE", ",", "MPI_CHAR", ",", "0", ",", "9999", ",", "intercomm", ")", ";", "PMPI_Wait", "(", "&", "request", ",", "&", "status", ")", ";", "}", "PMPI_Bcast", "(", "remote_intracommIDs", "->", "global_ID", ",", "CLOG_UUID_SIZE", ",", "MPI_CHAR", ",", "0", ",", "orig_intracommIDs", "->", "comm", ")", ";", "remote_intracommIDs", "->", "comm", "=", "MPI_COMM_NULL", ";", "remote_intracommIDs", "->", "comm_rank", "=", "-1", ";", "intercommIDs", "->", "next", "=", "local_intracommIDs", ";", "local_intracommIDs", "->", "next", "=", "remote_intracommIDs", ";", "return", "intercommIDs", ";", "}" ]
Assume that "intracomm" be the LOCAL communicator of the "intercomm".
[ "Assume", "that", "\"", "intracomm", "\"", "be", "the", "LOCAL", "communicator", "of", "the", "\"", "intercomm", "\"", "." ]
[ "/* Confirm if input intercomm is really an intercommunicator */", "/*\n Since CLOG_CommSet_get_new_IDs() may call realloc()\n which may invalidate any CLOG_CommIDs_t pointer,\n copy the content of input intracommIDs pointer to a local buffer.\n */", "/* Set the next available table entry in CLOG_CommSet_t with intercomm */", "/* Set the input MPI_Comm's LID_key attribute with new local CommID */", "/*\n Use CLOG_Pint, sizeof(CLOG_Pint) = sizeof(void *),\n instead of MPI_Aint (MPI_Aint >= CLOG_Pint)\n */", "/* Set the Comm field with the intercomm's info */", "/* Set the global Comm ID based on intercomm's local group rank */", "/*\n Broadcast the (local side of) intercomm ID within local intracomm,\n i.e. orig_intracommIDs->comm\n */", "/* Set the next available table entry with the LOCAL intracomm's info */", "/* NOTE: LOCAL intracommIDs->comm_rank == intercommIDs->comm_rank */", "/* Set the next available table entry with the REMOTE intracomm's info */", "/*\n Broadcast local_intracommIDs's GID to everyone in remote_intracomm, i.e.\n Send local_intracommIDs' GID from the root of local intracomms to the\n root of the remote intracomms and save it as remote_intracommIDs' GID.\n Then broadcast the received GID to the rest of intracomm.\n */", "/*\n Since REMOTE intracomm is NOT known or undefinable in LOCAL intracomm,\n (that is why we have intercomm). Set comm and comm_rank to NULL\n */", "/* Set the related CLOG_CommIDs_t* to the local and remote intracommIDs */" ]
[ { "param": "commset", "type": "CLOG_CommSet_t" }, { "param": "intercomm", "type": "MPI_Comm" }, { "param": "intracommIDs", "type": "CLOG_CommIDs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "commset", "type": "CLOG_CommSet_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "intercomm", "type": "MPI_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "intracommIDs", "type": "CLOG_CommIDs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3f1f0f0adabf954cabb3c3e40078be5ec93a2db1
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/impl/mpid_buffer.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDI_DCMF_Buffer_copy
void
void MPIDI_DCMF_Buffer_copy( const void * const sbuf, int scount, MPI_Datatype sdt, int * smpi_errno, void * const rbuf, int rcount, MPI_Datatype rdt, MPIDI_msg_sz_t * rsz, int * rmpi_errno) { int sdt_contig; int rdt_contig; MPI_Aint sdt_true_lb, rdt_true_lb; MPIDI_msg_sz_t sdata_sz; MPIDI_msg_sz_t rdata_sz; MPID_Datatype * sdt_ptr; MPID_Datatype * rdt_ptr; *smpi_errno = MPI_SUCCESS; *rmpi_errno = MPI_SUCCESS; // printf ("bufcopy: src count=%d dt =%d\n", scount, sdt); // printf ("bufcopy: dst count=%d dt=%d\n", rcount, rdt); MPIDI_Datatype_get_info(scount, sdt, sdt_contig, sdata_sz, sdt_ptr, sdt_true_lb); MPIDI_Datatype_get_info(rcount, rdt, rdt_contig, rdata_sz, rdt_ptr, rdt_true_lb); /* --BEGIN ERROR HANDLING-- */ if (sdata_sz > rdata_sz) { *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TRUNCATE, "**truncate", "**truncate %d %d", sdata_sz, rdata_sz ); sdata_sz = rdata_sz; } /* --END ERROR HANDLING-- */ if (sdata_sz == 0) { *rsz = 0; goto fn_exit; } if (sdt_contig && rdt_contig) { memcpy((char *)rbuf + rdt_true_lb, (const char *)sbuf + sdt_true_lb, sdata_sz); *rsz = sdata_sz; } else if (sdt_contig) { MPID_Segment seg; DLOOP_Offset last; MPID_Segment_init(rbuf, rcount, rdt, &seg, 0); last = sdata_sz; MPID_Segment_unpack(&seg, 0, &last, (char*)sbuf + sdt_true_lb); /* --BEGIN ERROR HANDLING-- */ if (last != sdata_sz) { *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TYPE, "**dtypemismatch", 0); } /* --END ERROR HANDLING-- */ *rsz = last; } else if (rdt_contig) { MPID_Segment seg; DLOOP_Offset last; MPID_Segment_init(sbuf, scount, sdt, &seg, 0); last = sdata_sz; MPID_Segment_pack(&seg, 0, &last, (char*)rbuf + rdt_true_lb); /* --BEGIN ERROR HANDLING-- */ if (last != sdata_sz) { *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TYPE, "**dtypemismatch", 0); } /* --END ERROR HANDLING-- */ *rsz = last; } else { char * buf; MPIDI_msg_sz_t buf_off; MPID_Segment sseg; MPIDI_msg_sz_t sfirst; MPID_Segment rseg; MPIDI_msg_sz_t rfirst; buf = MPIU_Malloc(MPIDI_COPY_BUFFER_SZ); /* --BEGIN ERROR HANDLING-- */ if (buf == NULL) { *smpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_OTHER, "**nomem", 0); *rmpi_errno = *smpi_errno; *rsz = 0; goto fn_exit; } /* --END ERROR HANDLING-- */ MPID_Segment_init(sbuf, scount, sdt, &sseg, 0); MPID_Segment_init(rbuf, rcount, rdt, &rseg, 0); sfirst = 0; rfirst = 0; buf_off = 0; for(;;) { DLOOP_Offset last; char * buf_end; if (sdata_sz - sfirst > MPIDI_COPY_BUFFER_SZ - buf_off) { last = sfirst + (MPIDI_COPY_BUFFER_SZ - buf_off); } else { last = sdata_sz; } MPID_Segment_pack(&sseg, sfirst, &last, buf + buf_off); /* --BEGIN ERROR HANDLING-- */ MPID_assert(last > sfirst); /* --END ERROR HANDLING-- */ buf_end = buf + buf_off + (last - sfirst); sfirst = last; MPID_Segment_unpack(&rseg, rfirst, &last, buf); /* --BEGIN ERROR HANDLING-- */ MPID_assert(last > rfirst); /* --END ERROR HANDLING-- */ rfirst = last; if (rfirst == sdata_sz) { /* successful completion */ break; } /* --BEGIN ERROR HANDLING-- */ if (sfirst == sdata_sz) { /* datatype mismatch -- remaining bytes could not be unpacked */ *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TYPE, "**dtypemismatch", 0); break; } /* --END ERROR HANDLING-- */ buf_off = sfirst - rfirst; if (buf_off > 0) { memmove(buf, buf_end - buf_off, buf_off); } } *rsz = rfirst; MPIU_Free(buf); } fn_exit: return; }
/** * \brief MPID buffer copy * * Implements non-contiguous buffers correctly. * * \param[in] sbuf The address of the input buffer * \param[in] scount The number of elements in that buffer * \param[in] sdt The datatype of those elements * \param[out] smpi_errno Returns errors * \param[in] rbuf The address of the output buffer * \param[out] rcount The number of elements in that buffer * \param[in] rdt The datatype of those elements * \param[out] rsz The size of the ouput data * \param[out] rmpi_errno Returns errors */
\brief MPID buffer copy Implements non-contiguous buffers correctly.
[ "\\", "brief", "MPID", "buffer", "copy", "Implements", "non", "-", "contiguous", "buffers", "correctly", "." ]
void MPIDI_DCMF_Buffer_copy( const void * const sbuf, int scount, MPI_Datatype sdt, int * smpi_errno, void * const rbuf, int rcount, MPI_Datatype rdt, MPIDI_msg_sz_t * rsz, int * rmpi_errno) { int sdt_contig; int rdt_contig; MPI_Aint sdt_true_lb, rdt_true_lb; MPIDI_msg_sz_t sdata_sz; MPIDI_msg_sz_t rdata_sz; MPID_Datatype * sdt_ptr; MPID_Datatype * rdt_ptr; *smpi_errno = MPI_SUCCESS; *rmpi_errno = MPI_SUCCESS; MPIDI_Datatype_get_info(scount, sdt, sdt_contig, sdata_sz, sdt_ptr, sdt_true_lb); MPIDI_Datatype_get_info(rcount, rdt, rdt_contig, rdata_sz, rdt_ptr, rdt_true_lb); if (sdata_sz > rdata_sz) { *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TRUNCATE, "**truncate", "**truncate %d %d", sdata_sz, rdata_sz ); sdata_sz = rdata_sz; } if (sdata_sz == 0) { *rsz = 0; goto fn_exit; } if (sdt_contig && rdt_contig) { memcpy((char *)rbuf + rdt_true_lb, (const char *)sbuf + sdt_true_lb, sdata_sz); *rsz = sdata_sz; } else if (sdt_contig) { MPID_Segment seg; DLOOP_Offset last; MPID_Segment_init(rbuf, rcount, rdt, &seg, 0); last = sdata_sz; MPID_Segment_unpack(&seg, 0, &last, (char*)sbuf + sdt_true_lb); if (last != sdata_sz) { *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TYPE, "**dtypemismatch", 0); } *rsz = last; } else if (rdt_contig) { MPID_Segment seg; DLOOP_Offset last; MPID_Segment_init(sbuf, scount, sdt, &seg, 0); last = sdata_sz; MPID_Segment_pack(&seg, 0, &last, (char*)rbuf + rdt_true_lb); if (last != sdata_sz) { *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TYPE, "**dtypemismatch", 0); } *rsz = last; } else { char * buf; MPIDI_msg_sz_t buf_off; MPID_Segment sseg; MPIDI_msg_sz_t sfirst; MPID_Segment rseg; MPIDI_msg_sz_t rfirst; buf = MPIU_Malloc(MPIDI_COPY_BUFFER_SZ); if (buf == NULL) { *smpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_OTHER, "**nomem", 0); *rmpi_errno = *smpi_errno; *rsz = 0; goto fn_exit; } MPID_Segment_init(sbuf, scount, sdt, &sseg, 0); MPID_Segment_init(rbuf, rcount, rdt, &rseg, 0); sfirst = 0; rfirst = 0; buf_off = 0; for(;;) { DLOOP_Offset last; char * buf_end; if (sdata_sz - sfirst > MPIDI_COPY_BUFFER_SZ - buf_off) { last = sfirst + (MPIDI_COPY_BUFFER_SZ - buf_off); } else { last = sdata_sz; } MPID_Segment_pack(&sseg, sfirst, &last, buf + buf_off); MPID_assert(last > sfirst); buf_end = buf + buf_off + (last - sfirst); sfirst = last; MPID_Segment_unpack(&rseg, rfirst, &last, buf); MPID_assert(last > rfirst); rfirst = last; if (rfirst == sdata_sz) { break; } if (sfirst == sdata_sz) { *rmpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, "MPIDI_DCMF_Buffer_copy", __LINE__, MPI_ERR_TYPE, "**dtypemismatch", 0); break; } buf_off = sfirst - rfirst; if (buf_off > 0) { memmove(buf, buf_end - buf_off, buf_off); } } *rsz = rfirst; MPIU_Free(buf); } fn_exit: return; }
[ "void", "MPIDI_DCMF_Buffer_copy", "(", "const", "void", "*", "const", "sbuf", ",", "int", "scount", ",", "MPI_Datatype", "sdt", ",", "int", "*", "smpi_errno", ",", "void", "*", "const", "rbuf", ",", "int", "rcount", ",", "MPI_Datatype", "rdt", ",", "MPIDI_msg_sz_t", "*", "rsz", ",", "int", "*", "rmpi_errno", ")", "{", "int", "sdt_contig", ";", "int", "rdt_contig", ";", "MPI_Aint", "sdt_true_lb", ",", "rdt_true_lb", ";", "MPIDI_msg_sz_t", "sdata_sz", ";", "MPIDI_msg_sz_t", "rdata_sz", ";", "MPID_Datatype", "*", "sdt_ptr", ";", "MPID_Datatype", "*", "rdt_ptr", ";", "*", "smpi_errno", "=", "MPI_SUCCESS", ";", "*", "rmpi_errno", "=", "MPI_SUCCESS", ";", "MPIDI_Datatype_get_info", "(", "scount", ",", "sdt", ",", "sdt_contig", ",", "sdata_sz", ",", "sdt_ptr", ",", "sdt_true_lb", ")", ";", "MPIDI_Datatype_get_info", "(", "rcount", ",", "rdt", ",", "rdt_contig", ",", "rdata_sz", ",", "rdt_ptr", ",", "rdt_true_lb", ")", ";", "if", "(", "sdata_sz", ">", "rdata_sz", ")", "{", "*", "rmpi_errno", "=", "MPIR_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "\"", "\"", ",", "__LINE__", ",", "MPI_ERR_TRUNCATE", ",", "\"", "\"", ",", "\"", "\"", ",", "sdata_sz", ",", "rdata_sz", ")", ";", "sdata_sz", "=", "rdata_sz", ";", "}", "if", "(", "sdata_sz", "==", "0", ")", "{", "*", "rsz", "=", "0", ";", "goto", "fn_exit", ";", "}", "if", "(", "sdt_contig", "&&", "rdt_contig", ")", "{", "memcpy", "(", "(", "char", "*", ")", "rbuf", "+", "rdt_true_lb", ",", "(", "const", "char", "*", ")", "sbuf", "+", "sdt_true_lb", ",", "sdata_sz", ")", ";", "*", "rsz", "=", "sdata_sz", ";", "}", "else", "if", "(", "sdt_contig", ")", "{", "MPID_Segment", "seg", ";", "DLOOP_Offset", "last", ";", "MPID_Segment_init", "(", "rbuf", ",", "rcount", ",", "rdt", ",", "&", "seg", ",", "0", ")", ";", "last", "=", "sdata_sz", ";", "MPID_Segment_unpack", "(", "&", "seg", ",", "0", ",", "&", "last", ",", "(", "char", "*", ")", "sbuf", "+", "sdt_true_lb", ")", ";", "if", "(", "last", "!=", "sdata_sz", ")", "{", "*", "rmpi_errno", "=", "MPIR_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "\"", "\"", ",", "__LINE__", ",", "MPI_ERR_TYPE", ",", "\"", "\"", ",", "0", ")", ";", "}", "*", "rsz", "=", "last", ";", "}", "else", "if", "(", "rdt_contig", ")", "{", "MPID_Segment", "seg", ";", "DLOOP_Offset", "last", ";", "MPID_Segment_init", "(", "sbuf", ",", "scount", ",", "sdt", ",", "&", "seg", ",", "0", ")", ";", "last", "=", "sdata_sz", ";", "MPID_Segment_pack", "(", "&", "seg", ",", "0", ",", "&", "last", ",", "(", "char", "*", ")", "rbuf", "+", "rdt_true_lb", ")", ";", "if", "(", "last", "!=", "sdata_sz", ")", "{", "*", "rmpi_errno", "=", "MPIR_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "\"", "\"", ",", "__LINE__", ",", "MPI_ERR_TYPE", ",", "\"", "\"", ",", "0", ")", ";", "}", "*", "rsz", "=", "last", ";", "}", "else", "{", "char", "*", "buf", ";", "MPIDI_msg_sz_t", "buf_off", ";", "MPID_Segment", "sseg", ";", "MPIDI_msg_sz_t", "sfirst", ";", "MPID_Segment", "rseg", ";", "MPIDI_msg_sz_t", "rfirst", ";", "buf", "=", "MPIU_Malloc", "(", "MPIDI_COPY_BUFFER_SZ", ")", ";", "if", "(", "buf", "==", "NULL", ")", "{", "*", "smpi_errno", "=", "MPIR_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_FATAL", ",", "\"", "\"", ",", "__LINE__", ",", "MPI_ERR_OTHER", ",", "\"", "\"", ",", "0", ")", ";", "*", "rmpi_errno", "=", "*", "smpi_errno", ";", "*", "rsz", "=", "0", ";", "goto", "fn_exit", ";", "}", "MPID_Segment_init", "(", "sbuf", ",", "scount", ",", "sdt", ",", "&", "sseg", ",", "0", ")", ";", "MPID_Segment_init", "(", "rbuf", ",", "rcount", ",", "rdt", ",", "&", "rseg", ",", "0", ")", ";", "sfirst", "=", "0", ";", "rfirst", "=", "0", ";", "buf_off", "=", "0", ";", "for", "(", ";", ";", ")", "{", "DLOOP_Offset", "last", ";", "char", "*", "buf_end", ";", "if", "(", "sdata_sz", "-", "sfirst", ">", "MPIDI_COPY_BUFFER_SZ", "-", "buf_off", ")", "{", "last", "=", "sfirst", "+", "(", "MPIDI_COPY_BUFFER_SZ", "-", "buf_off", ")", ";", "}", "else", "{", "last", "=", "sdata_sz", ";", "}", "MPID_Segment_pack", "(", "&", "sseg", ",", "sfirst", ",", "&", "last", ",", "buf", "+", "buf_off", ")", ";", "MPID_assert", "(", "last", ">", "sfirst", ")", ";", "buf_end", "=", "buf", "+", "buf_off", "+", "(", "last", "-", "sfirst", ")", ";", "sfirst", "=", "last", ";", "MPID_Segment_unpack", "(", "&", "rseg", ",", "rfirst", ",", "&", "last", ",", "buf", ")", ";", "MPID_assert", "(", "last", ">", "rfirst", ")", ";", "rfirst", "=", "last", ";", "if", "(", "rfirst", "==", "sdata_sz", ")", "{", "break", ";", "}", "if", "(", "sfirst", "==", "sdata_sz", ")", "{", "*", "rmpi_errno", "=", "MPIR_Err_create_code", "(", "MPI_SUCCESS", ",", "MPIR_ERR_RECOVERABLE", ",", "\"", "\"", ",", "__LINE__", ",", "MPI_ERR_TYPE", ",", "\"", "\"", ",", "0", ")", ";", "break", ";", "}", "buf_off", "=", "sfirst", "-", "rfirst", ";", "if", "(", "buf_off", ">", "0", ")", "{", "memmove", "(", "buf", ",", "buf_end", "-", "buf_off", ",", "buf_off", ")", ";", "}", "}", "*", "rsz", "=", "rfirst", ";", "MPIU_Free", "(", "buf", ")", ";", "}", "fn_exit", ":", "return", ";", "}" ]
\brief MPID buffer copy Implements non-contiguous buffers correctly.
[ "\\", "brief", "MPID", "buffer", "copy", "Implements", "non", "-", "contiguous", "buffers", "correctly", "." ]
[ "// printf (\"bufcopy: src count=%d dt =%d\\n\", scount, sdt);", "// printf (\"bufcopy: dst count=%d dt=%d\\n\", rcount, rdt);", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* --BEGIN ERROR HANDLING-- */", "/* --END ERROR HANDLING-- */", "/* successful completion */", "/* --BEGIN ERROR HANDLING-- */", "/* datatype mismatch -- remaining bytes could not be unpacked */", "/* --END ERROR HANDLING-- */" ]
[ { "param": "sbuf", "type": "void" }, { "param": "scount", "type": "int" }, { "param": "sdt", "type": "MPI_Datatype" }, { "param": "smpi_errno", "type": "int" }, { "param": "rbuf", "type": "void" }, { "param": "rcount", "type": "int" }, { "param": "rdt", "type": "MPI_Datatype" }, { "param": "rsz", "type": "MPIDI_msg_sz_t" }, { "param": "rmpi_errno", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sbuf", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "scount", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sdt", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "smpi_errno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rbuf", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rcount", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rdt", "type": "MPI_Datatype", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rsz", "type": "MPIDI_msg_sz_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rmpi_errno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
482c9d59f1ba4a09a6b63331a1172066ec19e897
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/util.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCI_Error
void
void ARMCI_Error(char *msg, int code) { fprintf(stderr, "[%d] ARMCI Error: %s\n", ARMCI_GROUP_WORLD.rank, msg); fflush(NULL); MPI_Abort(ARMCI_GROUP_WORLD.comm, code); }
/** Fatal error, print the message and abort the program with the provided * error code. */
Fatal error, print the message and abort the program with the provided error code.
[ "Fatal", "error", "print", "the", "message", "and", "abort", "the", "program", "with", "the", "provided", "error", "code", "." ]
void ARMCI_Error(char *msg, int code) { fprintf(stderr, "[%d] ARMCI Error: %s\n", ARMCI_GROUP_WORLD.rank, msg); fflush(NULL); MPI_Abort(ARMCI_GROUP_WORLD.comm, code); }
[ "void", "ARMCI_Error", "(", "char", "*", "msg", ",", "int", "code", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "ARMCI_GROUP_WORLD", ".", "rank", ",", "msg", ")", ";", "fflush", "(", "NULL", ")", ";", "MPI_Abort", "(", "ARMCI_GROUP_WORLD", ".", "comm", ",", "code", ")", ";", "}" ]
Fatal error, print the message and abort the program with the provided error code.
[ "Fatal", "error", "print", "the", "message", "and", "abort", "the", "program", "with", "the", "provided", "error", "code", "." ]
[]
[ { "param": "msg", "type": "char" }, { "param": "code", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "msg", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "code", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
482c9d59f1ba4a09a6b63331a1172066ec19e897
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/util.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCI_Barrier
void
void ARMCI_Barrier(void) { ARMCI_AllFence(); MPI_Barrier(ARMCI_GROUP_WORLD.comm); if (ARMCII_GLOBAL_STATE.debug_flush_barriers) { ARMCII_Flush_local(); } }
/** Barrier synchronization. Collective on the world group (not the default * group!). */
Barrier synchronization. Collective on the world group (not the default group!).
[ "Barrier", "synchronization", ".", "Collective", "on", "the", "world", "group", "(", "not", "the", "default", "group!", ")", "." ]
void ARMCI_Barrier(void) { ARMCI_AllFence(); MPI_Barrier(ARMCI_GROUP_WORLD.comm); if (ARMCII_GLOBAL_STATE.debug_flush_barriers) { ARMCII_Flush_local(); } }
[ "void", "ARMCI_Barrier", "(", "void", ")", "{", "ARMCI_AllFence", "(", ")", ";", "MPI_Barrier", "(", "ARMCI_GROUP_WORLD", ".", "comm", ")", ";", "if", "(", "ARMCII_GLOBAL_STATE", ".", "debug_flush_barriers", ")", "{", "ARMCII_Flush_local", "(", ")", ";", "}", "}" ]
Barrier synchronization.
[ "Barrier", "synchronization", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
482c9d59f1ba4a09a6b63331a1172066ec19e897
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/util.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Bzero
void
void ARMCII_Bzero(void *buf, int size) { int i; uint8_t *buf_b = (uint8_t *)buf; for (i = 0; i < size; i++) buf_b[i] = 0; }
/** Zero out the given buffer. */
Zero out the given buffer.
[ "Zero", "out", "the", "given", "buffer", "." ]
void ARMCII_Bzero(void *buf, int size) { int i; uint8_t *buf_b = (uint8_t *)buf; for (i = 0; i < size; i++) buf_b[i] = 0; }
[ "void", "ARMCII_Bzero", "(", "void", "*", "buf", ",", "int", "size", ")", "{", "int", "i", ";", "uint8_t", "*", "buf_b", "=", "(", "uint8_t", "*", ")", "buf", ";", "for", "(", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "buf_b", "[", "i", "]", "=", "0", ";", "}" ]
Zero out the given buffer.
[ "Zero", "out", "the", "given", "buffer", "." ]
[]
[ { "param": "buf", "type": "void" }, { "param": "size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
482c9d59f1ba4a09a6b63331a1172066ec19e897
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/util.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Getenv_bool
int
int ARMCII_Getenv_bool(char *varname, int default_value) { char *var = getenv(varname); if (var == NULL) return default_value; if (var[0] == 'T' || var[0] == 't' || var[0] == '1' || var[0] == 'y' || var[0] == 'Y') return 1; else return 0; }
/** Retrieve the value of a boolean environment variable. */
Retrieve the value of a boolean environment variable.
[ "Retrieve", "the", "value", "of", "a", "boolean", "environment", "variable", "." ]
int ARMCII_Getenv_bool(char *varname, int default_value) { char *var = getenv(varname); if (var == NULL) return default_value; if (var[0] == 'T' || var[0] == 't' || var[0] == '1' || var[0] == 'y' || var[0] == 'Y') return 1; else return 0; }
[ "int", "ARMCII_Getenv_bool", "(", "char", "*", "varname", ",", "int", "default_value", ")", "{", "char", "*", "var", "=", "getenv", "(", "varname", ")", ";", "if", "(", "var", "==", "NULL", ")", "return", "default_value", ";", "if", "(", "var", "[", "0", "]", "==", "'", "'", "||", "var", "[", "0", "]", "==", "'", "'", "||", "var", "[", "0", "]", "==", "'", "'", "||", "var", "[", "0", "]", "==", "'", "'", "||", "var", "[", "0", "]", "==", "'", "'", ")", "return", "1", ";", "else", "return", "0", ";", "}" ]
Retrieve the value of a boolean environment variable.
[ "Retrieve", "the", "value", "of", "a", "boolean", "environment", "variable", "." ]
[]
[ { "param": "varname", "type": "char" }, { "param": "default_value", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "varname", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "default_value", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
482c9d59f1ba4a09a6b63331a1172066ec19e897
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpix/armci/src/util.c
[ "Intel", "mpich2", "Unlicense" ]
C
ARMCII_Getenv_int
int
int ARMCII_Getenv_int(char *varname, int default_value) { char *var = getenv("ARMCI_IOV_BATCHED_LIMIT"); if (var) return atoi(var); else return default_value; }
/** Retrieve the value of an integer environment variable. */
Retrieve the value of an integer environment variable.
[ "Retrieve", "the", "value", "of", "an", "integer", "environment", "variable", "." ]
int ARMCII_Getenv_int(char *varname, int default_value) { char *var = getenv("ARMCI_IOV_BATCHED_LIMIT"); if (var) return atoi(var); else return default_value; }
[ "int", "ARMCII_Getenv_int", "(", "char", "*", "varname", ",", "int", "default_value", ")", "{", "char", "*", "var", "=", "getenv", "(", "\"", "\"", ")", ";", "if", "(", "var", ")", "return", "atoi", "(", "var", ")", ";", "else", "return", "default_value", ";", "}" ]
Retrieve the value of an integer environment variable.
[ "Retrieve", "the", "value", "of", "an", "integer", "environment", "variable", "." ]
[]
[ { "param": "varname", "type": "char" }, { "param": "default_value", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "varname", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "default_value", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bebe12d3f92f09f88a296bd3351d4d3b6bb95bb3
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/comm/topo/mpid_topo.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDI_Topo_Comm_create
void
void MPIDI_Topo_Comm_create (MPID_Comm *comm) { MPID_assert (comm!= NULL); if (comm->topo_fns) MPIU_Free(comm->topo_fns); comm->topo_fns=NULL; /* User may disable all topology optimizations */ if (!MPIDI_Process.optimized.topology) return; /* ****************************************** */ /* Allocate space for the topology pointers */ /* ****************************************** */ comm->topo_fns = (MPID_TopoOps *)MPIU_Malloc(sizeof(MPID_TopoOps)); MPID_assert (comm->topo_fns != NULL); memset (comm->topo_fns, 0, sizeof(MPID_TopoOps)); comm->topo_fns->cartMap = MPID_Cart_map; }
/** * \brief Hook function to handle topology-specific optimization during communicator creation */
\brief Hook function to handle topology-specific optimization during communicator creation
[ "\\", "brief", "Hook", "function", "to", "handle", "topology", "-", "specific", "optimization", "during", "communicator", "creation" ]
void MPIDI_Topo_Comm_create (MPID_Comm *comm) { MPID_assert (comm!= NULL); if (comm->topo_fns) MPIU_Free(comm->topo_fns); comm->topo_fns=NULL; if (!MPIDI_Process.optimized.topology) return; comm->topo_fns = (MPID_TopoOps *)MPIU_Malloc(sizeof(MPID_TopoOps)); MPID_assert (comm->topo_fns != NULL); memset (comm->topo_fns, 0, sizeof(MPID_TopoOps)); comm->topo_fns->cartMap = MPID_Cart_map; }
[ "void", "MPIDI_Topo_Comm_create", "(", "MPID_Comm", "*", "comm", ")", "{", "MPID_assert", "(", "comm", "!=", "NULL", ")", ";", "if", "(", "comm", "->", "topo_fns", ")", "MPIU_Free", "(", "comm", "->", "topo_fns", ")", ";", "comm", "->", "topo_fns", "=", "NULL", ";", "if", "(", "!", "MPIDI_Process", ".", "optimized", ".", "topology", ")", "return", ";", "comm", "->", "topo_fns", "=", "(", "MPID_TopoOps", "*", ")", "MPIU_Malloc", "(", "sizeof", "(", "MPID_TopoOps", ")", ")", ";", "MPID_assert", "(", "comm", "->", "topo_fns", "!=", "NULL", ")", ";", "memset", "(", "comm", "->", "topo_fns", ",", "0", ",", "sizeof", "(", "MPID_TopoOps", ")", ")", ";", "comm", "->", "topo_fns", "->", "cartMap", "=", "MPID_Cart_map", ";", "}" ]
\brief Hook function to handle topology-specific optimization during communicator creation
[ "\\", "brief", "Hook", "function", "to", "handle", "topology", "-", "specific", "optimization", "during", "communicator", "creation" ]
[ "/* User may disable all topology optimizations */", "/* ****************************************** */", "/* Allocate space for the topology pointers */", "/* ****************************************** */" ]
[ { "param": "comm", "type": "MPID_Comm" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "comm", "type": "MPID_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bebe12d3f92f09f88a296bd3351d4d3b6bb95bb3
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/comm/topo/mpid_topo.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDI_Topo_Comm_destroy
void
void MPIDI_Topo_Comm_destroy (MPID_Comm *comm) { MPID_assert (comm != NULL); if (comm->topo_fns) MPIU_Free(comm->topo_fns); comm->topo_fns = NULL; }
/** * \brief Hook function to handle topology-specific optimization during communicator destruction * \note We want to free the associated topo_fns buffer at this time. */
\brief Hook function to handle topology-specific optimization during communicator destruction \note We want to free the associated topo_fns buffer at this time.
[ "\\", "brief", "Hook", "function", "to", "handle", "topology", "-", "specific", "optimization", "during", "communicator", "destruction", "\\", "note", "We", "want", "to", "free", "the", "associated", "topo_fns", "buffer", "at", "this", "time", "." ]
void MPIDI_Topo_Comm_destroy (MPID_Comm *comm) { MPID_assert (comm != NULL); if (comm->topo_fns) MPIU_Free(comm->topo_fns); comm->topo_fns = NULL; }
[ "void", "MPIDI_Topo_Comm_destroy", "(", "MPID_Comm", "*", "comm", ")", "{", "MPID_assert", "(", "comm", "!=", "NULL", ")", ";", "if", "(", "comm", "->", "topo_fns", ")", "MPIU_Free", "(", "comm", "->", "topo_fns", ")", ";", "comm", "->", "topo_fns", "=", "NULL", ";", "}" ]
\brief Hook function to handle topology-specific optimization during communicator destruction \note We want to free the associated topo_fns buffer at this time.
[ "\\", "brief", "Hook", "function", "to", "handle", "topology", "-", "specific", "optimization", "during", "communicator", "destruction", "\\", "note", "We", "want", "to", "free", "the", "associated", "topo_fns", "buffer", "at", "this", "time", "." ]
[]
[ { "param": "comm", "type": "MPID_Comm" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "comm", "type": "MPID_Comm", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
08649415f5b6d93d505c84a7d166dbe485df5849
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/comm/topo/mpidi_cart_map_fold.c
[ "Intel", "mpich2", "Unlicense" ]
C
find_fold
int
static int find_fold( int nd1, int d1[], int nd2, int d2[], int fold[][3] ) { int neg_nfold=0, pos_nfold=0; int neg_fold=1, pos_fold=1; int i, j; #if 0 static int count=0; #endif /* initialize matrix */ for (i=0; i<3; i++) for (j=0; j<3; j++) fold[i][j] = 0; /* count requesting folds and folds can gives away. */ for (i=0; i<nd1; i++) { /* free folds */ if (d1[i] < d2[i]) { fold[i][i] = d2[i]/d1[i]; /* floor () */ pos_fold *= fold[i][i]; pos_nfold ++; } else /* needed folds */ if (d1[i] > d2[i]) { fold[i][i] = -(d1[i]+d2[i]-1)/d2[i]; /* roof () */ neg_fold *= (-fold[i][i]); neg_nfold ++; } } /* always: physical ndims >= virtual ndims */ for (i=nd1; i<nd2; i++) if (d2[i] > 1) { fold[i][i] = d2[i]; pos_fold *= fold[i][i]; pos_nfold ++; } /* requesting folds > available folds --> can not fold. */ if (neg_fold > pos_fold) return 1; /* Merge the negative folds and positive folds. For 3D case, there are following possible cases: 0 dimension requests folds; 1 dimension requests folds : must have 1 or 2 dimensions have free folds. 2 dimensions requests folds: must have 1 dimension has free folds. Previous test excludes cases that free folds are fewer than needing folds. */ /* no fold is needed */ if (!neg_nfold) { for (i=0; i<nd2; i++) fold[i][i] = 0; return 0; } else /* only one dimension NEEDS folds from other 1/2 dimensions */ if (neg_nfold == 1) { for (i=0; i<nd2; i++) if (fold[i][i] < 0) /* this is needy dimension */ { int ask = -fold[i][i]; /* now how many folds do you want */ for (j=0; j<nd2; j++) /* search through dimension to satisfy the need */ { if (j==i) continue; if (fold[j][j] > 0 && ask > 1) /* j dimension has some folds */ { /* j dimension can fully satisfy the left need */ if (fold[j][j] >= ask) { fold[j][i] = ask; ask = 0; } /* j dimension can partially satisfy the left need */ else { fold[j][i] = fold[j][j]; ask = (ask + fold[j][j] -1) / fold[j][j]; /* roof () */ } } } /* end of the try, still left some needs --> fail */ if (ask > 1) return 1; } } else /* only one dimension can GIVE folds to other 1/2 dimensions */ if (pos_nfold == 1) { for (i=0; i<nd2; i++) if (fold[i][i] > 0) /* this is the donor dimension */ { int has = fold[i][i]; /* how many folds can it give away */ for (j=0; j<nd2; j++) /* search other dimensions to try to give */ { if (j==i) continue; if (fold[j][j] < 0 && has > 1) /* j needs folds and i has some left */ { /* left free folds can satisfy j's request */ if (-fold[j][j] <= has) { fold[i][j] = -fold[j][j]; has = has / (-fold[j][j]); } /* donor broken */ else { has = 0; break; } } } /* end of the try, left deficit --> fail */ if (has < 1) return 1; } } #if 0 if (!count) { printf( "\t\tfold 1 = " ); for (i=0; i<3; i++) { for (j=0; j<3; j++) printf( "%4d", fold[i][j] ); printf( "; " ); } printf( "\n" ); } count ++; #endif return 0; }
/* fail = find_fold( dims1[ndims1], dims2[ndims2], fold[3][3] ) searchs a folding schedule, the folding schedule is stored in matrix fold[3][3] e.g. fold[i][j] = 3 indicates to unfold dimension i onto dimension j. fold[i][i] has no meaning. For 3D case as here, there will be at most 2 non-zero, non-diagonal entries. Diagonal entries are useless here. Further more, when the 2 non-zero entries are in the same row, the virtual cartesian is unfolded from the row_id dimension onto the other dimensions in physical cartesian. when the 2 entries are in the same coloum, the virtual cartesian is actually folded from the physical cartesian. */
fail = find_fold( dims1[ndims1], dims2[ndims2], fold[3][3] ) searchs a folding schedule, the folding schedule is stored in matrix fold[3][3] e.g. fold[i][j] = 3 indicates to unfold dimension i onto dimension j. fold[i][i] has no meaning. For 3D case as here, there will be at most 2 non-zero, non-diagonal entries. Diagonal entries are useless here. Further more, when the 2 non-zero entries are in the same row, the virtual cartesian is unfolded from the row_id dimension onto the other dimensions in physical cartesian. when the 2 entries are in the same coloum, the virtual cartesian is actually folded from the physical cartesian.
[ "fail", "=", "find_fold", "(", "dims1", "[", "ndims1", "]", "dims2", "[", "ndims2", "]", "fold", "[", "3", "]", "[", "3", "]", ")", "searchs", "a", "folding", "schedule", "the", "folding", "schedule", "is", "stored", "in", "matrix", "fold", "[", "3", "]", "[", "3", "]", "e", ".", "g", ".", "fold", "[", "i", "]", "[", "j", "]", "=", "3", "indicates", "to", "unfold", "dimension", "i", "onto", "dimension", "j", ".", "fold", "[", "i", "]", "[", "i", "]", "has", "no", "meaning", ".", "For", "3D", "case", "as", "here", "there", "will", "be", "at", "most", "2", "non", "-", "zero", "non", "-", "diagonal", "entries", ".", "Diagonal", "entries", "are", "useless", "here", ".", "Further", "more", "when", "the", "2", "non", "-", "zero", "entries", "are", "in", "the", "same", "row", "the", "virtual", "cartesian", "is", "unfolded", "from", "the", "row_id", "dimension", "onto", "the", "other", "dimensions", "in", "physical", "cartesian", ".", "when", "the", "2", "entries", "are", "in", "the", "same", "coloum", "the", "virtual", "cartesian", "is", "actually", "folded", "from", "the", "physical", "cartesian", "." ]
static int find_fold( int nd1, int d1[], int nd2, int d2[], int fold[][3] ) { int neg_nfold=0, pos_nfold=0; int neg_fold=1, pos_fold=1; int i, j; #if 0 static int count=0; #endif for (i=0; i<3; i++) for (j=0; j<3; j++) fold[i][j] = 0; for (i=0; i<nd1; i++) { if (d1[i] < d2[i]) { fold[i][i] = d2[i]/d1[i]; pos_fold *= fold[i][i]; pos_nfold ++; } else if (d1[i] > d2[i]) { fold[i][i] = -(d1[i]+d2[i]-1)/d2[i]; neg_fold *= (-fold[i][i]); neg_nfold ++; } } for (i=nd1; i<nd2; i++) if (d2[i] > 1) { fold[i][i] = d2[i]; pos_fold *= fold[i][i]; pos_nfold ++; } if (neg_fold > pos_fold) return 1; if (!neg_nfold) { for (i=0; i<nd2; i++) fold[i][i] = 0; return 0; } else if (neg_nfold == 1) { for (i=0; i<nd2; i++) if (fold[i][i] < 0) { int ask = -fold[i][i]; for (j=0; j<nd2; j++) { if (j==i) continue; if (fold[j][j] > 0 && ask > 1) { if (fold[j][j] >= ask) { fold[j][i] = ask; ask = 0; } else { fold[j][i] = fold[j][j]; ask = (ask + fold[j][j] -1) / fold[j][j]; } } } if (ask > 1) return 1; } } else if (pos_nfold == 1) { for (i=0; i<nd2; i++) if (fold[i][i] > 0) { int has = fold[i][i]; for (j=0; j<nd2; j++) { if (j==i) continue; if (fold[j][j] < 0 && has > 1) { if (-fold[j][j] <= has) { fold[i][j] = -fold[j][j]; has = has / (-fold[j][j]); } else { has = 0; break; } } } if (has < 1) return 1; } } #if 0 if (!count) { printf( "\t\tfold 1 = " ); for (i=0; i<3; i++) { for (j=0; j<3; j++) printf( "%4d", fold[i][j] ); printf( "; " ); } printf( "\n" ); } count ++; #endif return 0; }
[ "static", "int", "find_fold", "(", "int", "nd1", ",", "int", "d1", "[", "]", ",", "int", "nd2", ",", "int", "d2", "[", "]", ",", "int", "fold", "[", "]", "[", "3", "]", ")", "{", "int", "neg_nfold", "=", "0", ",", "pos_nfold", "=", "0", ";", "int", "neg_fold", "=", "1", ",", "pos_fold", "=", "1", ";", "int", "i", ",", "j", ";", "#if", "0", "\n", "static", "int", "count", "=", "0", ";", "#endif", "for", "(", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "for", "(", "j", "=", "0", ";", "j", "<", "3", ";", "j", "++", ")", "fold", "[", "i", "]", "[", "j", "]", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<", "nd1", ";", "i", "++", ")", "{", "if", "(", "d1", "[", "i", "]", "<", "d2", "[", "i", "]", ")", "{", "fold", "[", "i", "]", "[", "i", "]", "=", "d2", "[", "i", "]", "/", "d1", "[", "i", "]", ";", "pos_fold", "*=", "fold", "[", "i", "]", "[", "i", "]", ";", "pos_nfold", "++", ";", "}", "else", "if", "(", "d1", "[", "i", "]", ">", "d2", "[", "i", "]", ")", "{", "fold", "[", "i", "]", "[", "i", "]", "=", "-", "(", "d1", "[", "i", "]", "+", "d2", "[", "i", "]", "-", "1", ")", "/", "d2", "[", "i", "]", ";", "neg_fold", "*=", "(", "-", "fold", "[", "i", "]", "[", "i", "]", ")", ";", "neg_nfold", "++", ";", "}", "}", "for", "(", "i", "=", "nd1", ";", "i", "<", "nd2", ";", "i", "++", ")", "if", "(", "d2", "[", "i", "]", ">", "1", ")", "{", "fold", "[", "i", "]", "[", "i", "]", "=", "d2", "[", "i", "]", ";", "pos_fold", "*=", "fold", "[", "i", "]", "[", "i", "]", ";", "pos_nfold", "++", ";", "}", "if", "(", "neg_fold", ">", "pos_fold", ")", "return", "1", ";", "if", "(", "!", "neg_nfold", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "nd2", ";", "i", "++", ")", "fold", "[", "i", "]", "[", "i", "]", "=", "0", ";", "return", "0", ";", "}", "else", "if", "(", "neg_nfold", "==", "1", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "nd2", ";", "i", "++", ")", "if", "(", "fold", "[", "i", "]", "[", "i", "]", "<", "0", ")", "{", "int", "ask", "=", "-", "fold", "[", "i", "]", "[", "i", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nd2", ";", "j", "++", ")", "{", "if", "(", "j", "==", "i", ")", "continue", ";", "if", "(", "fold", "[", "j", "]", "[", "j", "]", ">", "0", "&&", "ask", ">", "1", ")", "{", "if", "(", "fold", "[", "j", "]", "[", "j", "]", ">=", "ask", ")", "{", "fold", "[", "j", "]", "[", "i", "]", "=", "ask", ";", "ask", "=", "0", ";", "}", "else", "{", "fold", "[", "j", "]", "[", "i", "]", "=", "fold", "[", "j", "]", "[", "j", "]", ";", "ask", "=", "(", "ask", "+", "fold", "[", "j", "]", "[", "j", "]", "-", "1", ")", "/", "fold", "[", "j", "]", "[", "j", "]", ";", "}", "}", "}", "if", "(", "ask", ">", "1", ")", "return", "1", ";", "}", "}", "else", "if", "(", "pos_nfold", "==", "1", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "nd2", ";", "i", "++", ")", "if", "(", "fold", "[", "i", "]", "[", "i", "]", ">", "0", ")", "{", "int", "has", "=", "fold", "[", "i", "]", "[", "i", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nd2", ";", "j", "++", ")", "{", "if", "(", "j", "==", "i", ")", "continue", ";", "if", "(", "fold", "[", "j", "]", "[", "j", "]", "<", "0", "&&", "has", ">", "1", ")", "{", "if", "(", "-", "fold", "[", "j", "]", "[", "j", "]", "<=", "has", ")", "{", "fold", "[", "i", "]", "[", "j", "]", "=", "-", "fold", "[", "j", "]", "[", "j", "]", ";", "has", "=", "has", "/", "(", "-", "fold", "[", "j", "]", "[", "j", "]", ")", ";", "}", "else", "{", "has", "=", "0", ";", "break", ";", "}", "}", "}", "if", "(", "has", "<", "1", ")", "return", "1", ";", "}", "}", "#if", "0", "\n", "if", "(", "!", "count", ")", "{", "printf", "(", "\"", "\\t", "\\t", "\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "for", "(", "j", "=", "0", ";", "j", "<", "3", ";", "j", "++", ")", "printf", "(", "\"", "\"", ",", "fold", "[", "i", "]", "[", "j", "]", ")", ";", "printf", "(", "\"", "\"", ")", ";", "}", "printf", "(", "\"", "\\n", "\"", ")", ";", "}", "count", "++", ";", "#endif", "return", "0", ";", "}" ]
fail = find_fold( dims1[ndims1], dims2[ndims2], fold[3][3] ) searchs a folding schedule, the folding schedule is stored in matrix fold[3][3] e.g.
[ "fail", "=", "find_fold", "(", "dims1", "[", "ndims1", "]", "dims2", "[", "ndims2", "]", "fold", "[", "3", "]", "[", "3", "]", ")", "searchs", "a", "folding", "schedule", "the", "folding", "schedule", "is", "stored", "in", "matrix", "fold", "[", "3", "]", "[", "3", "]", "e", ".", "g", "." ]
[ "/* initialize matrix */", "/* count requesting folds and folds can gives away. */", "/* free folds */", "/* floor () */", "/* needed folds */", "/* roof () */", "/* always: physical ndims >= virtual ndims */", "/* requesting folds > available folds --> can not fold. */", "/*\n Merge the negative folds and positive folds. For 3D case, there are following possible cases:\n 0 dimension requests folds;\n 1 dimension requests folds : must have 1 or 2 dimensions have free folds.\n 2 dimensions requests folds: must have 1 dimension has free folds.\n Previous test excludes cases that free folds are fewer than needing folds.\n */", "/* no fold is needed */", "/* only one dimension NEEDS folds from other 1/2 dimensions */", "/* this is needy dimension */", "/* now how many folds do you want */", "/* search through dimension to satisfy the need */", "/* j dimension has some folds */", "/* j dimension can fully satisfy the left need */", "/* j dimension can partially satisfy the left need */", "/* roof () */", "/* end of the try, still left some needs --> fail */", "/* only one dimension can GIVE folds to other 1/2 dimensions */", "/* this is the donor dimension */", "/* how many folds can it give away */", "/* search other dimensions to try to give */", "/* j needs folds and i has some left */", "/* left free folds can satisfy j's request */", "/* donor broken */", "/* end of the try, left deficit --> fail */" ]
[ { "param": "nd1", "type": "int" }, { "param": "d1", "type": "int" }, { "param": "nd2", "type": "int" }, { "param": "d2", "type": "int" }, { "param": "fold", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "nd1", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "d1", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nd2", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "d2", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fold", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
08649415f5b6d93d505c84a7d166dbe485df5849
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/comm/topo/mpidi_cart_map_fold.c
[ "Intel", "mpich2", "Unlicense" ]
C
perm_dims_match
int
static int perm_dims_match( int nd1, int d1[], int c1[], int nd2, int d2[], int c2[] ) { int perm[3] = {0,1,2}; int fold[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}; int fail, finished; int dd2[3], i; fail = 1; finished = 0; while( !finished ) { for (i=0; i<3; i++) dd2[i] = d2[perm[i]]; fail = find_fold( nd1, d1, nd2, dd2, fold ); if (!fail) { break; } finished = perm_next( nd2, perm ); } if (fail) return 1; perform_fold( nd1, d1, c1, nd2, d2, c2, perm, fold ); return 0; }
/* Main control of the folding mapping. 1. This routine only folds the 3 true dimensions. T dimension (if in virtual node mode) is handled specifically in the caller of this routine. 2. finished = perm_next( ndims, perm_array[ndims] ) gets the next permutation. It returns 1 when there is no next permutation. For ndims = 3, the permutation sequence is 0,1,2 --> 0,2,1 --> 1,0,2 --> 1,2,0 --> 2,0,1 --> 2,0,1 --> finished. 3. fail = find_fold( dims1[ndims1], dims2[ndims2], fold[3][3] ) searchs a folding schedule, the folding schedule is stored in matrix fold[3][3] e.g. fold[i][j] = 3 indicates to unfold dimension i onto dimension j. fold[i][i] has no meaning. For 3D case as here, there will be at most 2 non-zero, non-diagonal entries. Diagonal entries are useless here. Further more, when the 2 non-zero entries are in the same row, the virtual cartesian is unfolded from the row_id dimension onto the other dimensions in physical cartesian. when the 2 entries are in the same coloum, the virtual cartesian is actually folded from the physical cartesian. 4. perform_fold( vir_coord[], phy_coord[], fold[3][3] ) does the folding following the schedule given by fold[3][3]. */
Main control of the folding mapping. 1. This routine only folds the 3 true dimensions. T dimension (if in virtual node mode) is handled specifically in the caller of this routine. 2. finished = perm_next( ndims, perm_array[ndims] ) gets the next permutation. It returns 1 when there is no next permutation.
[ "Main", "control", "of", "the", "folding", "mapping", ".", "1", ".", "This", "routine", "only", "folds", "the", "3", "true", "dimensions", ".", "T", "dimension", "(", "if", "in", "virtual", "node", "mode", ")", "is", "handled", "specifically", "in", "the", "caller", "of", "this", "routine", ".", "2", ".", "finished", "=", "perm_next", "(", "ndims", "perm_array", "[", "ndims", "]", ")", "gets", "the", "next", "permutation", ".", "It", "returns", "1", "when", "there", "is", "no", "next", "permutation", "." ]
static int perm_dims_match( int nd1, int d1[], int c1[], int nd2, int d2[], int c2[] ) { int perm[3] = {0,1,2}; int fold[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}; int fail, finished; int dd2[3], i; fail = 1; finished = 0; while( !finished ) { for (i=0; i<3; i++) dd2[i] = d2[perm[i]]; fail = find_fold( nd1, d1, nd2, dd2, fold ); if (!fail) { break; } finished = perm_next( nd2, perm ); } if (fail) return 1; perform_fold( nd1, d1, c1, nd2, d2, c2, perm, fold ); return 0; }
[ "static", "int", "perm_dims_match", "(", "int", "nd1", ",", "int", "d1", "[", "]", ",", "int", "c1", "[", "]", ",", "int", "nd2", ",", "int", "d2", "[", "]", ",", "int", "c2", "[", "]", ")", "{", "int", "perm", "[", "3", "]", "=", "{", "0", ",", "1", ",", "2", "}", ";", "int", "fold", "[", "3", "]", "[", "3", "]", "=", "{", "{", "0", ",", "0", ",", "0", "}", ",", "{", "0", ",", "0", ",", "0", "}", ",", "{", "0", ",", "0", ",", "0", "}", "}", ";", "int", "fail", ",", "finished", ";", "int", "dd2", "[", "3", "]", ",", "i", ";", "fail", "=", "1", ";", "finished", "=", "0", ";", "while", "(", "!", "finished", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "dd2", "[", "i", "]", "=", "d2", "[", "perm", "[", "i", "]", "]", ";", "fail", "=", "find_fold", "(", "nd1", ",", "d1", ",", "nd2", ",", "dd2", ",", "fold", ")", ";", "if", "(", "!", "fail", ")", "{", "break", ";", "}", "finished", "=", "perm_next", "(", "nd2", ",", "perm", ")", ";", "}", "if", "(", "fail", ")", "return", "1", ";", "perform_fold", "(", "nd1", ",", "d1", ",", "c1", ",", "nd2", ",", "d2", ",", "c2", ",", "perm", ",", "fold", ")", ";", "return", "0", ";", "}" ]
Main control of the folding mapping.
[ "Main", "control", "of", "the", "folding", "mapping", "." ]
[]
[ { "param": "nd1", "type": "int" }, { "param": "d1", "type": "int" }, { "param": "c1", "type": "int" }, { "param": "nd2", "type": "int" }, { "param": "d2", "type": "int" }, { "param": "c2", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "nd1", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "d1", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "c1", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nd2", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "d2", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "c2", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
08649415f5b6d93d505c84a7d166dbe485df5849
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/comm/topo/mpidi_cart_map_fold.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDI_Cart_map_coord_to_rank
void
void MPIDI_Cart_map_coord_to_rank( int size, int nd, int dims[], int cc[], int *newrank ) { int radix, i; *newrank = 0; radix = 1; for (i=nd-1; i>=0; i--) { if (cc[i] >= dims[i]) { /* outside vir_cart box */ *newrank = MPI_UNDEFINED; break; } *newrank += cc[i] * radix; radix *= dims[i]; } if (*newrank >= size) *newrank = MPI_UNDEFINED; return; }
/* C_order means the right-most dimension is the fastest changing dimension. Of course, dims[3] is on the right of dims[0]. The cart utilities routines of MPICH2 follows this order; BG/L XYZT mapping following the reverse order (Fortran order). */
C_order means the right-most dimension is the fastest changing dimension. Of course, dims[3] is on the right of dims[0]. The cart utilities routines of MPICH2 follows this order; BG/L XYZT mapping following the reverse order (Fortran order).
[ "C_order", "means", "the", "right", "-", "most", "dimension", "is", "the", "fastest", "changing", "dimension", ".", "Of", "course", "dims", "[", "3", "]", "is", "on", "the", "right", "of", "dims", "[", "0", "]", ".", "The", "cart", "utilities", "routines", "of", "MPICH2", "follows", "this", "order", ";", "BG", "/", "L", "XYZT", "mapping", "following", "the", "reverse", "order", "(", "Fortran", "order", ")", "." ]
void MPIDI_Cart_map_coord_to_rank( int size, int nd, int dims[], int cc[], int *newrank ) { int radix, i; *newrank = 0; radix = 1; for (i=nd-1; i>=0; i--) { if (cc[i] >= dims[i]) { *newrank = MPI_UNDEFINED; break; } *newrank += cc[i] * radix; radix *= dims[i]; } if (*newrank >= size) *newrank = MPI_UNDEFINED; return; }
[ "void", "MPIDI_Cart_map_coord_to_rank", "(", "int", "size", ",", "int", "nd", ",", "int", "dims", "[", "]", ",", "int", "cc", "[", "]", ",", "int", "*", "newrank", ")", "{", "int", "radix", ",", "i", ";", "*", "newrank", "=", "0", ";", "radix", "=", "1", ";", "for", "(", "i", "=", "nd", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "cc", "[", "i", "]", ">=", "dims", "[", "i", "]", ")", "{", "*", "newrank", "=", "MPI_UNDEFINED", ";", "break", ";", "}", "*", "newrank", "+=", "cc", "[", "i", "]", "*", "radix", ";", "radix", "*=", "dims", "[", "i", "]", ";", "}", "if", "(", "*", "newrank", ">=", "size", ")", "*", "newrank", "=", "MPI_UNDEFINED", ";", "return", ";", "}" ]
C_order means the right-most dimension is the fastest changing dimension.
[ "C_order", "means", "the", "right", "-", "most", "dimension", "is", "the", "fastest", "changing", "dimension", "." ]
[ "/* outside vir_cart box */" ]
[ { "param": "size", "type": "int" }, { "param": "nd", "type": "int" }, { "param": "dims", "type": "int" }, { "param": "cc", "type": "int" }, { "param": "newrank", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nd", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dims", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cc", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "newrank", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
08649415f5b6d93d505c84a7d166dbe485df5849
graingert/MPICH2-Armel-Raspberry-Pi-1
src/mpid/dcmfd/src/comm/topo/mpidi_cart_map_fold.c
[ "Intel", "mpich2", "Unlicense" ]
C
MPIDI_Cart_map_fold
int
int MPIDI_Cart_map_fold( MPIDI_VirtualCart *vir_cart, MPIDI_PhysicalCart *phy_cart, int *newrank ) { int notdone, i, j; int c1[3], d1[3], c2[3], d2[3], cc[3]; int vir_perm[4] = {0,1,2,3}; int phy_perm[4] = {0,1,2,3}; /* sort dimension in decreasing order to hope reduce the number of foldings. */ MPIDI_Cart_dims_sort( vir_cart->ndims, vir_cart->dims, vir_perm ); MPIDI_Cart_dims_sort( 3, phy_cart->dims, phy_perm ); notdone = 1; /* covers case: * 1. 4 = phy_cart->ndims > vir_cart->ndims > 1 * solution: * 1. try each vir_cart->dims[] * 2. vir_cart->dims[i] = roof (vir_cart->dims[i] / 2); * 3. try fold * 4. coord[i] = coord[i] * 2 + cpu_id */ if (phy_cart->ndims==4 && vir_cart->ndims<4) { for (i=vir_cart->ndims-1; i>=0; i--) { d1[i] = (vir_cart->dims[vir_perm[i]]+1)/2; for (j=0; j<vir_cart->ndims; j++) if (j!=i) d1[j] = vir_cart->dims[vir_perm[j]]; for (j=0; j<3; j++) { c2[j] = phy_cart->coord[phy_perm[j]] - phy_cart->start[phy_perm[j]]; d2[j] = phy_cart->dims [phy_perm[j]]; c1[j] = 0; } if (perm_dims_match( vir_cart->ndims, d1, c1, 3, d2, c2 )) continue; for (j=0; j<3; j++) if (j!=i) cc[vir_perm[j]] = c1[j]; cc[vir_perm[i]] = c1[i] * 2 + (phy_cart->coord[3] - phy_cart->start[3]); notdone = 0; break; } } /* covers cases: * 1. phy_cart->ndims == vir_cart->ndims == 4 * solution: remove the T dimension from both phy and vir cartesian. Then this case * becomes case 2. * 2. 3 = phy_cart->ndims >= vir_cart->ndims > 1 * solusion: just try fold. * */ else { int vir_ndims = vir_cart->ndims; if (vir_ndims == 4) { if (vir_cart->dims[vir_perm[3]] != 2) return 1; vir_ndims = 3; } for (j=0; j<vir_ndims; j++) d1[j] = vir_cart->dims[vir_perm[j]]; for (j=0; j<3; j++) { c2[j] = phy_cart->coord[phy_perm[j]] - phy_cart->start[phy_perm[j]]; d2[j] = phy_cart->dims [phy_perm[j]]; c1[j] = 0; } if (!perm_dims_match( vir_ndims, d1, c1, phy_cart->ndims, d2, c2 )) { for (j=0; j<3; j++) cc[vir_perm[j]] = c1[j]; notdone = 0; } } if (notdone) return notdone; /* C_order means the right-most dimension is the fastest changing dimension. Of course, dims[3] is on the right of dims[0]. The cart utilities routines of MPICH2 follows this order; BG/L XYZT mapping following the reverse order (Fortran order). */ MPIDI_Cart_map_coord_to_rank( vir_cart->size, vir_cart->ndims, vir_cart->dims, cc, newrank ); /* printf( "\t<%2d,%2d,%2d,%2d> to %4d (notdone = %d)\n", phy_cart->coord[0], phy_cart->coord[1], phy_cart->coord[2], phy_cart->coord[3], *newrank, notdone ); */ return notdone; }
/* Try to map arbitrary 2D-4D requests onto 3D/4D mesh (rectangular communicator). The basic idea is like to fold a paper in both dimension into a 3D mesh. There do exist some edge loss when folding in both dimensions and therefore the mapping dialation can be greater than 1. The core operator is defined in routine "unfold_3d" which unfolds dim_X onto dim_Z with dim_Y unchanged. When starting from physical coordinates / dimensions, the operator is transitive. i.e., one can do unfold_3d( X, Z, dims[], coord[] ) unfold_3d( X, Y, dims[], coord[] ) And the dims[] and coord[] all changes to the new cartesian. Currently, limitation is only for 4D request. For 4D request, there has to be one dimension with size 2 to match the T dimension. This is because I do not fully understand folding on 4D cartesian. */
Try to map arbitrary 2D-4D requests onto 3D/4D mesh (rectangular communicator). The basic idea is like to fold a paper in both dimension into a 3D mesh. There do exist some edge loss when folding in both dimensions and therefore the mapping dialation can be greater than 1. The core operator is defined in routine "unfold_3d" which unfolds dim_X onto dim_Z with dim_Y unchanged. When starting from physical coordinates / dimensions, the operator is transitive. i.e., one can do unfold_3d( X, Z, dims[], coord[] ) unfold_3d( X, Y, dims[], coord[] ) And the dims[] and coord[] all changes to the new cartesian. Currently, limitation is only for 4D request. For 4D request, there has to be one dimension with size 2 to match the T dimension. This is because I do not fully understand folding on 4D cartesian.
[ "Try", "to", "map", "arbitrary", "2D", "-", "4D", "requests", "onto", "3D", "/", "4D", "mesh", "(", "rectangular", "communicator", ")", ".", "The", "basic", "idea", "is", "like", "to", "fold", "a", "paper", "in", "both", "dimension", "into", "a", "3D", "mesh", ".", "There", "do", "exist", "some", "edge", "loss", "when", "folding", "in", "both", "dimensions", "and", "therefore", "the", "mapping", "dialation", "can", "be", "greater", "than", "1", ".", "The", "core", "operator", "is", "defined", "in", "routine", "\"", "unfold_3d", "\"", "which", "unfolds", "dim_X", "onto", "dim_Z", "with", "dim_Y", "unchanged", ".", "When", "starting", "from", "physical", "coordinates", "/", "dimensions", "the", "operator", "is", "transitive", ".", "i", ".", "e", ".", "one", "can", "do", "unfold_3d", "(", "X", "Z", "dims", "[]", "coord", "[]", ")", "unfold_3d", "(", "X", "Y", "dims", "[]", "coord", "[]", ")", "And", "the", "dims", "[]", "and", "coord", "[]", "all", "changes", "to", "the", "new", "cartesian", ".", "Currently", "limitation", "is", "only", "for", "4D", "request", ".", "For", "4D", "request", "there", "has", "to", "be", "one", "dimension", "with", "size", "2", "to", "match", "the", "T", "dimension", ".", "This", "is", "because", "I", "do", "not", "fully", "understand", "folding", "on", "4D", "cartesian", "." ]
int MPIDI_Cart_map_fold( MPIDI_VirtualCart *vir_cart, MPIDI_PhysicalCart *phy_cart, int *newrank ) { int notdone, i, j; int c1[3], d1[3], c2[3], d2[3], cc[3]; int vir_perm[4] = {0,1,2,3}; int phy_perm[4] = {0,1,2,3}; MPIDI_Cart_dims_sort( vir_cart->ndims, vir_cart->dims, vir_perm ); MPIDI_Cart_dims_sort( 3, phy_cart->dims, phy_perm ); notdone = 1; if (phy_cart->ndims==4 && vir_cart->ndims<4) { for (i=vir_cart->ndims-1; i>=0; i--) { d1[i] = (vir_cart->dims[vir_perm[i]]+1)/2; for (j=0; j<vir_cart->ndims; j++) if (j!=i) d1[j] = vir_cart->dims[vir_perm[j]]; for (j=0; j<3; j++) { c2[j] = phy_cart->coord[phy_perm[j]] - phy_cart->start[phy_perm[j]]; d2[j] = phy_cart->dims [phy_perm[j]]; c1[j] = 0; } if (perm_dims_match( vir_cart->ndims, d1, c1, 3, d2, c2 )) continue; for (j=0; j<3; j++) if (j!=i) cc[vir_perm[j]] = c1[j]; cc[vir_perm[i]] = c1[i] * 2 + (phy_cart->coord[3] - phy_cart->start[3]); notdone = 0; break; } } else { int vir_ndims = vir_cart->ndims; if (vir_ndims == 4) { if (vir_cart->dims[vir_perm[3]] != 2) return 1; vir_ndims = 3; } for (j=0; j<vir_ndims; j++) d1[j] = vir_cart->dims[vir_perm[j]]; for (j=0; j<3; j++) { c2[j] = phy_cart->coord[phy_perm[j]] - phy_cart->start[phy_perm[j]]; d2[j] = phy_cart->dims [phy_perm[j]]; c1[j] = 0; } if (!perm_dims_match( vir_ndims, d1, c1, phy_cart->ndims, d2, c2 )) { for (j=0; j<3; j++) cc[vir_perm[j]] = c1[j]; notdone = 0; } } if (notdone) return notdone; MPIDI_Cart_map_coord_to_rank( vir_cart->size, vir_cart->ndims, vir_cart->dims, cc, newrank ); return notdone; }
[ "int", "MPIDI_Cart_map_fold", "(", "MPIDI_VirtualCart", "*", "vir_cart", ",", "MPIDI_PhysicalCart", "*", "phy_cart", ",", "int", "*", "newrank", ")", "{", "int", "notdone", ",", "i", ",", "j", ";", "int", "c1", "[", "3", "]", ",", "d1", "[", "3", "]", ",", "c2", "[", "3", "]", ",", "d2", "[", "3", "]", ",", "cc", "[", "3", "]", ";", "int", "vir_perm", "[", "4", "]", "=", "{", "0", ",", "1", ",", "2", ",", "3", "}", ";", "int", "phy_perm", "[", "4", "]", "=", "{", "0", ",", "1", ",", "2", ",", "3", "}", ";", "MPIDI_Cart_dims_sort", "(", "vir_cart", "->", "ndims", ",", "vir_cart", "->", "dims", ",", "vir_perm", ")", ";", "MPIDI_Cart_dims_sort", "(", "3", ",", "phy_cart", "->", "dims", ",", "phy_perm", ")", ";", "notdone", "=", "1", ";", "if", "(", "phy_cart", "->", "ndims", "==", "4", "&&", "vir_cart", "->", "ndims", "<", "4", ")", "{", "for", "(", "i", "=", "vir_cart", "->", "ndims", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "d1", "[", "i", "]", "=", "(", "vir_cart", "->", "dims", "[", "vir_perm", "[", "i", "]", "]", "+", "1", ")", "/", "2", ";", "for", "(", "j", "=", "0", ";", "j", "<", "vir_cart", "->", "ndims", ";", "j", "++", ")", "if", "(", "j", "!=", "i", ")", "d1", "[", "j", "]", "=", "vir_cart", "->", "dims", "[", "vir_perm", "[", "j", "]", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "3", ";", "j", "++", ")", "{", "c2", "[", "j", "]", "=", "phy_cart", "->", "coord", "[", "phy_perm", "[", "j", "]", "]", "-", "phy_cart", "->", "start", "[", "phy_perm", "[", "j", "]", "]", ";", "d2", "[", "j", "]", "=", "phy_cart", "->", "dims", "[", "phy_perm", "[", "j", "]", "]", ";", "c1", "[", "j", "]", "=", "0", ";", "}", "if", "(", "perm_dims_match", "(", "vir_cart", "->", "ndims", ",", "d1", ",", "c1", ",", "3", ",", "d2", ",", "c2", ")", ")", "continue", ";", "for", "(", "j", "=", "0", ";", "j", "<", "3", ";", "j", "++", ")", "if", "(", "j", "!=", "i", ")", "cc", "[", "vir_perm", "[", "j", "]", "]", "=", "c1", "[", "j", "]", ";", "cc", "[", "vir_perm", "[", "i", "]", "]", "=", "c1", "[", "i", "]", "*", "2", "+", "(", "phy_cart", "->", "coord", "[", "3", "]", "-", "phy_cart", "->", "start", "[", "3", "]", ")", ";", "notdone", "=", "0", ";", "break", ";", "}", "}", "else", "{", "int", "vir_ndims", "=", "vir_cart", "->", "ndims", ";", "if", "(", "vir_ndims", "==", "4", ")", "{", "if", "(", "vir_cart", "->", "dims", "[", "vir_perm", "[", "3", "]", "]", "!=", "2", ")", "return", "1", ";", "vir_ndims", "=", "3", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "vir_ndims", ";", "j", "++", ")", "d1", "[", "j", "]", "=", "vir_cart", "->", "dims", "[", "vir_perm", "[", "j", "]", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "3", ";", "j", "++", ")", "{", "c2", "[", "j", "]", "=", "phy_cart", "->", "coord", "[", "phy_perm", "[", "j", "]", "]", "-", "phy_cart", "->", "start", "[", "phy_perm", "[", "j", "]", "]", ";", "d2", "[", "j", "]", "=", "phy_cart", "->", "dims", "[", "phy_perm", "[", "j", "]", "]", ";", "c1", "[", "j", "]", "=", "0", ";", "}", "if", "(", "!", "perm_dims_match", "(", "vir_ndims", ",", "d1", ",", "c1", ",", "phy_cart", "->", "ndims", ",", "d2", ",", "c2", ")", ")", "{", "for", "(", "j", "=", "0", ";", "j", "<", "3", ";", "j", "++", ")", "cc", "[", "vir_perm", "[", "j", "]", "]", "=", "c1", "[", "j", "]", ";", "notdone", "=", "0", ";", "}", "}", "if", "(", "notdone", ")", "return", "notdone", ";", "MPIDI_Cart_map_coord_to_rank", "(", "vir_cart", "->", "size", ",", "vir_cart", "->", "ndims", ",", "vir_cart", "->", "dims", ",", "cc", ",", "newrank", ")", ";", "return", "notdone", ";", "}" ]
Try to map arbitrary 2D-4D requests onto 3D/4D mesh (rectangular communicator).
[ "Try", "to", "map", "arbitrary", "2D", "-", "4D", "requests", "onto", "3D", "/", "4D", "mesh", "(", "rectangular", "communicator", ")", "." ]
[ "/* sort dimension in decreasing order to hope reduce the number of foldings. */", "/* covers case:\n *\t1. 4 = phy_cart->ndims > vir_cart->ndims > 1\n * solution:\n * \t1. try each vir_cart->dims[]\n *\t2.\tvir_cart->dims[i] = roof (vir_cart->dims[i] / 2);\n * 3.\ttry fold\n * \t4.\tcoord[i] = coord[i] * 2 + cpu_id\n */", "/* covers cases:\n *\t1. phy_cart->ndims == vir_cart->ndims == 4\n *\t\tsolution: remove the T dimension from both phy and vir cartesian. Then this case\n *\t\t\t becomes case 2.\n *\t2. 3 = phy_cart->ndims >= vir_cart->ndims > 1\n *\t\tsolusion: just try fold.\n *\n */", "/* C_order means the right-most dimension is the fastest changing dimension.\n Of course, dims[3] is on the right of dims[0]. The cart utilities routines\n of MPICH2 follows this order; BG/L XYZT mapping following the reverse order\n (Fortran order).\n */", "/*\n printf( \"\\t<%2d,%2d,%2d,%2d> to %4d (notdone = %d)\\n\",\n phy_cart->coord[0],\n phy_cart->coord[1],\n phy_cart->coord[2],\n phy_cart->coord[3],\n *newrank,\n notdone );\n */" ]
[ { "param": "vir_cart", "type": "MPIDI_VirtualCart" }, { "param": "phy_cart", "type": "MPIDI_PhysicalCart" }, { "param": "newrank", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vir_cart", "type": "MPIDI_VirtualCart", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "phy_cart", "type": "MPIDI_PhysicalCart", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "newrank", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8e014617244e6e90090340602cc487a5a4f348c7
chemicstry/Ventilator
software/controller/lib/hal/hal_stm32.h
[ "Apache-2.0" ]
C
GpioPullUp
void
inline void GpioPullUp(GpioReg *gpio, int pin) { uint32_t x = gpio->pullup_pulldown & ~(3 << (2 * pin)); x |= 1 << (2 * pin); gpio->pullup_pulldown = x; }
// This adds a pull-up resistor to an input pin
This adds a pull-up resistor to an input pin
[ "This", "adds", "a", "pull", "-", "up", "resistor", "to", "an", "input", "pin" ]
inline void GpioPullUp(GpioReg *gpio, int pin) { uint32_t x = gpio->pullup_pulldown & ~(3 << (2 * pin)); x |= 1 << (2 * pin); gpio->pullup_pulldown = x; }
[ "inline", "void", "GpioPullUp", "(", "GpioReg", "*", "gpio", ",", "int", "pin", ")", "{", "uint32_t", "x", "=", "gpio", "->", "pullup_pulldown", "&", "~", "(", "3", "<<", "(", "2", "*", "pin", ")", ")", ";", "x", "|=", "1", "<<", "(", "2", "*", "pin", ")", ";", "gpio", "->", "pullup_pulldown", "=", "x", ";", "}" ]
This adds a pull-up resistor to an input pin
[ "This", "adds", "a", "pull", "-", "up", "resistor", "to", "an", "input", "pin" ]
[]
[ { "param": "gpio", "type": "GpioReg" }, { "param": "pin", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gpio", "type": "GpioReg", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pin", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8e014617244e6e90090340602cc487a5a4f348c7
chemicstry/Ventilator
software/controller/lib/hal/hal_stm32.h
[ "Apache-2.0" ]
C
GpioPullDn
void
inline void GpioPullDn(GpioReg *gpio, int pin) { uint32_t x = gpio->pullup_pulldown & ~(3 << (2 * pin)); x |= 2 << (2 * pin); gpio->pullup_pulldown = x; }
// This adds a pull-down resistor to an input pin
This adds a pull-down resistor to an input pin
[ "This", "adds", "a", "pull", "-", "down", "resistor", "to", "an", "input", "pin" ]
inline void GpioPullDn(GpioReg *gpio, int pin) { uint32_t x = gpio->pullup_pulldown & ~(3 << (2 * pin)); x |= 2 << (2 * pin); gpio->pullup_pulldown = x; }
[ "inline", "void", "GpioPullDn", "(", "GpioReg", "*", "gpio", ",", "int", "pin", ")", "{", "uint32_t", "x", "=", "gpio", "->", "pullup_pulldown", "&", "~", "(", "3", "<<", "(", "2", "*", "pin", ")", ")", ";", "x", "|=", "2", "<<", "(", "2", "*", "pin", ")", ";", "gpio", "->", "pullup_pulldown", "=", "x", ";", "}" ]
This adds a pull-down resistor to an input pin
[ "This", "adds", "a", "pull", "-", "down", "resistor", "to", "an", "input", "pin" ]
[]
[ { "param": "gpio", "type": "GpioReg" }, { "param": "pin", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gpio", "type": "GpioReg", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pin", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
onewire_flush_rmt_rx_buf
void
static void onewire_flush_rmt_rx_buf( void ) { void *p; size_t s; while ((p = xRingbufferReceive( ow_rmt.rb, &s, 0 ))) vRingbufferReturnItem( ow_rmt.rb, p ); }
// flush any pending/spurious traces from the RX channel
flush any pending/spurious traces from the RX channel
[ "flush", "any", "pending", "/", "spurious", "traces", "from", "the", "RX", "channel" ]
static void onewire_flush_rmt_rx_buf( void ) { void *p; size_t s; while ((p = xRingbufferReceive( ow_rmt.rb, &s, 0 ))) vRingbufferReturnItem( ow_rmt.rb, p ); }
[ "static", "void", "onewire_flush_rmt_rx_buf", "(", "void", ")", "{", "void", "*", "p", ";", "size_t", "s", ";", "while", "(", "(", "p", "=", "xRingbufferReceive", "(", "ow_rmt", ".", "rb", ",", "&", "s", ",", "0", ")", ")", ")", "vRingbufferReturnItem", "(", "ow_rmt", ".", "rb", ",", "p", ")", ";", "}" ]
flush any pending/spurious traces from the RX channel
[ "flush", "any", "pending", "/", "spurious", "traces", "from", "the", "RX", "channel" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
onewire_rmt_attach_pin
int
static int onewire_rmt_attach_pin( uint8_t gpio_num ) { if(!GPIO_IS_VALID_GPIO(gpio_num)) { return PLATFORM_ERR; } if (ow_rmt.tx < 0 || ow_rmt.rx < 0) return PLATFORM_ERR; if (gpio_num != ow_rmt.gpio) { // attach GPIO to previous pin if (gpio_num < 32) { GPIO.enable_w1ts = (0x1 << gpio_num); } else { GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); } if (ow_rmt.gpio >= 0) { gpio_matrix_out( ow_rmt.gpio, SIG_GPIO_OUT_IDX, 0, 0 ); } // attach RMT channels to new gpio pin // ATTENTION: set pin for rx first since gpio_output_disable() will // remove rmt output signal in matrix! rmt_set_pin( ow_rmt.rx, RMT_MODE_RX, gpio_num ); rmt_set_pin( ow_rmt.tx, RMT_MODE_TX, gpio_num ); // force pin direction to input to enable path to RX channel PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); ow_rmt.gpio = gpio_num; } return PLATFORM_OK; }
// check rmt TX&RX channel assignment and eventually attach them to the requested pin
check rmt TX&RX channel assignment and eventually attach them to the requested pin
[ "check", "rmt", "TX&RX", "channel", "assignment", "and", "eventually", "attach", "them", "to", "the", "requested", "pin" ]
static int onewire_rmt_attach_pin( uint8_t gpio_num ) { if(!GPIO_IS_VALID_GPIO(gpio_num)) { return PLATFORM_ERR; } if (ow_rmt.tx < 0 || ow_rmt.rx < 0) return PLATFORM_ERR; if (gpio_num != ow_rmt.gpio) { if (gpio_num < 32) { GPIO.enable_w1ts = (0x1 << gpio_num); } else { GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32)); } if (ow_rmt.gpio >= 0) { gpio_matrix_out( ow_rmt.gpio, SIG_GPIO_OUT_IDX, 0, 0 ); } rmt_set_pin( ow_rmt.rx, RMT_MODE_RX, gpio_num ); rmt_set_pin( ow_rmt.tx, RMT_MODE_TX, gpio_num ); PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); ow_rmt.gpio = gpio_num; } return PLATFORM_OK; }
[ "static", "int", "onewire_rmt_attach_pin", "(", "uint8_t", "gpio_num", ")", "{", "if", "(", "!", "GPIO_IS_VALID_GPIO", "(", "gpio_num", ")", ")", "{", "return", "PLATFORM_ERR", ";", "}", "if", "(", "ow_rmt", ".", "tx", "<", "0", "||", "ow_rmt", ".", "rx", "<", "0", ")", "return", "PLATFORM_ERR", ";", "if", "(", "gpio_num", "!=", "ow_rmt", ".", "gpio", ")", "{", "if", "(", "gpio_num", "<", "32", ")", "{", "GPIO", ".", "enable_w1ts", "=", "(", "0x1", "<<", "gpio_num", ")", ";", "}", "else", "{", "GPIO", ".", "enable1_w1ts", ".", "data", "=", "(", "0x1", "<<", "(", "gpio_num", "-", "32", ")", ")", ";", "}", "if", "(", "ow_rmt", ".", "gpio", ">=", "0", ")", "{", "gpio_matrix_out", "(", "ow_rmt", ".", "gpio", ",", "SIG_GPIO_OUT_IDX", ",", "0", ",", "0", ")", ";", "}", "rmt_set_pin", "(", "ow_rmt", ".", "rx", ",", "RMT_MODE_RX", ",", "gpio_num", ")", ";", "rmt_set_pin", "(", "ow_rmt", ".", "tx", ",", "RMT_MODE_TX", ",", "gpio_num", ")", ";", "PIN_INPUT_ENABLE", "(", "GPIO_PIN_MUX_REG", "[", "gpio_num", "]", ")", ";", "ow_rmt", ".", "gpio", "=", "gpio_num", ";", "}", "return", "PLATFORM_OK", ";", "}" ]
check rmt TX&RX channel assignment and eventually attach them to the requested pin
[ "check", "rmt", "TX&RX", "channel", "assignment", "and", "eventually", "attach", "them", "to", "the", "requested", "pin" ]
[ "// attach GPIO to previous pin", "// attach RMT channels to new gpio pin", "// ATTENTION: set pin for rx first since gpio_output_disable() will", "// remove rmt output signal in matrix!", "// force pin direction to input to enable path to RX channel" ]
[ { "param": "gpio_num", "type": "uint8_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "gpio_num", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
platform_onewire_reset_search
void
void platform_onewire_reset_search( platform_onewire_bus_t *bus ) { // reset the search state bus->LastDiscrepancy = 0; bus->LastDeviceFlag = FALSE; bus->LastFamilyDiscrepancy = 0; int i; for(i = 7; ; i--) { bus->ROM_NO[i] = 0; if (i == 0) break; } }
// // You need to use this function to start a search again from the beginning. // You do not need to do it for the first search, though you could. //
You need to use this function to start a search again from the beginning. You do not need to do it for the first search, though you could.
[ "You", "need", "to", "use", "this", "function", "to", "start", "a", "search", "again", "from", "the", "beginning", ".", "You", "do", "not", "need", "to", "do", "it", "for", "the", "first", "search", "though", "you", "could", "." ]
void platform_onewire_reset_search( platform_onewire_bus_t *bus ) { bus->LastDiscrepancy = 0; bus->LastDeviceFlag = FALSE; bus->LastFamilyDiscrepancy = 0; int i; for(i = 7; ; i--) { bus->ROM_NO[i] = 0; if (i == 0) break; } }
[ "void", "platform_onewire_reset_search", "(", "platform_onewire_bus_t", "*", "bus", ")", "{", "bus", "->", "LastDiscrepancy", "=", "0", ";", "bus", "->", "LastDeviceFlag", "=", "FALSE", ";", "bus", "->", "LastFamilyDiscrepancy", "=", "0", ";", "int", "i", ";", "for", "(", "i", "=", "7", ";", ";", "i", "--", ")", "{", "bus", "->", "ROM_NO", "[", "i", "]", "=", "0", ";", "if", "(", "i", "==", "0", ")", "break", ";", "}", "}" ]
You need to use this function to start a search again from the beginning.
[ "You", "need", "to", "use", "this", "function", "to", "start", "a", "search", "again", "from", "the", "beginning", "." ]
[ "// reset the search state" ]
[ { "param": "bus", "type": "platform_onewire_bus_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bus", "type": "platform_onewire_bus_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
platform_onewire_target_search
void
void platform_onewire_target_search( uint8_t family_code, platform_onewire_bus_t *bus ) { // set the search state to find SearchFamily type devices bus->ROM_NO[0] = family_code; uint8_t i; for (i = 1; i < 8; i++) bus->ROM_NO[i] = 0; bus->LastDiscrepancy = 64; bus->LastFamilyDiscrepancy = 0; bus->LastDeviceFlag = FALSE; }
// Setup the search to find the device type 'family_code' on the next call // to search(*newAddr) if it is present. //
Setup the search to find the device type 'family_code' on the next call to search(*newAddr) if it is present.
[ "Setup", "the", "search", "to", "find", "the", "device", "type", "'", "family_code", "'", "on", "the", "next", "call", "to", "search", "(", "*", "newAddr", ")", "if", "it", "is", "present", "." ]
void platform_onewire_target_search( uint8_t family_code, platform_onewire_bus_t *bus ) { bus->ROM_NO[0] = family_code; uint8_t i; for (i = 1; i < 8; i++) bus->ROM_NO[i] = 0; bus->LastDiscrepancy = 64; bus->LastFamilyDiscrepancy = 0; bus->LastDeviceFlag = FALSE; }
[ "void", "platform_onewire_target_search", "(", "uint8_t", "family_code", ",", "platform_onewire_bus_t", "*", "bus", ")", "{", "bus", "->", "ROM_NO", "[", "0", "]", "=", "family_code", ";", "uint8_t", "i", ";", "for", "(", "i", "=", "1", ";", "i", "<", "8", ";", "i", "++", ")", "bus", "->", "ROM_NO", "[", "i", "]", "=", "0", ";", "bus", "->", "LastDiscrepancy", "=", "64", ";", "bus", "->", "LastFamilyDiscrepancy", "=", "0", ";", "bus", "->", "LastDeviceFlag", "=", "FALSE", ";", "}" ]
Setup the search to find the device type 'family_code' on the next call to search(*newAddr) if it is present.
[ "Setup", "the", "search", "to", "find", "the", "device", "type", "'", "family_code", "'", "on", "the", "next", "call", "to", "search", "(", "*", "newAddr", ")", "if", "it", "is", "present", "." ]
[ "// set the search state to find SearchFamily type devices" ]
[ { "param": "family_code", "type": "uint8_t" }, { "param": "bus", "type": "platform_onewire_bus_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "family_code", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bus", "type": "platform_onewire_bus_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
platform_onewire_search
uint8_t
uint8_t platform_onewire_search( uint8_t pin, uint8_t *newAddr, platform_onewire_bus_t *bus ) { uint8_t id_bit_number; uint8_t last_zero, rom_byte_number, search_result; uint8_t id_bit, cmp_id_bit; unsigned char rom_byte_mask, search_direction; // initialize for search id_bit_number = 1; last_zero = 0; rom_byte_number = 0; rom_byte_mask = 1; search_result = 0; // if the last call was not the last one if (!bus->LastDeviceFlag) { // 1-Wire reset uint8_t presence; if (platform_onewire_reset(pin, &presence) != PLATFORM_OK || !presence) { // reset the search bus->LastDiscrepancy = 0; bus->LastDeviceFlag = FALSE; bus->LastFamilyDiscrepancy = 0; return FALSE; } // issue the search command onewire_write_bits(pin, 0xF0, 8, owDefaultPower); // loop to do the search do { // read a bit and its complement if (onewire_read_bits(pin, &id_bit, 1) != PLATFORM_OK) break; if (onewire_read_bits(pin, &cmp_id_bit, 1) != PLATFORM_OK) break; // check for no devices on 1-wire if ((id_bit == 1) && (cmp_id_bit == 1)) break; else { // all devices coupled have 0 or 1 if (id_bit != cmp_id_bit) search_direction = id_bit; // bit write value for search else { // if this discrepancy if before the Last Discrepancy // on a previous next then pick the same as last time if (id_bit_number < bus->LastDiscrepancy) search_direction = ((bus->ROM_NO[rom_byte_number] & rom_byte_mask) > 0); else // if equal to last pick 1, if not then pick 0 search_direction = (id_bit_number == bus->LastDiscrepancy); // if 0 was picked then record its position in LastZero if (search_direction == 0) { last_zero = id_bit_number; // check for Last discrepancy in family if (last_zero < 9) bus->LastFamilyDiscrepancy = last_zero; } } // set or clear the bit in the ROM byte rom_byte_number // with mask rom_byte_mask if (search_direction == 1) bus->ROM_NO[rom_byte_number] |= rom_byte_mask; else bus->ROM_NO[rom_byte_number] &= ~rom_byte_mask; // serial number search direction write bit onewire_write_bits(pin, search_direction, 1, owDefaultPower); // increment the byte counter id_bit_number // and shift the mask rom_byte_mask id_bit_number++; rom_byte_mask <<= 1; // if the mask is 0 then go to new SerialNum byte rom_byte_number and reset mask if (rom_byte_mask == 0) { rom_byte_number++; rom_byte_mask = 1; } } } while(rom_byte_number < 8); // loop until through all ROM bytes 0-7 // if the search was successful then if (!(id_bit_number < 65)) { // search successful so set LastDiscrepancy,LastDeviceFlag,search_result bus->LastDiscrepancy = last_zero; // check for last device if (bus->LastDiscrepancy == 0) bus->LastDeviceFlag = TRUE; search_result = TRUE; } } // if no device found then reset counters so next 'search' will be like a first if (!search_result || !bus->ROM_NO[0]) { bus->LastDiscrepancy = 0; bus->LastDeviceFlag = FALSE; bus->LastFamilyDiscrepancy = 0; search_result = FALSE; } else { for (rom_byte_number = 0; rom_byte_number < 8; rom_byte_number++) { newAddr[rom_byte_number] = bus->ROM_NO[rom_byte_number]; } } return search_result; }
// // Perform a search. If this function returns a '1' then it has // enumerated the next device and you may retrieve the ROM from the // OneWire::address variable. If there are no devices, no further // devices, or something horrible happens in the middle of the // enumeration then a 0 is returned. If a new device is found then // its address is copied to newAddr. Use OneWire::reset_search() to // start over. // // --- Replaced by the one from the Dallas Semiconductor web site --- //-------------------------------------------------------------------------- // Perform the 1-Wire Search Algorithm on the 1-Wire bus using the existing // search state. // Return TRUE : device found, ROM number in ROM_NO buffer // FALSE : device not found, end of search //
Perform a search. If this function returns a '1' then it has enumerated the next device and you may retrieve the ROM from the OneWire::address variable. If there are no devices, no further devices, or something horrible happens in the middle of the enumeration then a 0 is returned. If a new device is found then its address is copied to newAddr. Replaced by the one from the Dallas Semiconductor web site Perform the 1-Wire Search Algorithm on the 1-Wire bus using the existing search state. Return TRUE : device found, ROM number in ROM_NO buffer FALSE : device not found, end of search
[ "Perform", "a", "search", ".", "If", "this", "function", "returns", "a", "'", "1", "'", "then", "it", "has", "enumerated", "the", "next", "device", "and", "you", "may", "retrieve", "the", "ROM", "from", "the", "OneWire", "::", "address", "variable", ".", "If", "there", "are", "no", "devices", "no", "further", "devices", "or", "something", "horrible", "happens", "in", "the", "middle", "of", "the", "enumeration", "then", "a", "0", "is", "returned", ".", "If", "a", "new", "device", "is", "found", "then", "its", "address", "is", "copied", "to", "newAddr", ".", "Replaced", "by", "the", "one", "from", "the", "Dallas", "Semiconductor", "web", "site", "Perform", "the", "1", "-", "Wire", "Search", "Algorithm", "on", "the", "1", "-", "Wire", "bus", "using", "the", "existing", "search", "state", ".", "Return", "TRUE", ":", "device", "found", "ROM", "number", "in", "ROM_NO", "buffer", "FALSE", ":", "device", "not", "found", "end", "of", "search" ]
uint8_t platform_onewire_search( uint8_t pin, uint8_t *newAddr, platform_onewire_bus_t *bus ) { uint8_t id_bit_number; uint8_t last_zero, rom_byte_number, search_result; uint8_t id_bit, cmp_id_bit; unsigned char rom_byte_mask, search_direction; id_bit_number = 1; last_zero = 0; rom_byte_number = 0; rom_byte_mask = 1; search_result = 0; if (!bus->LastDeviceFlag) { uint8_t presence; if (platform_onewire_reset(pin, &presence) != PLATFORM_OK || !presence) { bus->LastDiscrepancy = 0; bus->LastDeviceFlag = FALSE; bus->LastFamilyDiscrepancy = 0; return FALSE; } onewire_write_bits(pin, 0xF0, 8, owDefaultPower); do { if (onewire_read_bits(pin, &id_bit, 1) != PLATFORM_OK) break; if (onewire_read_bits(pin, &cmp_id_bit, 1) != PLATFORM_OK) break; if ((id_bit == 1) && (cmp_id_bit == 1)) break; else { if (id_bit != cmp_id_bit) search_direction = id_bit; else { if (id_bit_number < bus->LastDiscrepancy) search_direction = ((bus->ROM_NO[rom_byte_number] & rom_byte_mask) > 0); else search_direction = (id_bit_number == bus->LastDiscrepancy); if (search_direction == 0) { last_zero = id_bit_number; if (last_zero < 9) bus->LastFamilyDiscrepancy = last_zero; } } if (search_direction == 1) bus->ROM_NO[rom_byte_number] |= rom_byte_mask; else bus->ROM_NO[rom_byte_number] &= ~rom_byte_mask; onewire_write_bits(pin, search_direction, 1, owDefaultPower); id_bit_number++; rom_byte_mask <<= 1; if (rom_byte_mask == 0) { rom_byte_number++; rom_byte_mask = 1; } } } while(rom_byte_number < 8); if (!(id_bit_number < 65)) { bus->LastDiscrepancy = last_zero; if (bus->LastDiscrepancy == 0) bus->LastDeviceFlag = TRUE; search_result = TRUE; } } if (!search_result || !bus->ROM_NO[0]) { bus->LastDiscrepancy = 0; bus->LastDeviceFlag = FALSE; bus->LastFamilyDiscrepancy = 0; search_result = FALSE; } else { for (rom_byte_number = 0; rom_byte_number < 8; rom_byte_number++) { newAddr[rom_byte_number] = bus->ROM_NO[rom_byte_number]; } } return search_result; }
[ "uint8_t", "platform_onewire_search", "(", "uint8_t", "pin", ",", "uint8_t", "*", "newAddr", ",", "platform_onewire_bus_t", "*", "bus", ")", "{", "uint8_t", "id_bit_number", ";", "uint8_t", "last_zero", ",", "rom_byte_number", ",", "search_result", ";", "uint8_t", "id_bit", ",", "cmp_id_bit", ";", "unsigned", "char", "rom_byte_mask", ",", "search_direction", ";", "id_bit_number", "=", "1", ";", "last_zero", "=", "0", ";", "rom_byte_number", "=", "0", ";", "rom_byte_mask", "=", "1", ";", "search_result", "=", "0", ";", "if", "(", "!", "bus", "->", "LastDeviceFlag", ")", "{", "uint8_t", "presence", ";", "if", "(", "platform_onewire_reset", "(", "pin", ",", "&", "presence", ")", "!=", "PLATFORM_OK", "||", "!", "presence", ")", "{", "bus", "->", "LastDiscrepancy", "=", "0", ";", "bus", "->", "LastDeviceFlag", "=", "FALSE", ";", "bus", "->", "LastFamilyDiscrepancy", "=", "0", ";", "return", "FALSE", ";", "}", "onewire_write_bits", "(", "pin", ",", "0xF0", ",", "8", ",", "owDefaultPower", ")", ";", "do", "{", "if", "(", "onewire_read_bits", "(", "pin", ",", "&", "id_bit", ",", "1", ")", "!=", "PLATFORM_OK", ")", "break", ";", "if", "(", "onewire_read_bits", "(", "pin", ",", "&", "cmp_id_bit", ",", "1", ")", "!=", "PLATFORM_OK", ")", "break", ";", "if", "(", "(", "id_bit", "==", "1", ")", "&&", "(", "cmp_id_bit", "==", "1", ")", ")", "break", ";", "else", "{", "if", "(", "id_bit", "!=", "cmp_id_bit", ")", "search_direction", "=", "id_bit", ";", "else", "{", "if", "(", "id_bit_number", "<", "bus", "->", "LastDiscrepancy", ")", "search_direction", "=", "(", "(", "bus", "->", "ROM_NO", "[", "rom_byte_number", "]", "&", "rom_byte_mask", ")", ">", "0", ")", ";", "else", "search_direction", "=", "(", "id_bit_number", "==", "bus", "->", "LastDiscrepancy", ")", ";", "if", "(", "search_direction", "==", "0", ")", "{", "last_zero", "=", "id_bit_number", ";", "if", "(", "last_zero", "<", "9", ")", "bus", "->", "LastFamilyDiscrepancy", "=", "last_zero", ";", "}", "}", "if", "(", "search_direction", "==", "1", ")", "bus", "->", "ROM_NO", "[", "rom_byte_number", "]", "|=", "rom_byte_mask", ";", "else", "bus", "->", "ROM_NO", "[", "rom_byte_number", "]", "&=", "~", "rom_byte_mask", ";", "onewire_write_bits", "(", "pin", ",", "search_direction", ",", "1", ",", "owDefaultPower", ")", ";", "id_bit_number", "++", ";", "rom_byte_mask", "<<=", "1", ";", "if", "(", "rom_byte_mask", "==", "0", ")", "{", "rom_byte_number", "++", ";", "rom_byte_mask", "=", "1", ";", "}", "}", "}", "while", "(", "rom_byte_number", "<", "8", ")", ";", "if", "(", "!", "(", "id_bit_number", "<", "65", ")", ")", "{", "bus", "->", "LastDiscrepancy", "=", "last_zero", ";", "if", "(", "bus", "->", "LastDiscrepancy", "==", "0", ")", "bus", "->", "LastDeviceFlag", "=", "TRUE", ";", "search_result", "=", "TRUE", ";", "}", "}", "if", "(", "!", "search_result", "||", "!", "bus", "->", "ROM_NO", "[", "0", "]", ")", "{", "bus", "->", "LastDiscrepancy", "=", "0", ";", "bus", "->", "LastDeviceFlag", "=", "FALSE", ";", "bus", "->", "LastFamilyDiscrepancy", "=", "0", ";", "search_result", "=", "FALSE", ";", "}", "else", "{", "for", "(", "rom_byte_number", "=", "0", ";", "rom_byte_number", "<", "8", ";", "rom_byte_number", "++", ")", "{", "newAddr", "[", "rom_byte_number", "]", "=", "bus", "->", "ROM_NO", "[", "rom_byte_number", "]", ";", "}", "}", "return", "search_result", ";", "}" ]
Perform a search.
[ "Perform", "a", "search", "." ]
[ "// initialize for search", "// if the last call was not the last one", "// 1-Wire reset", "// reset the search", "// issue the search command", "// loop to do the search", "// read a bit and its complement", "// check for no devices on 1-wire", "// all devices coupled have 0 or 1", "// bit write value for search", "// if this discrepancy if before the Last Discrepancy", "// on a previous next then pick the same as last time", "// if equal to last pick 1, if not then pick 0", "// if 0 was picked then record its position in LastZero", "// check for Last discrepancy in family", "// set or clear the bit in the ROM byte rom_byte_number", "// with mask rom_byte_mask", "// serial number search direction write bit", "// increment the byte counter id_bit_number", "// and shift the mask rom_byte_mask", "// if the mask is 0 then go to new SerialNum byte rom_byte_number and reset mask", "// loop until through all ROM bytes 0-7", "// if the search was successful then", "// search successful so set LastDiscrepancy,LastDeviceFlag,search_result", "// check for last device", "// if no device found then reset counters so next 'search' will be like a first" ]
[ { "param": "pin", "type": "uint8_t" }, { "param": "newAddr", "type": "uint8_t" }, { "param": "bus", "type": "platform_onewire_bus_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pin", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "newAddr", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bus", "type": "platform_onewire_bus_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
platform_onewire_crc8
uint8_t
uint8_t platform_onewire_crc8( const uint8_t *addr, uint8_t len ) { uint8_t crc = 0; while (len--) { crc = pgm_read_byte(dscrc_table + (crc ^ *addr++)); } return crc; }
// // Compute a Dallas Semiconductor 8 bit CRC. These show up in the ROM // and the registers. (note: this might better be done without to // table, it would probably be smaller and certainly fast enough // compared to all those delayMicrosecond() calls. But I got // confused, so I use this table from the examples.) //
Compute a Dallas Semiconductor 8 bit CRC. These show up in the ROM and the registers. (note: this might better be done without to table, it would probably be smaller and certainly fast enough compared to all those delayMicrosecond() calls. But I got confused, so I use this table from the examples.)
[ "Compute", "a", "Dallas", "Semiconductor", "8", "bit", "CRC", ".", "These", "show", "up", "in", "the", "ROM", "and", "the", "registers", ".", "(", "note", ":", "this", "might", "better", "be", "done", "without", "to", "table", "it", "would", "probably", "be", "smaller", "and", "certainly", "fast", "enough", "compared", "to", "all", "those", "delayMicrosecond", "()", "calls", ".", "But", "I", "got", "confused", "so", "I", "use", "this", "table", "from", "the", "examples", ".", ")" ]
uint8_t platform_onewire_crc8( const uint8_t *addr, uint8_t len ) { uint8_t crc = 0; while (len--) { crc = pgm_read_byte(dscrc_table + (crc ^ *addr++)); } return crc; }
[ "uint8_t", "platform_onewire_crc8", "(", "const", "uint8_t", "*", "addr", ",", "uint8_t", "len", ")", "{", "uint8_t", "crc", "=", "0", ";", "while", "(", "len", "--", ")", "{", "crc", "=", "pgm_read_byte", "(", "dscrc_table", "+", "(", "crc", "^", "*", "addr", "++", ")", ")", ";", "}", "return", "crc", ";", "}" ]
Compute a Dallas Semiconductor 8 bit CRC.
[ "Compute", "a", "Dallas", "Semiconductor", "8", "bit", "CRC", "." ]
[]
[ { "param": "addr", "type": "uint8_t" }, { "param": "len", "type": "uint8_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "addr", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "len", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
platform_onewire_crc8
uint8_t
uint8_t platform_onewire_crc8( const uint8_t *addr, uint8_t len ) { uint8_t crc = 0; while (len--) { uint8_t inbyte = *addr++; uint8_t i; for (i = 8; i; i--) { uint8_t mix = (crc ^ inbyte) & 0x01; crc >>= 1; if (mix) crc ^= 0x8C; inbyte >>= 1; } } return crc; }
// // Compute a Dallas Semiconductor 8 bit CRC directly. // this is much slower, but much smaller, than the lookup table. //
Compute a Dallas Semiconductor 8 bit CRC directly. this is much slower, but much smaller, than the lookup table.
[ "Compute", "a", "Dallas", "Semiconductor", "8", "bit", "CRC", "directly", ".", "this", "is", "much", "slower", "but", "much", "smaller", "than", "the", "lookup", "table", "." ]
uint8_t platform_onewire_crc8( const uint8_t *addr, uint8_t len ) { uint8_t crc = 0; while (len--) { uint8_t inbyte = *addr++; uint8_t i; for (i = 8; i; i--) { uint8_t mix = (crc ^ inbyte) & 0x01; crc >>= 1; if (mix) crc ^= 0x8C; inbyte >>= 1; } } return crc; }
[ "uint8_t", "platform_onewire_crc8", "(", "const", "uint8_t", "*", "addr", ",", "uint8_t", "len", ")", "{", "uint8_t", "crc", "=", "0", ";", "while", "(", "len", "--", ")", "{", "uint8_t", "inbyte", "=", "*", "addr", "++", ";", "uint8_t", "i", ";", "for", "(", "i", "=", "8", ";", "i", ";", "i", "--", ")", "{", "uint8_t", "mix", "=", "(", "crc", "^", "inbyte", ")", "&", "0x01", ";", "crc", ">>=", "1", ";", "if", "(", "mix", ")", "crc", "^=", "0x8C", ";", "inbyte", ">>=", "1", ";", "}", "}", "return", "crc", ";", "}" ]
Compute a Dallas Semiconductor 8 bit CRC directly.
[ "Compute", "a", "Dallas", "Semiconductor", "8", "bit", "CRC", "directly", "." ]
[]
[ { "param": "addr", "type": "uint8_t" }, { "param": "len", "type": "uint8_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "addr", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "len", "type": "uint8_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
platform_onewire_check_crc16
bool
bool platform_onewire_check_crc16( const uint8_t* input, uint16_t len, const uint8_t* inverted_crc, uint16_t crc ) { crc = ~platform_onewire_crc16(input, len, crc); return (crc & 0xFF) == inverted_crc[0] && (crc >> 8) == inverted_crc[1]; }
// Compute the 1-Wire CRC16 and compare it against the received CRC. // Example usage (reading a DS2408): // // Put everything in a buffer so we can compute the CRC easily. // uint8_t buf[13]; // buf[0] = 0xF0; // Read PIO Registers // buf[1] = 0x88; // LSB address // buf[2] = 0x00; // MSB address // WriteBytes(net, buf, 3); // Write 3 cmd bytes // ReadBytes(net, buf+3, 10); // Read 6 data bytes, 2 0xFF, 2 CRC16 // if (!CheckCRC16(buf, 11, &buf[11])) { // // Handle error. // } // // @param input - Array of bytes to checksum. // @param len - How many bytes to use. // @param inverted_crc - The two CRC16 bytes in the received data. // This should just point into the received data, // *not* at a 16-bit integer. // @param crc - The crc starting value (optional) // @return True, iff the CRC matches.
Compute the 1-Wire CRC16 and compare it against the received CRC. Example usage (reading a DS2408): Put everything in a buffer so we can compute the CRC easily.
[ "Compute", "the", "1", "-", "Wire", "CRC16", "and", "compare", "it", "against", "the", "received", "CRC", ".", "Example", "usage", "(", "reading", "a", "DS2408", ")", ":", "Put", "everything", "in", "a", "buffer", "so", "we", "can", "compute", "the", "CRC", "easily", "." ]
bool platform_onewire_check_crc16( const uint8_t* input, uint16_t len, const uint8_t* inverted_crc, uint16_t crc ) { crc = ~platform_onewire_crc16(input, len, crc); return (crc & 0xFF) == inverted_crc[0] && (crc >> 8) == inverted_crc[1]; }
[ "bool", "platform_onewire_check_crc16", "(", "const", "uint8_t", "*", "input", ",", "uint16_t", "len", ",", "const", "uint8_t", "*", "inverted_crc", ",", "uint16_t", "crc", ")", "{", "crc", "=", "~", "platform_onewire_crc16", "(", "input", ",", "len", ",", "crc", ")", ";", "return", "(", "crc", "&", "0xFF", ")", "==", "inverted_crc", "[", "0", "]", "&&", "(", "crc", ">>", "8", ")", "==", "inverted_crc", "[", "1", "]", ";", "}" ]
Compute the 1-Wire CRC16 and compare it against the received CRC.
[ "Compute", "the", "1", "-", "Wire", "CRC16", "and", "compare", "it", "against", "the", "received", "CRC", "." ]
[]
[ { "param": "input", "type": "uint8_t" }, { "param": "len", "type": "uint16_t" }, { "param": "inverted_crc", "type": "uint8_t" }, { "param": "crc", "type": "uint16_t" } ]
{ "returns": [ { "docstring": "True, iff the CRC matches.", "docstring_tokens": [ "True", "iff", "the", "CRC", "matches", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "input", "type": "uint8_t", "docstring": "Array of bytes to checksum.", "docstring_tokens": [ "Array", "of", "bytes", "to", "checksum", "." ], "default": null, "is_optional": null }, { "identifier": "len", "type": "uint16_t", "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null }, { "identifier": "inverted_crc", "type": "uint8_t", "docstring": "The two CRC16 bytes in the received data.\nThis should just point into the received data,\nnot* at a 16-bit integer.", "docstring_tokens": [ "The", "two", "CRC16", "bytes", "in", "the", "received", "data", ".", "This", "should", "just", "point", "into", "the", "received", "data", "not", "*", "at", "a", "16", "-", "bit", "integer", "." ], "default": null, "is_optional": null }, { "identifier": "crc", "type": "uint16_t", "docstring": "The crc starting value (optional)", "docstring_tokens": [ "The", "crc", "starting", "value", "(", "optional", ")" ], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
33280cb174d01e094221441e9a6485e67f861f62
sentinela-online/nodemcu-firmware
components/platform/onewire.c
[ "MIT" ]
C
platform_onewire_crc16
uint16_t
uint16_t platform_onewire_crc16( const uint8_t* input, uint16_t len, uint16_t crc ) { static const uint8_t oddparity[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; uint16_t i; for (i = 0 ; i < len ; i++) { // Even though we're just copying a byte from the input, // we'll be doing 16-bit computation with it. uint16_t cdata = input[i]; cdata = (cdata ^ crc) & 0xff; crc >>= 8; if (oddparity[cdata & 0x0F] ^ oddparity[cdata >> 4]) crc ^= 0xC001; cdata <<= 6; crc ^= cdata; cdata <<= 1; crc ^= cdata; } return crc; }
// Compute a Dallas Semiconductor 16 bit CRC. This is required to check // the integrity of data received from many 1-Wire devices. Note that the // CRC computed here is *not* what you'll get from the 1-Wire network, // for two reasons: // 1) The CRC is transmitted bitwise inverted. // 2) Depending on the endian-ness of your processor, the binary // representation of the two-byte return value may have a different // byte order than the two bytes you get from 1-Wire. // @param input - Array of bytes to checksum. // @param len - How many bytes to use. // @param crc - The crc starting value (optional) // @return The CRC16, as defined by Dallas Semiconductor.
Compute a Dallas Semiconductor 16 bit CRC. This is required to check the integrity of data received from many 1-Wire devices. Note that the CRC computed here is *not* what you'll get from the 1-Wire network, for two reasons: 1) The CRC is transmitted bitwise inverted. 2) Depending on the endian-ness of your processor, the binary representation of the two-byte return value may have a different byte order than the two bytes you get from 1-Wire.
[ "Compute", "a", "Dallas", "Semiconductor", "16", "bit", "CRC", ".", "This", "is", "required", "to", "check", "the", "integrity", "of", "data", "received", "from", "many", "1", "-", "Wire", "devices", ".", "Note", "that", "the", "CRC", "computed", "here", "is", "*", "not", "*", "what", "you", "'", "ll", "get", "from", "the", "1", "-", "Wire", "network", "for", "two", "reasons", ":", "1", ")", "The", "CRC", "is", "transmitted", "bitwise", "inverted", ".", "2", ")", "Depending", "on", "the", "endian", "-", "ness", "of", "your", "processor", "the", "binary", "representation", "of", "the", "two", "-", "byte", "return", "value", "may", "have", "a", "different", "byte", "order", "than", "the", "two", "bytes", "you", "get", "from", "1", "-", "Wire", "." ]
uint16_t platform_onewire_crc16( const uint8_t* input, uint16_t len, uint16_t crc ) { static const uint8_t oddparity[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; uint16_t i; for (i = 0 ; i < len ; i++) { uint16_t cdata = input[i]; cdata = (cdata ^ crc) & 0xff; crc >>= 8; if (oddparity[cdata & 0x0F] ^ oddparity[cdata >> 4]) crc ^= 0xC001; cdata <<= 6; crc ^= cdata; cdata <<= 1; crc ^= cdata; } return crc; }
[ "uint16_t", "platform_onewire_crc16", "(", "const", "uint8_t", "*", "input", ",", "uint16_t", "len", ",", "uint16_t", "crc", ")", "{", "static", "const", "uint8_t", "oddparity", "[", "16", "]", "=", "{", "0", ",", "1", ",", "1", ",", "0", ",", "1", ",", "0", ",", "0", ",", "1", ",", "1", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "1", ",", "0", "}", ";", "uint16_t", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "uint16_t", "cdata", "=", "input", "[", "i", "]", ";", "cdata", "=", "(", "cdata", "^", "crc", ")", "&", "0xff", ";", "crc", ">>=", "8", ";", "if", "(", "oddparity", "[", "cdata", "&", "0x0F", "]", "^", "oddparity", "[", "cdata", ">>", "4", "]", ")", "crc", "^=", "0xC001", ";", "cdata", "<<=", "6", ";", "crc", "^=", "cdata", ";", "cdata", "<<=", "1", ";", "crc", "^=", "cdata", ";", "}", "return", "crc", ";", "}" ]
Compute a Dallas Semiconductor 16 bit CRC.
[ "Compute", "a", "Dallas", "Semiconductor", "16", "bit", "CRC", "." ]
[ "// Even though we're just copying a byte from the input,", "// we'll be doing 16-bit computation with it." ]
[ { "param": "input", "type": "uint8_t" }, { "param": "len", "type": "uint16_t" }, { "param": "crc", "type": "uint16_t" } ]
{ "returns": [ { "docstring": "The CRC16, as defined by Dallas Semiconductor.", "docstring_tokens": [ "The", "CRC16", "as", "defined", "by", "Dallas", "Semiconductor", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "input", "type": "uint8_t", "docstring": "Array of bytes to checksum.", "docstring_tokens": [ "Array", "of", "bytes", "to", "checksum", "." ], "default": null, "is_optional": null }, { "identifier": "len", "type": "uint16_t", "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null }, { "identifier": "crc", "type": "uint16_t", "docstring": "The crc starting value (optional)", "docstring_tokens": [ "The", "crc", "starting", "value", "(", "optional", ")" ], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
310d0dd465d1871624b075c575c24867293e900b
sentinela-online/nodemcu-firmware
components/modules/http.c
[ "MIT" ]
C
http_event_cb
esp_err_t
static esp_err_t http_event_cb(esp_http_client_event_t *evt) { // ESP_LOGI(TAG, "http_event_cb %d", evt->event_id); lhttp_context_t *context = (lhttp_context_t *)evt->user_data; switch (evt->event_id) { case HTTP_EVENT_ON_CONNECTED: { context_setflag(context, Connected); return make_callback(context, HTTP_EVENT_ON_CONNECTED, NULL, 0); } case HTTP_EVENT_ON_HEADER: { size_t keylen = strlen(evt->header_key); size_t vallen = strlen(evt->header_value); list_item *hdr = (list_item *)malloc(sizeof(list_item) + keylen + vallen + 1); // +1 for final null if (!hdr) { return ESP_ERR_NO_MEM; } hdr->next = context->headers; context->headers = hdr; hdr->len = keylen; memcpy(hdr->data, evt->header_key, keylen + 1); memcpy(hdr->data + keylen + 1, evt->header_value, vallen + 1); break; } case HTTP_EVENT_ON_DATA: { if (context->headers) { context->status_code = esp_http_client_get_status_code(evt->client); int err = make_callback(context, HTTP_EVENT_ON_HEADER, NULL, 0); if (err) return err; } return make_callback(context, evt->event_id, evt->data, evt->data_len); } case HTTP_EVENT_ON_FINISH: { if (context->headers) { // Might still be set, if there wasn't any data in the request context->status_code = esp_http_client_get_status_code(evt->client); int err = make_callback(context, HTTP_EVENT_ON_HEADER, NULL, 0); if (err) return err; } // Given when HTTP_EVENT_ON_FINISH is dispatched (before the // http_should_keep_alive check in esp_http_client_perform) I don't think // there's any benefit to exposing this event // int ret = make_callback(context, HTTP_EVENT_ON_FINISH, NULL, 0); break; } case HTTP_EVENT_DISCONNECTED: context_clearflag(context, Connected); break; default: break; } return ESP_OK; }
// note: this function is called both in synchronous mode and in asynchronous mode
this function is called both in synchronous mode and in asynchronous mode
[ "this", "function", "is", "called", "both", "in", "synchronous", "mode", "and", "in", "asynchronous", "mode" ]
static esp_err_t http_event_cb(esp_http_client_event_t *evt) { lhttp_context_t *context = (lhttp_context_t *)evt->user_data; switch (evt->event_id) { case HTTP_EVENT_ON_CONNECTED: { context_setflag(context, Connected); return make_callback(context, HTTP_EVENT_ON_CONNECTED, NULL, 0); } case HTTP_EVENT_ON_HEADER: { size_t keylen = strlen(evt->header_key); size_t vallen = strlen(evt->header_value); list_item *hdr = (list_item *)malloc(sizeof(list_item) + keylen + vallen + 1); if (!hdr) { return ESP_ERR_NO_MEM; } hdr->next = context->headers; context->headers = hdr; hdr->len = keylen; memcpy(hdr->data, evt->header_key, keylen + 1); memcpy(hdr->data + keylen + 1, evt->header_value, vallen + 1); break; } case HTTP_EVENT_ON_DATA: { if (context->headers) { context->status_code = esp_http_client_get_status_code(evt->client); int err = make_callback(context, HTTP_EVENT_ON_HEADER, NULL, 0); if (err) return err; } return make_callback(context, evt->event_id, evt->data, evt->data_len); } case HTTP_EVENT_ON_FINISH: { if (context->headers) { context->status_code = esp_http_client_get_status_code(evt->client); int err = make_callback(context, HTTP_EVENT_ON_HEADER, NULL, 0); if (err) return err; } break; } case HTTP_EVENT_DISCONNECTED: context_clearflag(context, Connected); break; default: break; } return ESP_OK; }
[ "static", "esp_err_t", "http_event_cb", "(", "esp_http_client_event_t", "*", "evt", ")", "{", "lhttp_context_t", "*", "context", "=", "(", "lhttp_context_t", "*", ")", "evt", "->", "user_data", ";", "switch", "(", "evt", "->", "event_id", ")", "{", "case", "HTTP_EVENT_ON_CONNECTED", ":", "{", "context_setflag", "(", "context", ",", "Connected", ")", ";", "return", "make_callback", "(", "context", ",", "HTTP_EVENT_ON_CONNECTED", ",", "NULL", ",", "0", ")", ";", "}", "case", "HTTP_EVENT_ON_HEADER", ":", "{", "size_t", "keylen", "=", "strlen", "(", "evt", "->", "header_key", ")", ";", "size_t", "vallen", "=", "strlen", "(", "evt", "->", "header_value", ")", ";", "list_item", "*", "hdr", "=", "(", "list_item", "*", ")", "malloc", "(", "sizeof", "(", "list_item", ")", "+", "keylen", "+", "vallen", "+", "1", ")", ";", "if", "(", "!", "hdr", ")", "{", "return", "ESP_ERR_NO_MEM", ";", "}", "hdr", "->", "next", "=", "context", "->", "headers", ";", "context", "->", "headers", "=", "hdr", ";", "hdr", "->", "len", "=", "keylen", ";", "memcpy", "(", "hdr", "->", "data", ",", "evt", "->", "header_key", ",", "keylen", "+", "1", ")", ";", "memcpy", "(", "hdr", "->", "data", "+", "keylen", "+", "1", ",", "evt", "->", "header_value", ",", "vallen", "+", "1", ")", ";", "break", ";", "}", "case", "HTTP_EVENT_ON_DATA", ":", "{", "if", "(", "context", "->", "headers", ")", "{", "context", "->", "status_code", "=", "esp_http_client_get_status_code", "(", "evt", "->", "client", ")", ";", "int", "err", "=", "make_callback", "(", "context", ",", "HTTP_EVENT_ON_HEADER", ",", "NULL", ",", "0", ")", ";", "if", "(", "err", ")", "return", "err", ";", "}", "return", "make_callback", "(", "context", ",", "evt", "->", "event_id", ",", "evt", "->", "data", ",", "evt", "->", "data_len", ")", ";", "}", "case", "HTTP_EVENT_ON_FINISH", ":", "{", "if", "(", "context", "->", "headers", ")", "{", "context", "->", "status_code", "=", "esp_http_client_get_status_code", "(", "evt", "->", "client", ")", ";", "int", "err", "=", "make_callback", "(", "context", ",", "HTTP_EVENT_ON_HEADER", ",", "NULL", ",", "0", ")", ";", "if", "(", "err", ")", "return", "err", ";", "}", "break", ";", "}", "case", "HTTP_EVENT_DISCONNECTED", ":", "context_clearflag", "(", "context", ",", "Connected", ")", ";", "break", ";", "default", ":", "break", ";", "}", "return", "ESP_OK", ";", "}" ]
note: this function is called both in synchronous mode and in asynchronous mode
[ "note", ":", "this", "function", "is", "called", "both", "in", "synchronous", "mode", "and", "in", "asynchronous", "mode" ]
[ "// ESP_LOGI(TAG, \"http_event_cb %d\", evt->event_id);", "// +1 for final null", "// Might still be set, if there wasn't any data in the request", "// Given when HTTP_EVENT_ON_FINISH is dispatched (before the", "// http_should_keep_alive check in esp_http_client_perform) I don't think", "// there's any benefit to exposing this event", "// int ret = make_callback(context, HTTP_EVENT_ON_FINISH, NULL, 0);" ]
[ { "param": "evt", "type": "esp_http_client_event_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "evt", "type": "esp_http_client_event_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
310d0dd465d1871624b075c575c24867293e900b
sentinela-online/nodemcu-firmware
components/modules/http.c
[ "MIT" ]
C
lhttp_event_task
void
static void lhttp_event_task(task_param_t param, task_prio_t prio) { esp_http_client_event_t *evt = (esp_http_client_event_t *)param; lhttp_context_t *context = (lhttp_context_t *)evt->user_data; context_setflag(context, AckPending); int result = http_event_cb(evt); if (context->perform_rtos_task && result != DELAY_ACK) { context_clearflag(context, AckPending); xTaskNotifyGive(context->perform_rtos_task); } }
// Task posted from http thread when there's an event
Task posted from http thread when there's an event
[ "Task", "posted", "from", "http", "thread", "when", "there", "'", "s", "an", "event" ]
static void lhttp_event_task(task_param_t param, task_prio_t prio) { esp_http_client_event_t *evt = (esp_http_client_event_t *)param; lhttp_context_t *context = (lhttp_context_t *)evt->user_data; context_setflag(context, AckPending); int result = http_event_cb(evt); if (context->perform_rtos_task && result != DELAY_ACK) { context_clearflag(context, AckPending); xTaskNotifyGive(context->perform_rtos_task); } }
[ "static", "void", "lhttp_event_task", "(", "task_param_t", "param", ",", "task_prio_t", "prio", ")", "{", "esp_http_client_event_t", "*", "evt", "=", "(", "esp_http_client_event_t", "*", ")", "param", ";", "lhttp_context_t", "*", "context", "=", "(", "lhttp_context_t", "*", ")", "evt", "->", "user_data", ";", "context_setflag", "(", "context", ",", "AckPending", ")", ";", "int", "result", "=", "http_event_cb", "(", "evt", ")", ";", "if", "(", "context", "->", "perform_rtos_task", "&&", "result", "!=", "DELAY_ACK", ")", "{", "context_clearflag", "(", "context", ",", "AckPending", ")", ";", "xTaskNotifyGive", "(", "context", "->", "perform_rtos_task", ")", ";", "}", "}" ]
Task posted from http thread when there's an event
[ "Task", "posted", "from", "http", "thread", "when", "there", "'", "s", "an", "event" ]
[]
[ { "param": "param", "type": "task_param_t" }, { "param": "prio", "type": "task_prio_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "param", "type": "task_param_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "prio", "type": "task_prio_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }