AdjoinableMPI
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
window.c
Go to the documentation of this file.
1 /*
2 ##########################################################
3 # This file is part of the AdjoinableMPI library #
4 # released under the MIT License. #
5 # The full COPYRIGHT notice can be found in the top #
6 # level directory of the AdjoinableMPI distribution. #
7 ##########################################################
8 */
9 #include <stdlib.h>
10 #include <assert.h>
11 #include <string.h>
12 #include <stdio.h>
13 #include <mpi.h>
16 #include "ampi/adTool/support.h"
17 
18 
20  if(AMPI_WIN_STACK_full(s))
22  s->v[s->top] = val;
23  s->num_reqs=s->num_reqs+1;
24  (s->top)=(s->top)+1;
25 }
26 
28  /* We do not shrink the stack. We rather keep the maximum allocation */
29  /*if(empty(s))*/
30  /*shrink(s);*/
31  (s->top)=(s->top)-1;
32  s->num_reqs=s->num_reqs-1;
33  return (s->v[s->top]);
34 }
35 
37  s->top=0;
38  s->v = malloc(sizeof(AMPI_WinRequest)*AMPI_WINDOW_STACK_CHUNK_SIZE);
40  s->num_reqs=0;
41 }
42 
44  s->top=0;
45  free(s->v);
47 }
48 
50  return (s->top >= s->size);
51 }
52 
54  AMPI_WinRequest *tmp;
56  tmp=realloc(s->v,s->size*sizeof(AMPI_WinRequest));
57  if(tmp != NULL) {
58  s->v = tmp;
59  }
60 }
61 
63  AMPI_WinRequest *tmp;
65  tmp=realloc(s->v,s->size*sizeof(AMPI_WinRequest));
66  if(tmp != NULL) {
67  s->v = tmp;
68  }
69 }
70 
72  return (s->top <= s->size-AMPI_WINDOW_STACK_CHUNK_SIZE);
73 }
74 
76  /*
77  int size=win.req_stack->num_reqs;
78  int i=0;
79  */
80  /*printf("num_reqs: %d\n", size);*/
81  /*for(i=0;i<size;i=i+1) {*/
82  /*}*/
83 
84 }