Changeset 241 for branches


Ignore:
Timestamp:
Jun 9, 2011 9:30:28 AM (7 years ago)
Author:
kulshres
Message:

from gitclone

commit e2c59f71d057426cbb5863e23948d95281c291a8
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Jun 9 15:28:01 2011 +0200

compatibility with newer openmpi for MPI_Op

the type definitions in newer openmpi are more complicated with
pointers instead of integers. this causes some problems for us
as we cannot store pointers on tape. so create a conversion
mechanism.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

Location:
branches/MPI/ADOL-C/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/MPI/ADOL-C/src/adolc_mpi.cpp

    r240 r241  
    7373}
    7474
     75MPI_Op adolc_to_mpi_op(ADOLC_MPI_Op op) {
     76    switch (op) {
     77        case ADOLC_MPI_MAX: return MPI_MAX;
     78        case ADOLC_MPI_MIN: return MPI_MIN;
     79        case ADOLC_MPI_SUM: return MPI_SUM;
     80        case ADOLC_MPI_PROD: return MPI_PROD;
     81        case ADOLC_MPI_LAND: return MPI_LAND;
     82        case ADOLC_MPI_BAND: return MPI_BAND;
     83        case ADOLC_MPI_LOR: return MPI_LOR;
     84        case ADOLC_MPI_BOR: return MPI_BOR;
     85        case ADOLC_MPI_LXOR: return MPI_LXOR;
     86        case ADOLC_MPI_BXOR: return MPI_BXOR;
     87        case ADOLC_MPI_MINLOC: return MPI_MINLOC;
     88        case ADOLC_MPI_MAXLOC: return MPI_MAXLOC;
     89    }
     90}
     91
    7592int ADOLC_MPI_Send( adouble *buf,
    7693                    int count,
     
    188205       trade_s[i] = send_buf[i].getValue();
    189206     }
    190     ierr = MPI_Reduce(trade_s,trade_r ,count,datatype,op,root, comm);
     207    ierr = MPI_Reduce(trade_s,trade_r ,count,datatype,adolc_to_mpi_op(op),root, comm);
    191208
    192209    if ( id == root){
  • branches/MPI/ADOL-C/src/adolc_mpi.h

    r240 r241  
    3131#define ADOLC_MPI_COMM_WORLD MPI_COMM_WORLD
    3232#define ADOLC_MPI_Comm MPI_Comm
    33 #define ADOLC_MPI_Op MPI_Op
    34 #define ADOLC_MPI_LAND MPI_LAND
    35 #define ADOLC_MPI_BAND MPI_BAND
    36 #define ADOLC_MPI_LOR MPI_LOR
    37 #define ADOLC_MPI_BOR MPI_BOR
    38 #define ADOLC_MPI_LXOR MPI_LXOR
    39 #define ADOLC_MPI_BXOR MPI_BXOR
    40 #define ADOLC_MPI_MAX MPI_MAX
    41 #define ADOLC_MPI_MIN MPI_MIN
    42 #define ADOLC_MPI_SUM MPI_SUM
    43 #define ADOLC_MPI_PROD MPI_PROD
    44 #define ADOLC_MPI_MINLOC MPI_MINLOC
    45 #define ADOLC_MPI_MAXLOC MPI_MAXLOC
     33
     34typedef enum ADOLC_MPI_Op_t {
     35    ADOLC_MPI_MAX=100,
     36    ADOLC_MPI_MIN,
     37    ADOLC_MPI_SUM,
     38    ADOLC_MPI_PROD,
     39    ADOLC_MPI_LAND,
     40    ADOLC_MPI_BAND,
     41    ADOLC_MPI_LOR,
     42    ADOLC_MPI_BOR,
     43    ADOLC_MPI_LXOR,
     44    ADOLC_MPI_BXOR,
     45    ADOLC_MPI_MINLOC,
     46    ADOLC_MPI_MAXLOC
     47} ADOLC_MPI_Op;
    4648
    4749#ifdef __cplusplus
     
    5557int ADOLC_MPI_Barrier(ADOLC_MPI_Comm comm);
    5658int ADOLC_MPI_Finalize() ;
     59
     60MPI_Op adolc_to_mpi_op(ADOLC_MPI_Op);
    5761#ifdef __cplusplus
    5862}
  • branches/MPI/ADOL-C/src/ho_rev.c

    r240 r241  
    596596        double *trade, *rec_buf;
    597597        int mpi_i, id, root, count, loc_recv, loc_send;
    598      MPI_Op mpi_op;
     598     ADOLC_MPI_Op mpi_op;
    599599#endif /* is used by Parallelisation */
    600600
  • branches/MPI/ADOL-C/src/uni5_for.c

    r240 r241  
    925925     MPI_Status status_MPI;
    926926     int mpi_i , loc_send,loc_recv;
    927      MPI_Op mpi_op;
     927     ADOLC_MPI_Op mpi_op;
    928928     int myid,root, count, id;
    929929     MPI_Comm_rank(MPI_COMM_WORLD, &id);
     
    934934     int *trade_loc, *rec_buf_loc;
    935935     int *counts, *tmp_counts;
    936      int anz;
     936     int anz, mpi_id;
    937937#endif
    938938#if defined(_INT_FOR_)
     
    40644064              trade[mpi_i] = dp_T0[loc_send+mpi_i];
    40654065
    4066            MPI_Reduce(trade,rec_buf,count, MPI_DOUBLE, mpi_op, root, MPI_COMM_WORLD);
     4066           MPI_Reduce(trade,rec_buf,count, MPI_DOUBLE, adolc_to_mpi_op(mpi_op), root, MPI_COMM_WORLD);
    40674067           if (myid == root){
    40684068              for( mpi_i =0; mpi_i < count; mpi_i++){
     
    40834083              trade[mpi_i] = dp_T[loc_recv + mpi_i];
    40844084           }
    4085            MPI_Reduce(trade,rec_buf,count, MPI_DOUBLE, mpi_op, root, MPI_COMM_WORLD);
     4085           MPI_Reduce(trade,rec_buf,count, MPI_DOUBLE, adolc_to_mpi_op(mpi_op), root, MPI_COMM_WORLD);
    40864086           if ( myid == root){
    40874087              for( mpi_i =0; mpi_i < count; mpi_i++){
     
    41024102                 trade[p*mpi_i+i] = dpp_T[loc_recv+mpi_i][i];
    41034103
    4104            MPI_Reduce(trade,rec_buf,count*p, MPI_DOUBLE,mpi_op, root, MPI_COMM_WORLD);
     4104           MPI_Reduce(trade,rec_buf,count*p, MPI_DOUBLE,adolc_to_mpi_op(mpi_op), root, MPI_COMM_WORLD);
    41054105           if ( myid == root){
    41064106              for(mpi_i =0; mpi_i < count; mpi_i++)
     
    41214121                 trade[k*mpi_i+i] = dpp_T[loc_recv + mpi_i][i];
    41224122
    4123            MPI_Reduce(trade,rec_buf,count*k, MPI_DOUBLE,mpi_op, root, MPI_COMM_WORLD);
     4123           MPI_Reduce(trade,rec_buf,count*k, MPI_DOUBLE,adolc_to_mpi_op(mpi_op), root, MPI_COMM_WORLD);
    41244124           if ( myid == root){
    41254125              for(mpi_i =0; mpi_i < count; mpi_i++)
     
    41404140                 trade[p*k*mpi_i+i] = dpp_T[loc_recv+mpi_i][i];
    41414141
    4142            MPI_Reduce(trade,rec_buf,count*p*k, MPI_DOUBLE,mpi_op, root, MPI_COMM_WORLD);
     4142           MPI_Reduce(trade,rec_buf,count*p*k, MPI_DOUBLE,adolc_to_mpi_op(mpi_op), root, MPI_COMM_WORLD);
    41434143           if ( myid == root){
    41444144              for(mpi_i =0; mpi_i < count; mpi_i++)
     
    42014201                 // combine each index domain ...
    42024202                 l = anz;
    4203                  for(mpi_op=1; mpi_op < process_count; mpi_op++ ){
     4203                 for(mpi_id=1; mpi_id < process_count; mpi_id++ ){
    42044204
    42054205                    for(mpi_i=0; mpi_i < count; mpi_i++){
     
    42544254                    for (mpi_i=0; mpi_i < s_r_indep; mpi_i++){
    42554255                     // nonl_dom settings
    4256                         mpi_op=0;
    4257                         while ((rec_buf_loc[l + mpi_op] > -1) && (mpi_op < counts[0]) ) {
    4258                               mpi_op++;
     4256                        mpi_id=0;
     4257                        while ((rec_buf_loc[l + mpi_id] > -1) && (mpi_id < counts[0]) ) {
     4258                              mpi_id++;
    42594259                        }
    4260                         extend_nonlinearity_domain_combine_received_trade(mpi_i, mpi_op, nonl_dom, &rec_buf_loc[l]);
     4260                        extend_nonlinearity_domain_combine_received_trade(mpi_i, mpi_id, nonl_dom, &rec_buf_loc[l]);
    42614261                        l +=counts[0];
    42624262                    }
Note: See TracChangeset for help on using the changeset viewer.