AdjoinableMPI
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
support.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 <stdio.h>
11 #include <string.h>
12 #include <assert.h>
13 #include "ampi/adTool/support.h"
14 
16 
19  void *buf ;
20  void *adjointBuf ;
21  int count ;
22  MPI_Datatype datatype ;
23  int endPoint ;
24  int tag ;
26  MPI_Comm comm;
29 } ;
30 
31 int AMPI_Init_NT(int* argc, char*** argv) {
32  int rc = MPI_Init(argc, argv);
34  rc = MPI_Comm_dup(MPI_COMM_WORLD, &ADTOOL_AMPI_COMM_WORLD_SHADOW) ;
94 #ifdef AMPI_FORTRANCOMPATIBLE
95  ourADTOOL_AMPI_FPCollection.fortransetuptypes__fp=&adtool_ampi_fortransetuptypes_;
96  ourADTOOL_AMPI_FPCollection.fortrancleanuptypes__fp=&adtool_ampi_fortrancleanuptypes_;
97 #endif
98  return rc ;
99 }
100 
103  int count,
104  MPI_Datatype datatype,
105  int root,
106  MPI_Comm comm) {
107 }
108 
110  int* count,
111  MPI_Datatype* datatype,
112  int* root,
113  MPI_Comm* comm,
114  void **idx) {
115 }
116 
118  int count) {
119 }
120 
122  int* count) {
123 }
124 
126  void* rbuf,
127  void* resultData,
128  int pushResultData, /* push resultData if true */
129  int count,
130  MPI_Datatype datatype,
131  MPI_Op op,
132  int root,
133  MPI_Comm comm) {
134 }
135 
137  MPI_Datatype* datatype) {
138 }
139 
140 void ADTOOL_AMPI_popReduceInfo(void** sbuf,
141  void** rbuf,
142  void** prevData,
143  void** resultData,
144  int* count,
145  MPI_Op* op,
146  int* root,
147  MPI_Comm* comm,
148  void **idx) {
149 }
150 
152  int count,
153  MPI_Datatype datatype,
154  int src,
155  int tag,
157  MPI_Comm comm) {
158 }
159 
161  int* count,
162  MPI_Datatype* datatype,
163  int* src,
164  int* tag,
166  MPI_Comm* comm,
167  void **idx) {
168 }
169 
170 void ADTOOL_AMPI_pushGSinfo(int commSizeForRootOrNull,
171  void *rbuf,
172  int rcnt,
173  MPI_Datatype rtype,
174  void *buf,
175  int count,
176  MPI_Datatype type,
177  int root,
178  MPI_Comm comm) {
179 }
180 
181 void ADTOOL_AMPI_popGScommSizeForRootOrNull(int *commSizeForRootOrNull) {
182 }
183 
184 void ADTOOL_AMPI_popGSinfo(int commSizeForRootOrNull,
185  void **rbuf,
186  int *rcnt,
187  MPI_Datatype *rtype,
188  void **buf,
189  int *count,
190  MPI_Datatype *type,
191  int *root,
192  MPI_Comm *comm) {
193 }
194 
195 void ADTOOL_AMPI_pushGSVinfo(int commSizeForRootOrNull,
196  void *rbuf,
197  int *rcnts,
198  int *displs,
199  MPI_Datatype rtype,
200  void *buf,
201  int count,
202  MPI_Datatype type,
203  int root,
204  MPI_Comm comm) {
205 }
206 
207 void ADTOOL_AMPI_popGSVinfo(int commSizeForRootOrNull,
208  void **rbuf,
209  int *rcnts,
210  int *displs,
211  MPI_Datatype *rtype,
212  void **buf,
213  int *count,
214  MPI_Datatype *type,
215  int *root,
216  MPI_Comm *comm) {
217 }
218 
220 }
221 
223 }
224 
225 void ADTOOL_AMPI_push_AMPI_Request(struct AMPI_Request_S *ampiRequest) {
226  struct AMPI_Request_stack* newTop =
227  (struct AMPI_Request_stack*)malloc(sizeof(struct AMPI_Request_stack)) ;
228  newTop->next_p = requestStackTop ;
229  newTop->buf = ampiRequest->buf ;
230  newTop->adjointBuf = ampiRequest->adjointBuf ;
231  newTop->count = ampiRequest->count ;
232  newTop->datatype = ampiRequest->datatype ;
233  newTop->endPoint = ampiRequest->endPoint ;
234  newTop->tag = ampiRequest->tag ;
235  newTop->pairedWith = ampiRequest->pairedWith ;
236  newTop->comm = ampiRequest->comm ;
237  newTop->origin = ampiRequest->origin ;
238  requestStackTop = newTop ;
239 }
240 
241 void ADTOOL_AMPI_pop_AMPI_Request(struct AMPI_Request_S *ampiRequest) {
242  struct AMPI_Request_stack* oldTop = requestStackTop ;
243  ampiRequest->buf = oldTop->buf ;
244  ampiRequest->adjointBuf = oldTop->adjointBuf ;
245  ampiRequest->count = oldTop->count ;
246  ampiRequest->datatype = oldTop->datatype ;
247  ampiRequest->endPoint = oldTop->endPoint ;
248  ampiRequest->tag = oldTop->tag ;
249  ampiRequest->pairedWith = oldTop->pairedWith ;
250  ampiRequest->comm = oldTop->comm ;
251  ampiRequest->origin = oldTop->origin ;
252  requestStackTop = oldTop->next_p ;
253  free(oldTop) ;
254 }
255 
256 void ADTOOL_AMPI_push_request(MPI_Request request) {
257 }
258 
259 MPI_Request ADTOOL_AMPI_pop_request() {
260  return 0;
261 }
262 
264 }
265 
267 }
268 
269 void ADTOOL_AMPI_push_comm(MPI_Comm comm) {
270 }
271 
273  return 0;
274 }
275 
278 MPI_Comm ADTOOL_AMPI_getShadowComm(MPI_Comm comm) {
279  /* ----> Of course this must change if comm!=MPI_COMM_WORLD !! */
281 }
282 
286 void* ADTOOL_AMPI_rawData(void* activeData, int *size) {
287  return activeData ;
288 }
289 
293 void* ADTOOL_AMPI_rawDataV(void* activeData, int commSize, int *counts, int* displs) {
294  return activeData;
295 }
296 
300 void * ADTOOL_AMPI_packDType(void* indata, void* outdata, int count, int idx) {
301  return indata;
302 }
303 
307 void * ADTOOL_AMPI_unpackDType(void* indata, void* outdata, int count, int idx) {
308  return indata;
309 }
310 
314 void* ADTOOL_AMPI_rawAdjointData(void* activeData) {
315  return activeData ;
316 }
317 
321  void* buf) {
322  ampiRequest->buf = buf ;
323 }
324 
328 void ADTOOL_AMPI_Turn(void* buf, void* adjointBuf) {
329  struct AMPI_Request_stack* inStack = requestStackTop ;
330  while (inStack!=NULL) {
331  if (inStack->buf==buf) {
332  inStack->adjointBuf = adjointBuf ;
333  }
334  inStack = inStack->next_p ;
335  }
336 }
337 
338 /*[llh] not used ? redundant with mapBufForAdjoint? */
340  void* buf) {
341  /* an overloading tool would not do this but rather leave the buffer as traced
342  because the memory mapping happens already at FW time */
343  ampiRequest->buf=buf;
344 }
345 
347  MPI_Datatype datatype) {
348  /* for now we keep the count as is but for example in vector mode one would have to multiply by vector length */
349 }
350 
351 void ADTOOL_AMPI_setAdjointCount(struct AMPI_Request_S *ampiRequest) {
352  ampiRequest->adjointCount=ampiRequest->count;
353  ADTOOL_AMPI_getAdjointCount(&(ampiRequest->adjointCount),ampiRequest->datatype);
354 }
355 
357  ADTOOL_AMPI_setAdjointCount(ampiRequest);
358  ampiRequest->adjointTempBuf =
360  ampiRequest->datatype,
361  ampiRequest->comm) ;
362  assert(ampiRequest->adjointTempBuf);
363 }
364 
365 void* ADTOOL_AMPI_allocateTempBuf(int adjointCount, MPI_Datatype datatype, MPI_Comm comm) {
366  size_t s=0;
367  int dt_idx = derivedTypeIdx(datatype);
368  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION)
369  s=sizeof(double);
370  else if (datatype==MPI_FLOAT)
371  s=sizeof(float);
372  else if (isDerivedType(dt_idx))
373  s = getDTypeData()->p_extents[dt_idx];
374  else
375  MPI_Abort(comm, MPI_ERR_TYPE);
376  return (void*)malloc(adjointCount*s);
377 }
378 
379 void ADTOOL_AMPI_releaseAdjointTempBuf(void *tempBuf) {
380  free(tempBuf) ;
381 }
382 
384  MPI_Datatype datatype,
385  MPI_Comm comm) {
386 /* void* ptr = NULL; */
387 /* if (datatype==MPI_DOUBLE) */
388 /* ptr = malloc(count*sizeof(MPI_DOUBLE)); */
389 /* else if (datatype==MPI_FLOAT) */
390 /* ptr = malloc(count*sizeof(MPI_FLOAT)); */
391  MPI_Aint lb,extent ;
392  int rc = MPI_Type_get_extent(datatype, &lb, &extent) ;
393  assert(rc==MPI_SUCCESS);
394  void* ptr = NULL ;
395  ptr = malloc(count*extent) ;
396  assert(ptr);
397  return ptr;
398 }
399 
401  int count,
402  MPI_Datatype datatype) {
403  free(buf);
404 }
405 
406 void *ADTOOL_AMPI_copyActiveBuf(void* source,
407  void* target,
408  int count,
409  MPI_Datatype datatype,
410  MPI_Comm comm) {
411  MPI_Aint lb,extent ;
412  int rc = MPI_Type_get_extent(datatype, &lb, &extent) ;
413  assert(rc==MPI_SUCCESS);
414  memcpy(target, source, count*extent) ;
415  return source;
416 }
417 
420 void ADTOOL_AMPI_tangentMultiply(int count, MPI_Datatype datatype, MPI_Comm comm,
421  void *source, void *tangentSource,
422  void* target, void* tangentTarget) {
423  int i ;
424  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
425  double* tgt = (double*)target ;
426  double* tgtd = (double*)tangentTarget ;
427  double* src = (double*)source ;
428  double* srcd = (double*)tangentSource ;
429  for (i=0 ; i<count ; ++i) {
430  if (tgtd) tgtd[i] = tgtd[i]*src[i] + tgt[i]*srcd[i] ;
431  tgt[i] = tgt[i]*src[i] ;
432  }
433  } else if (datatype==MPI_FLOAT) {
434  float* tgt = (float*)target ;
435  float* tgtd = (float*)tangentTarget ;
436  float* src = (float*)source ;
437  float* srcd = (float*)tangentSource ;
438  for (i=0 ; i<count ; ++i) {
439  if (tgtd) tgtd[i] = tgtd[i]*src[i] + tgt[i]*srcd[i] ;
440  tgt[i] = tgt[i]*src[i] ;
441  }
442  } else
443  MPI_Abort(comm, MPI_ERR_TYPE);
444 }
445 
448 void ADTOOL_AMPI_tangentMin(int count, MPI_Datatype datatype, MPI_Comm comm,
449  void *source, void *tangentSource,
450  void* target, void* tangentTarget) {
451  int i ;
452  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
453  double* tgt = (double*)target ;
454  double* tgtd = (double*)tangentTarget ;
455  double* src = (double*)source ;
456  double* srcd = (double*)tangentSource ;
457  for (i=0 ; i<count ; ++i) {
458  if (tgt[i] > src[i]) {
459  if (tgtd) tgtd[i] = srcd[i] ;
460  tgt[i] = src[i] ;
461  }
462  }
463  } else if (datatype==MPI_FLOAT) {
464  float* tgt = (float*)target ;
465  float* tgtd = (float*)tangentTarget ;
466  float* src = (float*)source ;
467  float* srcd = (float*)tangentSource ;
468  for (i=0 ; i<count ; ++i) {
469  if (tgt[i] > src[i]) {
470  if (tgtd) tgtd[i] = srcd[i] ;
471  tgt[i] = src[i] ;
472  }
473  }
474  } else
475  MPI_Abort(comm, MPI_ERR_TYPE);
476 }
477 
480 void ADTOOL_AMPI_tangentMax(int count, MPI_Datatype datatype, MPI_Comm comm,
481  void *source, void *tangentSource,
482  void* target, void* tangentTarget) {
483  int i ;
484  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
485  double* tgt = (double*)target ;
486  double* tgtd = (double*)tangentTarget ;
487  double* src = (double*)source ;
488  double* srcd = (double*)tangentSource ;
489  for (i=0 ; i<count ; ++i) {
490  if (tgt[i] < src[i]) {
491  if (tgtd) tgtd[i] = srcd[i] ;
492  tgt[i] = src[i] ;
493  }
494  }
495  } else if (datatype==MPI_FLOAT) {
496  float* tgt = (float*)target ;
497  float* tgtd = (float*)tangentTarget ;
498  float* src = (float*)source ;
499  float* srcd = (float*)tangentSource ;
500  for (i=0 ; i<count ; ++i) {
501  if (tgt[i] < src[i]) {
502  if (tgtd) tgtd[i] = srcd[i] ;
503  tgt[i] = src[i] ;
504  }
505  }
506  } else
507  MPI_Abort(comm, MPI_ERR_TYPE);
508 }
509 
511 void ADTOOL_AMPI_adjointMultiply(int count, MPI_Datatype datatype, MPI_Comm comm,
512  void *source, void *adjointSource,
513  void* target, void* adjointTarget) {
514  int i ;
515  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
516  double* tgt = (double*)target ;
517  double* tgtb = (double*)adjointTarget ;
518  double* src = (double*)source ;
519  double* srcb = (double*)adjointSource ;
520  for (i=0 ; i<count ; ++i) {
521  srcb[i] += tgt[i]*tgtb[i] ;
522  tgtb[i] *= src[i] ;
523  }
524  } else if (datatype==MPI_FLOAT) {
525  float* tgt = (float*)target ;
526  float* tgtb = (float*)adjointTarget ;
527  float* src = (float*)source ;
528  float* srcb = (float*)adjointSource ;
529  for (i=0 ; i<count ; ++i) {
530  srcb[i] += tgt[i]*tgtb[i] ;
531  tgtb[i] *= src[i] ;
532  }
533  } else
534  MPI_Abort(comm, MPI_ERR_TYPE);
535 }
536 
538 void ADTOOL_AMPI_adjointMin(int count, MPI_Datatype datatype, MPI_Comm comm,
539  void *source, void *adjointSource,
540  void* target, void* adjointTarget) {
541  int i ;
542  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
543  double* tgt = (double*)target ;
544  double* tgtb = (double*)adjointTarget ;
545  double* src = (double*)source ;
546  double* srcb = (double*)adjointSource ;
547  for (i=0 ; i<count ; ++i) {
548  if (src[i]<tgt[i]) {
549  srcb[i] += tgtb[i] ;
550  tgtb[i] = 0.0 ;
551  }
552  }
553  } else if (datatype==MPI_FLOAT) {
554  float* tgt = (float*)target ;
555  float* tgtb = (float*)adjointTarget ;
556  float* src = (float*)source ;
557  float* srcb = (float*)adjointSource ;
558  for (i=0 ; i<count ; ++i) {
559  if (src[i]<tgt[i]) {
560  srcb[i] += tgtb[i] ;
561  tgtb[i] = 0.0 ;
562  }
563  }
564  } else
565  MPI_Abort(comm, MPI_ERR_TYPE);
566 }
567 
569 void ADTOOL_AMPI_adjointMax(int count, MPI_Datatype datatype, MPI_Comm comm,
570  void *source, void *adjointSource,
571  void* target, void* adjointTarget) {
572  int i ;
573  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
574  double* tgt = (double*)target ;
575  double* tgtb = (double*)adjointTarget ;
576  double* src = (double*)source ;
577  double* srcb = (double*)adjointSource ;
578  for (i=0 ; i<count ; ++i) {
579  if (src[i]>tgt[i]) {
580  srcb[i] += tgtb[i] ;
581  tgtb[i] = 0.0 ;
582  }
583  }
584  } else if (datatype==MPI_FLOAT) {
585  float* tgt = (float*)target ;
586  float* tgtb = (float*)adjointTarget ;
587  float* src = (float*)source ;
588  float* srcb = (float*)adjointSource ;
589  for (i=0 ; i<count ; ++i) {
590  if (src[i]>tgt[i]) {
591  srcb[i] += tgtb[i] ;
592  tgtb[i] = 0.0 ;
593  }
594  }
595  } else
596  MPI_Abort(comm, MPI_ERR_TYPE);
597 }
598 
599 void ADTOOL_AMPI_multiplyAdjoint(int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void* target, void *source, void *idx) {
600  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
601  double *vb = (double *)target ;
602  double *nb = (double *)source ;
603  int i ;
604  for (i=0 ; i<adjointCount ; ++i) {
605  *vb = *vb * (*nb) ;
606  ++vb ;
607  ++nb ;
608  }
609  } else if (datatype==MPI_FLOAT) {
610  float *vb = (float *)target ;
611  float *nb = (float *)source ;
612  int i ;
613  for (i=0 ; i<adjointCount ; ++i) {
614  *vb = *vb * (*nb) ;
615  ++vb ;
616  ++nb ;
617  }
618  } else
619  MPI_Abort(comm, MPI_ERR_TYPE);
620 }
621 
622 void ADTOOL_AMPI_divideAdjoint(int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void* target, void *source, void *idx) {
623  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
624  double *vb = (double *)target ;
625  double *nb = (double *)source ;
626  int i ;
627  for (i=0 ; i<adjointCount ; ++i) {
628  *vb = *vb / *nb ;
629  ++vb ;
630  ++nb ;
631  }
632  } else if (datatype==MPI_FLOAT) {
633  float *vb = (float *)target ;
634  float *nb = (float *)source ;
635  int i ;
636  for (i=0 ; i<adjointCount ; ++i) {
637  *vb = *vb / *nb ;
638  ++vb ;
639  ++nb ;
640  }
641  } else
642  MPI_Abort(comm, MPI_ERR_TYPE);
643 }
644 
645 void ADTOOL_AMPI_equalAdjoints(int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void* target, void *source1, void *source2, void *idx) {
646  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
647  double *vb = (double *)target ;
648  double *nb = (double *)source1 ;
649  double *fb = (double *)source2 ;
650  int i ;
651  for (i=0 ; i<adjointCount ; ++i) {
652  *vb = *nb == *fb ;
653  ++vb ;
654  ++nb ;
655  ++fb ;
656  }
657  } else if (datatype==MPI_FLOAT) {
658  float *vb = (float *)target ;
659  float *nb = (float *)source1 ;
660  float *fb = (float *)source2 ;
661  int i ;
662  for (i=0 ; i<adjointCount ; ++i) {
663  *vb = *nb == *fb ;
664  ++vb ;
665  ++nb ;
666  ++fb ;
667  }
668  } else
669  MPI_Abort(comm, MPI_ERR_TYPE);
670 }
671 
676 void ADTOOL_AMPI_incrementAdjoint(int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void* target, void *source, void *idx) {
677  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
678  double *vb = (double *)target ;
679  double *nb = (double *)source ;
680  int i ;
681  for (i=0 ; i<adjointCount ; ++i) {
682  *vb = *vb + *nb ;
683  ++vb ;
684  ++nb ;
685  }
686  } else if (datatype==MPI_FLOAT) {
687  float *vb = (float *)target ;
688  float *nb = (float *)source ;
689  int i ;
690  for (i=0 ; i<adjointCount ; ++i) {
691  *vb = *vb + *nb ;
692  ++vb ;
693  ++nb ;
694  }
695  } else
696  MPI_Abort(comm, MPI_ERR_TYPE);
697 }
698 
702 void ADTOOL_AMPI_nullifyAdjoint(int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void* target) {
703  if (datatype==MPI_DOUBLE || datatype==MPI_DOUBLE_PRECISION) {
704  double *vb = (double *)target ;
705  int i ;
706  for (i=0 ; i<adjointCount ; ++i) {
707  *vb = 0.0 ;
708  ++vb ;
709  }
710  } else if (datatype==MPI_FLOAT) {
711  float *vb = (float *)target ;
712  int i ;
713  for (i=0 ; i<adjointCount ; ++i) {
714  *vb = 0.0 ;
715  ++vb ;
716  }
717  } else
718  MPI_Abort(comm, MPI_ERR_TYPE);
719 }
720 
724 void ADTOOL_AMPI_pushBuffer(int count, MPI_Datatype datatype, MPI_Comm comm,
725  void* buffer) {
726  printf("Please provide implementation of ADTOOL_AMPI_pushBuffer()\n") ;
727 }
728 
732 void ADTOOL_AMPI_popBuffer(int count, MPI_Datatype datatype, MPI_Comm comm,
733  void* buffer) {
734  printf("Please provide implementation of ADTOOL_AMPI_popBuffer()\n") ;
735 }
736 
737 void ADTOOL_AMPI_writeData(void *buf,int *count) {}
738 
739 void ADTOOL_AMPI_writeDataV(void* activeData, int *counts, int* displs) {}
740 
742 #ifdef AMPI_FORTRANCOMPATIBLE
743  MPI_Fint adouble;
744  MPI_Fint areal;
745 #endif
746  /* Change AMPI_ADOUBLE to something else? Need AMPI_ADOUBLE!=MPI_DOUBLE for derived types. */
747  AMPI_ADOUBLE=MPI_DOUBLE;
748  AMPI_AFLOAT=MPI_FLOAT;
749 #ifdef AMPI_FORTRANCOMPATIBLE
750  adtool_ampi_fortransetuptypes_(&adouble, &areal);
751  AMPI_ADOUBLE_PRECISION=MPI_Type_f2c(adouble);
752  AMPI_AREAL=MPI_Type_f2c(areal);
753 #endif
754 }
755 
757 #ifdef AMPI_FORTRANCOMPATIBLE
758  MPI_Fint adouble=MPI_Type_c2f(AMPI_ADOUBLE_PRECISION);
759  MPI_Fint areal=MPI_Type_c2f(AMPI_AREAL);
760  adtool_ampi_fortrancleanuptypes_(&adouble, &areal);
761 #endif
762 }
763 
764 MPI_Datatype ADTOOL_AMPI_FW_rawType(MPI_Datatype datatype) {
765  int dt_idx = derivedTypeIdx(datatype);
766  if (datatype==AMPI_ADOUBLE) return MPI_DOUBLE;
767  else if (datatype==AMPI_AFLOAT) return MPI_FLOAT;
768  else if (isDerivedType(dt_idx)) return getDTypeData()->packed_types[dt_idx];
769  else return datatype;
770 }
771 
772 MPI_Datatype ADTOOL_AMPI_BW_rawType(MPI_Datatype datatype) {
773  int dt_idx = derivedTypeIdx(datatype);
774  if (datatype==AMPI_ADOUBLE) return MPI_DOUBLE;
775  else if (datatype==AMPI_AFLOAT) return MPI_FLOAT;
776  else if (isDerivedType(dt_idx)) return MPI_DOUBLE;
777  else return datatype;
778 }
779 
781  if (datatype==AMPI_ADOUBLE
782  ||
783  datatype==AMPI_AFLOAT
784 #ifdef AMPI_FORTRANCOMPATIBLE
785  ||
786  datatype==AMPI_ADOUBLE_PRECISION
787  ||
788  datatype==AMPI_AREAL
789 #endif
790  ) return AMPI_ACTIVE;
791  return AMPI_PASSIVE;
792 }
793 
794 void *ADTOOL_AMPI_createWinMap(void *active_buf, MPI_Aint size){
795  return NULL;
796 }
797 
798 void ADTOOL_AMPI_writeWinData(void *map, void *buf, MPI_Aint size){
799 }
800 
801 MPI_Aint ADTOOL_AMPI_getWinSize(MPI_Aint size) {
802  return 0;
803 }