Changeset 15837


Ignore:
Timestamp:
08/19/13 14:13:48 (12 years ago)
Author:
Eric.Larour
Message:

CHG: finished setting up issmmpi.cpp, starting code-wide conversion from mpi to issmmpi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp

    r15836 r15837  
    1313#include <cstring> // for memcpy
    1414
    15 #include "issmmpi.h"
    16 
    17 // for now - needs to be replaced by issm's type header file >>>>---- from here
    18 #ifdef _HAVE_ADOLC_
    19 # include "adolc/adolc.h"
    20 typedef adouble IssmDouble;
    21 #else
    22 typedef double IssmDouble;
    23 #endif
    24 // ------<<<< until here
     15#include "./issmmpi.h"
     16#include "../../shared/Numerics/types.h"
    2517
    2618#ifndef _HAVE_MPI_
    27 ISSMMPI_Status ourIssmMPIStatusIgnore=0;
    28 size_t sizeHelper(ISSMMPI_Datatype type) { /*{{{*/
     19ISSM_MPI_Status ourIssmMPIStatusIgnore=0;
     20size_t sizeHelper(ISSM_MPI_Datatype type) { /*{{{*/
    2921
    3022  switch(type) {
    31   case ISSMMPI_CHAR:
     23  case ISSM_MPI_CHAR:
    3224    return sizeof(char);
    3325    break;
    34   case ISSMMPI_DOUBLE:
     26  case ISSM_MPI_DOUBLE:
    3527    return sizeof(double);
    3628    break;
    37   case ISSMMPI_INT:
     29  case ISSM_MPI_INT:
    3830    return sizeof(int);
    3931    break;
     
    4638#endif
    4739
    48 int ISSMMPI_Allgather(void *sendbuf, int sendcount, ISSMMPI_Datatype sendtype, void *recvbuf, int recvcount, ISSMMPI_Datatype recvtype, ISSMMPI_Comm comm) {  /*{{{*/
     40int ISSM_MPI_Allgather(void *sendbuf, int sendcount, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcount, ISSM_MPI_Datatype recvtype, ISSM_MPI_Comm comm) {  /*{{{*/
    4941  int rc=0;
    5042  assert(sendcount==recvcount || sendtype==recvtype); // we handle only identical representations
     
    6961#else
    7062# ifdef _HAVE_ADOLC_
    71   if (sendtype==ISSMMPI_DOUBLE) {
     63  if (sendtype==ISSM_MPI_DOUBLE) {
    7264    IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
    7365    IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     
    8072  return rc;
    8173} /*}}}*/
    82 int ISSMMPI_Allgatherv(void *sendbuf, int sendcount, ISSMMPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, ISSMMPI_Datatype recvtype, ISSMMPI_Comm comm) {  /*{{{*/
     74int ISSM_MPI_Allgatherv(void *sendbuf, int sendcount, ISSM_MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, ISSM_MPI_Datatype recvtype, ISSM_MPI_Comm comm) {  /*{{{*/
    8375  int rc=0;
    8476  assert(sendtype==recvtype); // we handle only identical representations
     
    10698  assert(sendcount==recvcounts[0]); // we handle only identical representations
    10799# ifdef _HAVE_ADOLC_
    108   if (sendtype==ISSMMPI_DOUBLE) {
     100  if (sendtype==ISSM_MPI_DOUBLE) {
    109101    IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
    110102    IssmDouble* activeRecvBuf=(IssmDouble*)(recvbuf)+displs[0];
     
    117109  return rc;
    118110}/*}}}*/
    119 int ISSMMPI_Allreduce(void *sendbuf, void *recvbuf, int count, ISSMMPI_Datatype datatype, ISSMMPI_Op op, ISSMMPI_Comm comm){/*{{{*/
     111int ISSM_MPI_Allreduce(void *sendbuf, void *recvbuf, int count, ISSM_MPI_Datatype datatype, ISSM_MPI_Op op, ISSM_MPI_Comm comm){/*{{{*/
    120112 
    121113  int rc=0;
     
    138130#else
    139131# ifdef _HAVE_ADOLC_
    140   if (datatype==ISSMMPI_DOUBLE) {
     132  if (datatype==ISSM_MPI_DOUBLE) {
    141133    IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
    142134    IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     
    149141  return rc;
    150142}/*}}}*/
    151 int ISSMMPI_Barrier(ISSMMPI_Comm comm){  /*{{{*/
     143int ISSM_MPI_Barrier(ISSM_MPI_Comm comm){  /*{{{*/
    152144
    153145  int rc=0;
     
    163155  return rc;
    164156}/*}}}*/
    165 int ISSMMPI_Bcast(void *buffer, int count, ISSMMPI_Datatype datatype, int root, ISSMMPI_Comm comm){  /*{{{*/
     157int ISSM_MPI_Bcast(void *buffer, int count, ISSM_MPI_Datatype datatype, int root, ISSM_MPI_Comm comm){  /*{{{*/
    166158
    167159  int rc=0;
     
    185177  return rc;
    186178}/*}}}*/
    187 int ISSMMPI_Comm_free(ISSMMPI_Comm *comm){ /*{{{*/
     179int ISSM_MPI_Comm_free(ISSM_MPI_Comm *comm){ /*{{{*/
    188180 
    189181  int rc=0;
     
    199191  return rc;
    200192}/*}}}*/
    201 int ISSMMPI_Comm_rank(ISSMMPI_Comm comm, int *rank){  /*{{{*/
     193int ISSM_MPI_Comm_rank(ISSM_MPI_Comm comm, int *rank){  /*{{{*/
    202194
    203195  int rc=0;
     
    210202  return rc;
    211203}/*}}}*/
    212 int ISSMMPI_Comm_size( ISSMMPI_Comm comm, int *size){ /*{{{*/
     204int ISSM_MPI_Comm_size( ISSM_MPI_Comm comm, int *size){ /*{{{*/
    213205 
    214206  int rc=0;
     
    221213  return rc;
    222214}/*}}}*/
    223 int ISSMMPI_Finalize(void){  /*{{{*/
     215int ISSM_MPI_Finalize(void){  /*{{{*/
    224216
    225217  int rc=0;
     
    233225  return rc;
    234226}/*}}}*/
    235 int ISSMMPI_Gather(void *sendbuf, int sendcnt, ISSMMPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSMMPI_Datatype recvtype, int root, ISSMMPI_Comm comm){  /*{{{*/
     227int ISSM_MPI_Gather(void *sendbuf, int sendcnt, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm){  /*{{{*/
    236228
    237229  int rc=0;
     
    259251#else
    260252# ifdef _HAVE_ADOLC_
    261   if (sendtype==ISSMMPI_DOUBLE) {
     253  if (sendtype==ISSM_MPI_DOUBLE) {
    262254    IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
    263255    IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     
    270262  return rc;
    271263}/*}}}*/
    272 int ISSMMPI_Gatherv(void *sendbuf, int sendcnt, ISSMMPI_Datatype sendtype, void *recvbuf, int *recvcnts, int *displs, ISSMMPI_Datatype recvtype, int root, ISSMMPI_Comm comm){/*{{{*/
     264int ISSM_MPI_Gatherv(void *sendbuf, int sendcnt, ISSM_MPI_Datatype sendtype, void *recvbuf, int *recvcnts, int *displs, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm){/*{{{*/
    273265 
    274266  int rc=0;
     
    299291  assert(sendcnt==recvcnts[0]); // we handle only identical representations
    300292# ifdef _HAVE_ADOLC_
    301   if (sendtype==ISSMMPI_DOUBLE) {
     293  if (sendtype==ISSM_MPI_DOUBLE) {
    302294    IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
    303295    IssmDouble* activeRecvBuf=(IssmDouble*)(recvbuf)+displs[0];
     
    310302  return rc;
    311303}/*}}}*/
    312 int ISSMMPI_Init(int *argc, char ***argv){  /*{{{*/
     304int ISSM_MPI_Init(int *argc, char ***argv){  /*{{{*/
    313305
    314306  int rc=0;
     
    322314  return rc;
    323315}/*}}}*/
    324 int ISSMMPI_Recv(void *buf, int count, ISSMMPI_Datatype datatype, int source, int tag, ISSMMPI_Comm comm, ISSMMPI_Status *status){ /*{{{*/
     316int ISSM_MPI_Recv(void *buf, int count, ISSM_MPI_Datatype datatype, int source, int tag, ISSM_MPI_Comm comm, ISSM_MPI_Status *status){ /*{{{*/
    325317
    326318  int rc=0;
     
    351343  return rc;
    352344}/*}}}*/
    353 int ISSMMPI_Reduce(void *sendbuf, void *recvbuf, int count, ISSMMPI_Datatype datatype, ISSMMPI_Op op, int root, ISSMMPI_Comm comm){ /*{{{*/
     345int ISSM_MPI_Reduce(void *sendbuf, void *recvbuf, int count, ISSM_MPI_Datatype datatype, ISSM_MPI_Op op, int root, ISSM_MPI_Comm comm){ /*{{{*/
    354346
    355347  int rc=0;
     
    374366#else
    375367# ifdef _HAVE_ADOLC_
    376   if (datatype==ISSMMPI_DOUBLE) {
     368  if (datatype==ISSM_MPI_DOUBLE) {
    377369    IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
    378370    IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     
    385377  return rc;
    386378}/*}}}*/
    387 int ISSMMPI_Scatter(void *sendbuf, int sendcnt, ISSMMPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSMMPI_Datatype recvtype, int root, ISSMMPI_Comm comm){ /*{{{*/
     379int ISSM_MPI_Scatter(void *sendbuf, int sendcnt, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm){ /*{{{*/
    388380
    389381  int rc=0;
     
    411403#else
    412404# ifdef _HAVE_ADOLC_
    413   if (sendtype==ISSMMPI_DOUBLE) {
     405  if (sendtype==ISSM_MPI_DOUBLE) {
    414406    IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
    415407    IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     
    422414  return rc;
    423415}/*}}}*/
    424 int ISSMMPI_Scatterv(void *sendbuf, int *sendcnts, int *displs, ISSMMPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSMMPI_Datatype recvtype, int root, ISSMMPI_Comm comm){ /*{{{*/
     416int ISSM_MPI_Scatterv(void *sendbuf, int *sendcnts, int *displs, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm){ /*{{{*/
    425417
    426418  int rc=0;
     
    451443  assert(sendcnts[0]==recvcnt); // we handle only identical representations
    452444# ifdef _HAVE_ADOLC_
    453   if (sendtype==ISSMMPI_DOUBLE) {
     445  if (sendtype==ISSM_MPI_DOUBLE) {
    454446    IssmDouble* activeSendBuf=(IssmDouble*)(sendbuf)+displs[0];
    455447    IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     
    462454  return rc;
    463455}/*}}}*/
    464 int ISSMMPI_Send(void *buf, int count, ISSMMPI_Datatype datatype, int dest, int tag, ISSMMPI_Comm comm){ /*{{{*/
     456int ISSM_MPI_Send(void *buf, int count, ISSM_MPI_Datatype datatype, int dest, int tag, ISSM_MPI_Comm comm){ /*{{{*/
    465457
    466458  int rc=0;
     
    487479  return rc;
    488480}/*}}}*/
    489 double ISSMMPI_Wtime(void){/*{{{*/
     481double ISSM_MPI_Wtime(void){/*{{{*/
    490482 
    491483  assert(0); // to be implemented
    492484  return 0.0;
    493485}/*}}}*/
    494 void ISSMMPI_ContiguousInAdolc(size_t aSize) { /*{{{*/
     486void ISSM_MPI_ContiguousInAdolc(size_t aSize) { /*{{{*/
    495487
    496488#ifdef _HAVE_ADOLC_
     
    498490#endif
    499491}/*}}}*/
    500 
Note: See TracChangeset for help on using the changeset viewer.