Changeset 12102


Ignore:
Timestamp:
04/20/12 19:07:47 (13 years ago)
Author:
Eric.Larour
Message:

Stripped out the following layers:
METIS: if not running with MPI, do not partition!
MPI: can now run without PETSC and MPI, just using the gsl matrix format.
PETSC and MPI: idem.

Can not run MPI and PETSC separately.

Location:
issm/trunk-jpl
Files:
1 added
2 deleted
55 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/configs/config-macosx64-larour-nopetsc.sh

    r11931 r12102  
    11#!/bin/sh
    22
    3 #petsc 3.2
    4 #mpich 1.4
     3pythonversion=2.7
    54
    65./configure \
    76        --prefix=$ISSM_TIER \
    8         --with-mpi-include=$ISSM_TIER/externalpackages/mpich2/install/include  \
    9         --with-mpi-lib=" $ISSM_TIER/externalpackages/mpich2/install/lib/libpmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpl.a " \
    107        --with-matlab-dir=$MATLAB_DIR \
     8        --with-python-dir=$ISSM_TIER/externalpackages/python/install\
     9        --with-python-version=$pythonversion \
     10        --with-python-numpy-dir=$ISSM_TIER/externalpackages/python/install/Python.framework/Versions/$pythonversion/lib/python$pythonversion/site-packages/numpy/core/include/numpy\
    1111        --with-triangle-dir=$ISSM_TIER/externalpackages/triangle/install \
    12         --with-metis-dir=$ISSM_TIER/externalpackages/metis/install \
    13         --with-chaco-dir=$ISSM_TIER/externalpackages/chaco/install \
    14         --with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
    1512        --with-math-lib="/usr/lib/libm.dylib" \
    16         --with-blas-lapack-dir=$ISSM_TIER/externalpackages/petsc/install/lib \
    1713        --with-graphics-lib="/usr/X11/lib/libX11.dylib" \
    1814        --with-cxxoptflags=" -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -mmacosx-version-min=10.5  -O3 -DNDEBUG -w "\
    19         --with-numthreads=8 \
    2015        --with-gsl-dir=$ISSM_TIER/externalpackages/gsl/install
    21 #       --with-petsc-dir=$ISSM_TIER/externalpackages/petsc/install  \
    22 #       --with-petsc-arch=$ISSM_ARCH \
    23 #       --with-plapack-lib="-L$ISSM_TIER/externalpackages/petsc/install/ -lPLAPACK" \
    24 #       --with-plapack-include="-I$ISSM_TIER/externalpackages/petsc/install/include/ " \
    25 #       --with-blacs-dir=$ISSM_TIER/externalpackages/petsc/install/ \
    26 #       --with-scalapack-dir=$ISSM_TIER/externalpackages/petsc/install/ \
    27 #       --with-mumps-dir=$ISSM_TIER/externalpackages/petsc/install/
    28 #   --with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install \
  • issm/trunk-jpl/externalpackages/nose/install-macosx64sh

    r11841 r12102  
    11#/bin/bash
    2 #Install Python3 nose module
     2#Install Python nose module
    33
    4 rm -rf py3k
     4pythonversion=2
     5       
     6rm -rf src
    57
    6 svn checkout http://python-nose.googlecode.com/svn/branches/py3k
    7 cd py3k
     8if [[ $pythonversion == "3" ]];then
    89
    9 python3.2 ./setup.py build
    10 python3.2 ./setup.py install
     10        svn checkout http://python-nose.googlecode.com/svn/branches/py3k
     11        mv py3k src
     12
     13        cd src
     14        python ./setup.py build
     15        python ./setup.py install
     16fi
     17
     18if [[ $pythonversion == "2" ]];then
     19
     20        tar -zxvf  nose-1.1.2.tar.gz
     21        mv nose-1.1.2 src
     22        rm -rf nose-1.1.2
     23
     24        cd src
     25        python ./setup.py build
     26        python ./setup.py install
     27fi
  • issm/trunk-jpl/externalpackages/scipy/install-macosx64.sh

    r11944 r12102  
    1919        #install numpy
    2020        cd numpy
    21         python3.2 setup.py build
    22         python3.2 setup.py install
     21        python setup.py build
     22        python setup.py install
    2323
    2424       
     
    3030        #install scipy
    3131        cd scipy
    32         python3.2 setup.py build
    33         python3.2 setup.py install
     32        python setup.py build
     33        python setup.py install
    3434
    3535elif [[ $install == "3" ]];then
  • issm/trunk-jpl/m4/issm_options.m4

    r12092 r12102  
    572572                HAVE_METIS=no
    573573        fi
    574 
    575         if test $HAVE_METIS = no; then
    576                 AC_MSG_ERROR([--with-metis-dir  missing. Metis is needed to run ISSM]);
    577         else
    578                 AC_MSG_RESULT($HAVE_METIS)
    579         fi
     574        AM_CONDITIONAL([METIS], [test x$HAVE_METIS = xyes])
    580575        dnl }}}
    581576        dnl mpi{{{
     
    603598                fi
    604599        fi
     600        AM_CONDITIONAL([MPI], [test x$HAVE_MPI = xyes])
    605601        AC_MSG_RESULT($HAVE_MPI)
    606602        dnl }}}
     
    12281224        fi
    12291225
     1226        dnl check that if we have MPI, we have metis
     1227        if test "$HAVE_METIS" = "yes"  && test "$HAVE_MPI" = "no" ; then
     1228        AC_MSG_ERROR([need mpi if using the metis partitioner!]);
     1229        fi
     1230
     1231
     1232
     1233
     1234
    12301235        AC_MSG_RESULT(done)
    12311236        dnl }}}
  • issm/trunk-jpl/src/Makefile.am

    r12075 r12102  
    1 EXTRA_DIST =  perl  pro py
    2 SUBDIRS = c modules m
     1EXTRA_DIST =  perl  pro
     2SUBDIRS = c modules m  py
  • issm/trunk-jpl/src/c/Container/Constraints.cpp

    r12016 r12102  
    4848
    4949        /*figure out total number of constraints combining all the cpus (no clones here)*/
    50         MPI_Reduce(&localconstraints,&numberofconstraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    51         MPI_Bcast(&numberofconstraints,1,MPI_INT,0,MPI_COMM_WORLD);
     50        #ifdef _HAVE_MPI_
     51                MPI_Reduce(&localconstraints,&numberofconstraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
     52                MPI_Bcast(&numberofconstraints,1,MPI_INT,0,MPI_COMM_WORLD);
     53        #else
     54                numberofconstraints=localconstraints;
     55        #endif
     56       
    5257
    5358        return numberofconstraints;
  • issm/trunk-jpl/src/c/Container/Elements.cpp

    r12016 r12102  
    125125
    126126        /*Synchronize across cluster, so as to not end up with different sizes for each patch on each cpu: */
     127        #ifdef _HAVE_MPI_
    127128        MPI_Reduce (&numvertices,&max_numvertices,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    128129        MPI_Bcast(&max_numvertices,1,MPI_INT,0,MPI_COMM_WORLD);
     
    132133        MPI_Bcast(&max_numnodes,1,MPI_INT,0,MPI_COMM_WORLD);
    133134        numnodes=max_numnodes;
     135        #endif
    134136
    135137        /*Ok, initialize Patch object: */
     
    191193
    192194                /*Get rank of first cpu that has results*/
     195                #ifdef _HAVE_MPI_
    193196                if(this->Size()) rank=my_rank;
    194197                else rank=num_procs;
    195198                MPI_Allreduce (&rank,&minrank,1,MPI_INT,MPI_MIN,MPI_COMM_WORLD);
     199                #else
     200                minrank=my_rank;
     201                #endif
    196202
    197203                /*see what the first element of this partition has in stock (this is common to all partitions)*/
     
    201207                        element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults);
    202208                }
     209                #ifdef _HAVE_MPI_
    203210                MPI_Bcast(&numberofresults,1,MPI_DOUBLE,minrank,MPI_COMM_WORLD);
     211                #endif
    204212
    205213                /*Get out if there is no results. Otherwise broadcast info*/
    206214                if(!numberofresults) return;
     215                #ifdef _HAVE_MPI_
    207216                if(my_rank!=minrank){
    208217                        resultsenums=(int*)xmalloc(numberofresults*sizeof(int));
     
    215224                MPI_Bcast(resultstimes,numberofresults,MPI_DOUBLE,minrank,MPI_COMM_WORLD);
    216225                MPI_Bcast(resultssteps,numberofresults,MPI_INT,minrank,MPI_COMM_WORLD);
     226                #endif
    217227
    218228                /*Loop over all results and get nodal vector*/
     
    273283
    274284        local_nelem=this->Size();
     285        #ifdef _HAVE_MPI_
    275286        MPI_Allreduce ( (void*)&local_nelem,(void*)&numberofelements,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
     287        #else
     288        numberofelements=local_nelem;
     289        #endif
    276290
    277291        return numberofelements;
  • issm/trunk-jpl/src/c/Container/Loads.cpp

    r12016 r12102  
    6363
    6464        /*figure out total number of loads combining all the cpus (no clones here)*/
     65        #ifdef _HAVE_MPI_
    6566        MPI_Reduce(&localloads,&numberofloads,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    6667        MPI_Bcast(&numberofloads,1,MPI_INT,0,MPI_COMM_WORLD);
     68        #else
     69        numberofloads=localloads;
     70        #endif
     71
    6772
    6873        return numberofloads;
  • issm/trunk-jpl/src/c/Container/Nodes.cpp

    r12016 r12102  
    8383         * 0. This means the dofs between all the cpus are not unique. We now offset the dofs of eache
    8484         * cpus by the total last dofs of the previus cpu, starting from 0.
    85          * First: bet number of dofs for each cpu*/
     85         * First: get number of dofs for each cpu*/
    8686        alldofcount=(int*)xmalloc(num_procs*sizeof(int));
     87        #ifdef _HAVE_MPI_
    8788        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD);
    8889        MPI_Bcast(alldofcount,num_procs,MPI_INT,0,MPI_COMM_WORLD);
     90        #else
     91        alldofcount[0]=dofcount;
     92        #endif
    8993
    9094        /* Every cpu should start its own dof count at the end of the dofcount from cpu-1*/
     
    119123                }
    120124        }
     125        #ifdef _HAVE_MPI_
    121126        MPI_Allreduce ( (void*)truedofs,(void*)alltruedofs,numnodes*maxdofspernode,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
     127        #else
     128        alltruedofs[0]=truedofs[0];
     129        #endif
    122130
    123131        /* Now every cpu knows the true dofs of everyone else that is not a clone*/
     
    162170         * dealt with by another cpu. We take the minimum because we are going to manage dof assignment in increasing
    163171         * order of cpu rank. This is also why we initialized this array to num_procs.*/
     172        #ifdef _HAVE_MPI_
    164173        MPI_Allreduce ( (void*)ranks,(void*)minranks,numnodes,MPI_INT,MPI_MIN,MPI_COMM_WORLD);
     174        #else
     175        for(i=0;i<numnodes;i++)minranks[i]=ranks[i];
     176        #endif
    165177
    166178        /*Now go through all objects, and use minranks to flag which objects are cloned: */
     
    205217
    206218        /*Grab max of all cpus: */
     219        #ifdef _HAVE_MPI_
    207220        MPI_Allreduce ( (void*)&max,(void*)&allmax,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    208         max=allmax;
     221        #endif
    209222
    210223        return max;
     
    237250
    238251        /*Gather from all cpus: */
     252        #ifdef _HAVE_MPI_
    239253        MPI_Allreduce ( (void*)&numdofs,(void*)&allnumdofs,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
     254        #else
     255        allnumdofs=numdofs;
     256        #endif
    240257        return allnumdofs;
    241258}
     
    260277
    261278        /*Gather from all cpus: */
     279        #ifdef _HAVE_MPI_
    262280        MPI_Allreduce ( (void*)&numnodes,(void*)&allnumnodes,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
     281        #else
     282        allnumnodes=numnodes;
     283        #endif
    263284
    264285        return allnumnodes;
     
    286307        }
    287308
     309        #ifdef _HAVE_MPI_
    288310        MPI_Reduce (&max_sid,&node_max_sid,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    289311        MPI_Bcast(&node_max_sid,1,MPI_INT,0,MPI_COMM_WORLD);
    290312        max_sid=node_max_sid;
     313        #endif
    291314
    292315        if(max_sid==1){
  • issm/trunk-jpl/src/c/Container/Vertices.cpp

    r12016 r12102  
    6161         * First: bet number of dofs for each cpu*/
    6262        alldofcount=(int*)xmalloc(num_procs*sizeof(int));
     63        #ifdef _HAVE_MPI_
    6364        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD);
    6465        MPI_Bcast(alldofcount,num_procs,MPI_INT,0,MPI_COMM_WORLD);
     66        #else
     67        alldofcount[0]=dofcount;
     68        #endif
    6569
    6670        /* Every cpu should start its own dof count at the end of the dofcount from cpu-1*/
     
    8589                vertex->ShowTrueDofs(truedofs);
    8690        }
     91        #ifdef _HAVE_MPI_
    8792        MPI_Allreduce((void*)truedofs,(void*)alltruedofs,numberofobjects*numberofdofsperobject,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
     93        #else
     94        for(i=0;i<numberofobjects*numberofdofsperobject;i++)alltruedofs[i]=truedofs[i];
     95        #endif
    8896
    8997        /* Now every cpu knows the true dofs of everyone else that is not a clone*/
     
    121129         * dealt with by another cpu. We take the minimum because we are going to manage dof assignment in increasing
    122130         * order of cpu rank. This is also why we initialized this array to num_procs.*/
     131        #ifdef _HAVE_MPI_
    123132        MPI_Allreduce ( (void*)ranks,(void*)minranks,numberofobjects,MPI_INT,MPI_MIN,MPI_COMM_WORLD);
     133        #else
     134        for(i=0;i<numberofobjects;i++)minranks[i]=ranks[i];
     135        #endif
    124136
    125137        /*Now go through all objects, and use minranks to flag which objects are cloned: */
     
    149161        }
    150162
     163        #ifdef _HAVE_MPI_
    151164        MPI_Reduce (&max_sid,&vertex_max_sid,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    152165        MPI_Bcast(&vertex_max_sid,1,MPI_INT,0,MPI_COMM_WORLD);
    153166        max_sid=vertex_max_sid;
     167        #endif
    154168
    155169        /*sid starts at 0*/
  • issm/trunk-jpl/src/c/Makefile.am

    r12093 r12102  
    206206                                        ./shared/Wrapper/ModuleBoot.cpp\
    207207                                        ./shared/Wrapper/ModuleEnd.cpp\
    208                                         ./toolkits/mpi/mpiincludes.h\
    209                                         ./toolkits/mpi/patches/mpipatches.h\
    210                                         ./toolkits/mpi/patches/DetermineLocalSize.cpp\
    211                                         ./toolkits/mpi/patches/MPI_Upperrow.cpp\
    212                                         ./toolkits/mpi/patches/MPI_Lowerrow.cpp\
    213                                         ./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp\
    214208                                        ./toolkits/metis/metisincludes.h\
    215209                                        ./toolkits/issm/issmtoolkit.h\
     
    218212                                        ./toolkits/issm/SeqMat.h\
    219213                                        ./toolkits/issm/SeqMat.cpp\
    220                                         ./toolkits/metis/patches/metispatches.h\
    221                                         ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp\
    222214                                        ./toolkits/triangle/triangleincludes.h\
    223215                                        ./toolkitsenums.h\
     
    700692                                        ./toolkits/petsc/patches/SerialToVec.cpp\
    701693                                        ./toolkits/petsc/patches/VecFree.cpp\
     694                                        ./toolkits/petsc/patches/PetscMatrixToDoubleMatrix.cpp\
     695                                        ./toolkits/petsc/patches/PetscVectorToDoubleVector.cpp\
    702696                                        ./toolkits/petsc/patches/VecDuplicatePatch.cpp\
    703697                                        ./toolkits/petsc/patches/KSPFree.cpp\
     
    722716
    723717#}}}
     718#Mpi sources  {{{1
     719mpi_sources= ./toolkits/mpi/mpiincludes.h\
     720                                ./toolkits/mpi/patches/mpipatches.h\
     721                                ./toolkits/mpi/patches/DetermineLocalSize.cpp\
     722                                ./toolkits/mpi/patches/MPI_Upperrow.cpp\
     723                                ./toolkits/mpi/patches/MPI_Lowerrow.cpp\
     724                                ./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp
     725#}}}
     726#Metis sources  {{{1
     727metis_sources= ./toolkits/metis/patches/metispatches.h\
     728                                        ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
     729#}}}
    724730#Python sources  {{{1
    725731python_sources=     ./python/io/pythonio.h\
     
    744750                                         ./matlab/io/MatlabVectorToDoubleVector.cpp\
    745751                                         ./matlab/io/MatlabMatrixToDoubleMatrix.cpp\
    746                                          ./matlab/io/MatlabMatrixToPetscMatrix.cpp\
    747                                          ./matlab/io/MatlabVectorToPetscVector.cpp\
    748                                          ./matlab/io/PetscMatrixToDoubleMatrix.cpp\
    749                                          ./matlab/io/PetscVectorToDoubleVector.cpp\
    750752                                         ./matlab/io/MatlabMatrixToSeqMat.cpp\
    751753                                         ./matlab/io/MatlabVectorToSeqVec.cpp
     754#}}}
     755#Matlab and Petsc sources  {{{1
     756matlabpetsc_sources= ./matlab/io/MatlabMatrixToPetscMatrix.cpp\
     757                                         ./matlab/io/MatlabVectorToPetscVector.cpp
     758       
    752759#}}}
    753760#Modules sources{{{1
     
    911918issm_sources +=  $(threed_sources)
    912919endif
     920
     921if MPI
     922issm_sources +=  $(mpi_sources)
     923endif
     924
     925if METIS
     926issm_sources +=  $(metis_sources)
     927endif
     928
     929if PETSC
     930if MATLAB
     931issm_sources +=  $(matlabpetsc_sources)
     932endif
     933endif
     934
     935
    913936#}}}
    914937#Library flags and sources {{{1
  • issm/trunk-jpl/src/c/matlab/io/WriteMatlabData.cpp

    r12046 r12102  
    231231                #else
    232232                matrix_ptr=matrix->matrix->ToSerial();
    233                 matrix->matrix->GetSize(&rows,cols);
     233                matrix->matrix->GetSize(&rows,&cols);
    234234                #endif
    235235
  • issm/trunk-jpl/src/c/matlab/io/matlabio.h

    r12051 r12102  
    7272int MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix);
    7373int MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix);
    74 int MatlabMatrixToPetscMatrix(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
    75 
    76 /*Matlab to Petsc routines: */
    77 int MatlabVectorToPetscVector(Vec* pvector,int* pvector_rows,const mxArray* mxvector);
    78 void PetscMatrixToDoubleMatrix(double** pmatrix, int* prows, int* pcols,Mat matrix);
    79 void PetscVectorToDoubleVector(double** pvector, int* prows, Vec vector);
    8074
    8175/*Matlab to SeqMat routines: */
     
    8377SeqVec* MatlabVectorToSeqVec(const mxArray* dataref);
    8478
     79/*Matlab to Petsc routines: */
     80#ifdef _HAVE_PETSC_
     81int MatlabMatrixToPetscMatrix(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
     82int MatlabVectorToPetscVector(Vec* pvector,int* pvector_rows,const mxArray* mxvector);
     83#endif
     84
     85
    8586#endif  /* _IO_H_ */
  • issm/trunk-jpl/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp

    r12016 r12102  
    3232        }
    3333
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
    3637        found=mpi_found;
     38        #endif
    3739
    3840        return found;
     
    9395        }
    9496
     97        #ifdef _HAVE_MPI_
    9598        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    9699        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
    97100        num_unstable_constraints=sum_num_unstable_constraints;
     101        #endif
    98102       
    99103        /*Assign output pointers: */
     
    131135       
    132136        /*Is there just one found? that would mean we have frozen! : */
     137        #ifdef _HAVE_MPI_
    133138        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_MAX,0,MPI_COMM_WORLD );
    134139        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
    135140        found=mpi_found;
     141        #endif
    136142
    137143        return found;
     
    189195        }
    190196
     197        #ifdef _HAVE_MPI_
    191198        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    192199        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
    193200        found=mpi_found;
     201        #endif
    194202
    195203        return found;
     
    220228        }
    221229
     230        #ifdef _HAVE_MPI_
    222231        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    223232        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
    224233        found=mpi_found;
     234        #endif
    225235
    226236        if (found){
     
    279289        }
    280290
     291        #ifdef _HAVE_MPI_
    281292        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    282293        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
    283294        num_unstable_constraints=sum_num_unstable_constraints;
     295        #endif
    284296       
    285297        /*Assign output pointers: */
     
    317329        }
    318330
     331        #ifdef _HAVE_MPI_
    319332        MPI_Reduce (&max_penetration,&mpi_max_penetration,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    320333        MPI_Bcast(&mpi_max_penetration,1,MPI_DOUBLE,0,MPI_COMM_WORLD);               
    321334        max_penetration=mpi_max_penetration;
     335        #endif
    322336
    323337        /*feed max_penetration to inputs: */
     
    354368        }
    355369
     370        #ifdef _HAVE_MPI_
    356371        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    357372        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
    358373        num_unstable_constraints=sum_num_unstable_constraints;
     374        #endif
    359375
    360376        return num_unstable_constraints;
  • issm/trunk-jpl/src/c/modules/ConstraintsStatex/ThermalConstraintsState.cpp

    r12016 r12102  
    3636        }
    3737
     38        #ifdef _HAVE_MPI_
    3839        MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    3940        MPI_Bcast(&sum_num_unstable_constraints,1,MPI_INT,0,MPI_COMM_WORLD);               
    4041        num_unstable_constraints=sum_num_unstable_constraints;
     42        #endif
    4143
    4244        /*Have we converged? : */
  • issm/trunk-jpl/src/c/modules/ConstraintsStatex/ThermalIsPresent.cpp

    r12016 r12102  
    2828        }
    2929       
     30        #ifdef _HAVE_MPI_
    3031        MPI_Reduce (&found,&mpi_found,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    3132        MPI_Bcast(&mpi_found,1,MPI_INT,0,MPI_COMM_WORLD);               
    3233        found=mpi_found;
     34        #endif
    3335
    3436        return found;
  • issm/trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp

    r8608 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/ElementResponsex/ElementResponsex.cpp

    r10703 r12102  
    3737
    3838        /*Broadcast whether we found the element: */
     39        #ifdef _HAVE_MPI_
    3940        MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    4041        if(!sumfound)_error_("%s%i%s","could not find material with id",index," to compute ElementResponse");
     42        #endif
    4143
    4244        /*Ok, we found the element, compute responseocity: */
     
    4648
    4749        /*Broadcast and plug into response: */
     50        #ifdef _HAVE_MPI_
    4851        MPI_Allreduce ( &cpu_found,&cpu_found,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    4952        MPI_Bcast(&response,1,MPI_DOUBLE,cpu_found,MPI_COMM_WORLD);
     53        #endif
    5054
    5155        *presponse=response;
  • issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r11695 r12102  
    156156                vec_nodes_on_floatingice->Assemble();
    157157               
     158                #ifdef _HAVE_MPI_
    158159                MPI_Allreduce(&local_nflipped,&nflipped,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    159160                _printf_(VerboseConvergence(),"   Additional number of vertices allowed to unground: %i\n",nflipped);
     161                #else
     162                nflipped=local_nflipped;
     163                #endif
    160164
    161165                /*Avoid leaks: */
  • issm/trunk-jpl/src/c/modules/IceVolumex/IceVolumex.cpp

    r9880 r12102  
    1919                local_ice_volume+=element->IceVolume();
    2020        }
     21        #ifdef _HAVE_MPI_
    2122        MPI_Reduce(&local_ice_volume,&total_ice_volume,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    2223        MPI_Bcast(&total_ice_volume,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     24        #else
     25        total_ice_volume=local_ice_volume;
     26        #endif
    2327
    2428        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/InputConvergencex/InputConvergencex.cpp

    r12016 r12102  
    3030
    3131        /*In parallel, we need to gather the converged status: */
     32        #ifdef _HAVE_MPI_
    3233        MPI_Allreduce ( (void*)&num_notconverged,(void*)&total_notconverged,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    3334        num_notconverged=total_notconverged;
     35        #endif
    3436        _printf_(VerboseConvergence(),"      #elements above convergence criterion = %i\n",num_notconverged);
    3537
  • issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp

    r12016 r12102  
    5959        }
    6060
     61        #ifdef _HAVE_MPI_
    6162        MPI_Allreduce ( (void*)&mass_flux,(void*)&all_mass_flux,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
    6263        mass_flux=all_mass_flux;
     64        #endif
    6365
    6466        /*Free ressources:*/
  • issm/trunk-jpl/src/c/modules/MaxAbsVxx/MaxAbsVxx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out maximum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&maxabsvx,&node_maxabsvx,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_maxabsvx,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3637        maxabsvx=node_maxabsvx;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MaxAbsVyx/MaxAbsVyx.cpp

    r12016 r12102  
    3333
    3434        /*Figure out maximum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3536        MPI_Reduce (&maxabsvy,&node_maxabsvy,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3637        MPI_Bcast(&node_maxabsvy,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3738        maxabsvy=node_maxabsvy;
     39        #endif
    3840
    3941        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MaxAbsVzx/MaxAbsVzx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&maxabsvz,&node_maxabsvz,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_maxabsvz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3637        maxabsvz=node_maxabsvz;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MaxVelx/MaxVelx.cpp

    r12016 r12102  
    3333
    3434        /*Figure out maximum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3536        MPI_Reduce (&maxvel,&node_maxvel,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3637        MPI_Bcast(&node_maxvel,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3738        maxvel=node_maxvel;
     39        #endif
    3840
    3941        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MaxVxx/MaxVxx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&maxvx,&node_maxvx,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_maxvx,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3637        maxvx=node_maxvx;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MaxVyx/MaxVyx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&maxvy,&node_maxvy,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_maxvy,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3637        maxvy=node_maxvy;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MaxVzx/MaxVzx.cpp

    r12016 r12102  
    3333
    3434        /*Figure out minimum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3536        MPI_Reduce (&maxvz,&node_maxvz,1,MPI_DOUBLE,MPI_MAX,0,MPI_COMM_WORLD );
    3637        MPI_Bcast(&node_maxvz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3738        maxvz=node_maxvz;
     39        #endif
    3840
    3941        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MeshPartitionx/MeshPartitionx.cpp

    r10000 r12102  
    4242                /*Partition using Metis:*/
    4343                if (num_procs>1){
     44                        #ifdef _HAVE_METIS_
    4445                        METIS_PartMeshNodalPatch(&numberofelements,&numberofnodes, index, &etype, &numflag, &num_procs, &edgecut, epart, npart);
     46                        #endif
    4547                }
    4648                else if (num_procs==1){
     
    6769                /*Partition using Metis:*/
    6870                if (num_procs>1){
     71                        #ifdef _HAVE_METIS_
    6972                        METIS_PartMeshNodalPatch(&numberofelements2d,&numberofnodes2d, index2d, &etype2d, &numflag, &num_procs, &edgecut, epart2d, npart2d);
     73                        #endif
    7074                }
    7175                else if (num_procs==1){
  • issm/trunk-jpl/src/c/modules/MinVelx/MinVelx.cpp

    r12016 r12102  
    3333
    3434        /*Figure out minimum across the cluster: */
     35        #ifdef _HAVE_MPI_
    3536        MPI_Reduce (&minvel,&node_minvel,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3637        MPI_Bcast(&node_minvel,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3738        minvel=node_minvel;
     39        #endif
    3840
    3941        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MinVxx/MinVxx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&minvx,&node_minvx,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_minvx,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3637        minvx=node_minvx;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MinVyx/MinVyx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&minvy,&node_minvy,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_minvy,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3637        minvy=node_minvy;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/MinVzx/MinVzx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&minvz,&node_minvz,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_minvz,1,MPI_DOUBLE,0,MPI_COMM_WORLD);   
    3637        minvz=node_minvz;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/modules/NodalValuex/NodalValuex.cpp

    r9206 r12102  
    3636
    3737        /*Broadcast whether we found the element: */
     38        #ifdef _HAVE_MPI_
    3839        MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    3940        if(!sumfound)_error_("%s%i%s%s","could not find element with vertex with id",index," to compute nodal value ",EnumToStringx(natureofdataenum));
     41        #endif
    4042
    4143        /*Broadcast and plug into response: */
     44        #ifdef _HAVE_MPI_
    4245        MPI_Allreduce ( &cpu_found,&cpu_found,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    4346        MPI_Bcast(&value,1,MPI_DOUBLE,cpu_found,MPI_COMM_WORLD);
     47        #else
     48        value=cpu_found;
     49        #endif
    4450
    4551        *pnodalvalue=value;
  • issm/trunk-jpl/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp

    r12016 r12102  
    9393
    9494        /*Ok, broadcast to other cpus: */
     95        #ifdef _HAVE_MPI_
    9596        MPI_Bcast(&numanalyses,1,MPI_INT,0,MPI_COMM_WORLD);
    9697        if(my_rank!=0){
     
    99100        }
    100101        MPI_Bcast(analyses,numanalyses,MPI_DOUBLE,0,MPI_COMM_WORLD);
     102        #endif
    101103        for(i=0;i<numanalyses;i++){
    102104                char* string=strings[i];
     
    105107                }
    106108                if(my_rank==0)stringlength=(strlen(string)+1)*sizeof(char);
     109                #ifdef _HAVE_MPI_
    107110                MPI_Bcast(&stringlength,1,MPI_INT,0,MPI_COMM_WORLD);
    108111                if(my_rank!=0)string=(char*)xmalloc(stringlength);
    109112                MPI_Bcast(string,stringlength,MPI_CHAR,0,MPI_COMM_WORLD);
    110113                if(my_rank!=0)strings[i]=string;
     114                #endif
    111115        }
    112116
  • issm/trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp

    r8608 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp

    r8607 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/SurfaceAreax/SurfaceAreax.cpp

    r5414 r12102  
    2828
    2929        /*Sum all J from all cpus of the cluster:*/
    30         MPI_Reduce (&S,&S_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
     30        #ifdef _HAVE_MPI_
     31        MPI_Reduce (&S,&S_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3132        MPI_Bcast(&S_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3233        S=S_sum;
     34        #endif
    3335
    3436        /*add surface area to element inputs:*/
  • issm/trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp

    r8607 r12102  
    3131
    3232        /*Sum all J from all cpus of the cluster:*/
     33        #ifdef _HAVE_MPI_
    3334        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3435        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3536        J=J_sum;
     37        #endif
    3638
    3739        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp

    r8607 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp

    r8607 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp

    r8607 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/ThicknessAbsGradientx/ThicknessAbsGradientx.cpp

    r8608 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp

    r8607 r12102  
    2727
    2828        /*Sum all J from all cpus of the cluster:*/
     29        #ifdef _HAVE_MPI_
    2930        MPI_Reduce (&J,&J_sum,1,MPI_DOUBLE,MPI_SUM,0,MPI_COMM_WORLD );
    3031        MPI_Bcast(&J_sum,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3132        J=J_sum;
     33        #endif
    3234
    3335        /*Assign output pointers: */
  • issm/trunk-jpl/src/c/modules/TimeAdaptx/TimeAdaptx.cpp

    r12016 r12102  
    3232
    3333        /*Figure out minimum across the cluster: */
     34        #ifdef _HAVE_MPI_
    3435        MPI_Reduce (&min_dt,&node_min_dt,1,MPI_DOUBLE,MPI_MIN,0,MPI_COMM_WORLD );
    3536        MPI_Bcast(&node_min_dt,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    3637        min_dt=node_min_dt;
     38        #endif
    3739
    3840        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/objects/Bamg/Metric.h

    r9690 r12102  
    55#include "../../shared/Bamg/shared.h"
    66#include "R2.h"
     7#include <math.h>
    78
    89namespace bamg {
  • issm/trunk-jpl/src/c/objects/IoModel.cpp

    r10390 r12102  
    198198                                /*Ok, we have reached the end of the file. break: */
    199199                                record_code=0; //0 means bailout
     200                                #ifdef _HAVE_MPI_
    200201                                MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);  /*tell others cpus we are bailing: */
     202                                #endif
    201203                                break;
    202204                        }
     
    207209                                fread(&record_code,sizeof(int),1,this->fid);
    208210                                       
     211                                #ifdef _HAVE_MPI_
    209212                                /*Tell other cpus what we are doing: */
    210213                                MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);  /*tell other cpus what we are going to do: */
     
    213216                                MPI_Bcast(&record_enum,1,MPI_INT,0,MPI_COMM_WORLD); 
    214217                                MPI_Bcast(&record_length,1,MPI_INT,0,MPI_COMM_WORLD); 
     218                                #endif
    215219                               
    216 
    217220                                switch(record_code){
    218221                                        case 1:
    219222                                                /*Read the boolean and broadcast it to other cpus:*/
    220223                                                if(fread(&booleanint,sizeof(int),1,this->fid)!=1) _error_(" could not read boolean ");
     224                                                #ifdef _HAVE_MPI_
    221225                                                MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     226                                                #endif
    222227
    223228                                                /*create BoolParam: */
     
    228233                                                /*Read the integer and broadcast it to other cpus:*/
    229234                                                if(fread(&integer,sizeof(int),1,this->fid)!=1) _error_(" could not read integer ");
     235                                                #ifdef _HAVE_MPI_
    230236                                                MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     237                                                #endif
    231238
    232239                                                /*create IntParam: */
     
    237244                                                /*Read the scalar and broadcast it to other cpus:*/
    238245                                                if(fread(&scalar,sizeof(double),1,this->fid)!=1) _error_(" could not read scalar ");
     246                                                #ifdef _HAVE_MPI_
    239247                                                MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     248                                                #endif
    240249
    241250                                                /*create DoubleParam: */
     
    246255                                                /*We have to read a string from disk. First read the dimensions of the string, then the string: */
    247256                                                if(fread(&string_size,sizeof(int),1,this->fid)!=1) _error_(" could not read length of string ");
     257                                                #ifdef _HAVE_MPI_
    248258                                                MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     259                                                #endif
    249260
    250261                                                if(string_size){
     
    254265                                                        /*Read string, then broadcast: */
    255266                                                        if(fread(string,string_size*sizeof(char),1,this->fid)!=1)_error_("  could not read string ");
     267                                                        #ifdef _HAVE_MPI_
    256268                                                        MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     269                                                        #endif
    257270                                                }
    258271                                                else{
     
    308321                }
    309322        } //}}}
     323        #ifdef _HAVE_MPI_
    310324        else{ //cpu ~0 {{{2
    311325                for(;;){ //wait on cpu 0
     
    377391                }
    378392        } //}}}
     393        #endif
    379394}
    380395/*}}}*/
     
    399414                if(fread(&booleanint,sizeof(int),1,fid)!=1) _error_(" could not read boolean ");
    400415        }
     416        #ifdef _HAVE_MPI_
    401417        MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD);
     418        #endif
    402419
    403420        /*cast to bool: */
     
    428445        }
    429446
     447        #ifdef _HAVE_MPI_
    430448        MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD);
     449        #endif
    431450
    432451        /*Assign output pointers: */
     
    456475                if(fread(&scalar,sizeof(double),1,fid)!=1)_error_(" could not read scalar ");
    457476        }
     477        #ifdef _HAVE_MPI_
    458478        MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
     479        #endif
    459480
    460481        /*Assign output pointers: */
     
    487508        }
    488509
     510        #ifdef _HAVE_MPI_
    489511        MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     512        #endif
    490513
    491514        /*Now allocate string: */
     
    498521                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
    499522                }
     523                #ifdef _HAVE_MPI_
    500524                MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     525                #endif
    501526        }
    502527        else{
     
    538563        }
    539564
     565        #ifdef _HAVE_MPI_
    540566        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     567        #endif
    541568
    542569        if(my_rank==0){ 
    543570                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    544571        }
    545         MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     572        #ifdef _HAVE_MPI_
     573        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     574        #endif
    546575
    547576        /*Now allocate matrix: */
     
    554583                }
    555584               
     585                #ifdef _HAVE_MPI_
    556586                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     587                #endif
    557588        }
    558589
     
    602633                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    603634        }
     635        #ifdef _HAVE_MPI_
    604636        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     637        #endif
    605638
    606639        if(my_rank==0){ 
    607640                if(fread(&N,sizeof(int),1,fid)!=1) _error_("could not read number of columns for matrix ");
    608641        }
     642        #ifdef _HAVE_MPI_
    609643        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     644        #endif
    610645
    611646        /*Now allocate matrix: */
     
    617652                        if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix ");
    618653                }
     654                #ifdef _HAVE_MPI_
    619655                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     656                #endif
    620657        }
    621658
     
    652689                if(fread(&numstrings,sizeof(int),1,fid)!=1) _error_(" could not read length of string array");
    653690        }
     691        #ifdef _HAVE_MPI_
    654692        MPI_Bcast(&numstrings,1,MPI_INT,0,MPI_COMM_WORLD);
     693        #endif
    655694
    656695        /*Now allocate string array: */
     
    665704                                if(fread(&string_size,sizeof(int),1,fid)!=1) _error_(" could not read length of string ");
    666705                        }
     706                        #ifdef _HAVE_MPI_
    667707                        MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD);
     708                        #endif
    668709                        if(string_size){
    669710                                string=(char*)xmalloc((string_size+1)*sizeof(char));
     
    674715                                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_("  could not read string ");
    675716                                }
     717                                #ifdef _HAVE_MPI_
    676718                                MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD);
     719                                #endif
    677720                        }
    678721                        else{
     
    717760                if(fread(&numrecords,sizeof(int),1,fid)!=1) _error_("could not read number of records in matrix array ");
    718761        }
     762        #ifdef _HAVE_MPI_
    719763        MPI_Bcast(&numrecords,1,MPI_INT,0,MPI_COMM_WORLD);
     764        #endif
    720765
    721766        if(numrecords){
     
    738783                                if(fread(&M,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of rows in ",i,"th matrix of matrix array");
    739784                        }
     785                        #ifdef _HAVE_MPI_
    740786                        MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD);
     787                        #endif
    741788
    742789                        if(my_rank==0){ 
    743790                                if(fread(&N,sizeof(int),1,fid)!=1) _error_("%s%i%s","could not read number of columns in ",i,"th matrix of matrix array");
    744791                        }
     792                        #ifdef _HAVE_MPI_
    745793                        MPI_Bcast(&N,1,MPI_INT,0,MPI_COMM_WORLD);
     794                        #endif
    746795
    747796                        /*Now allocate matrix: */
     
    754803                                }
    755804
     805                                #ifdef _HAVE_MPI_
    756806                                MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD);
     807                                #endif
    757808                        }
    758809
     
    10471098                }
    10481099        }
     1100        #ifdef _HAVE_MPI_
    10491101        MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD);
    10501102        if(!found)_error_("%s %s ","could not find data with name",EnumToStringx(data_enum));
     1103        #endif
    10511104
    10521105        /*Broadcast code and vector type: */
     1106        #ifdef _HAVE_MPI_
    10531107        MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD);
    10541108        MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
    10551109        if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD);
     1110        #endif
    10561111
    10571112        /*Assign output pointers:*/
  • issm/trunk-jpl/src/c/objects/Patch.cpp

    r12014 r12102  
    120120        int         node_numrows;
    121121        double     *total_values  = NULL;
     122        #ifdef _HAVE_MPI_
    122123        MPI_Status  status;
     124        #endif
    123125
    124126        /*First, figure out total number of rows combining all the cpus: */
     127        #ifdef _HAVE_MPI_
    125128        MPI_Reduce(&this->numrows,&total_numrows,1,MPI_INT,MPI_SUM,0,MPI_COMM_WORLD );
    126129        MPI_Bcast(&total_numrows,1,MPI_INT,0,MPI_COMM_WORLD);
     130        #else
     131        total_numrows=this->numrows;
     132        #endif
    127133
    128134        /*return if patch empty*/
     
    140146
    141147        /*Now, ask other nodes to send their values: */
     148        #ifdef _HAVE_MPI_
    142149        for (i=1;i<num_procs;i++){
    143150                if (my_rank==i){
     
    151158                }
    152159        }       
     160        #endif
    153161
    154162        /*Now, node 0 has total_values, of size total_numrows*this->numcols. Update the fields in the patch, to reflect this new
     
    159167                this->values=total_values;
    160168        }
     169        #ifdef _HAVE_MPI_
    161170        else{
    162171                this->numrows=0;
    163172                xfree((void**)&this->values);
    164173        }
     174        #endif
    165175}/*}}}*/
  • issm/trunk-jpl/src/c/solutions/issm.cpp

    r12022 r12102  
    4242        if(ierr) _error_("Could not initialize Petsc");
    4343        #else
     44        #ifdef _HAVE_MPI_
    4445        MPI_Init(&argc,&argv);
    4546        #endif
     47        #endif
    4648
     49        #ifdef _HAVE_MPI_
    4750        MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime();
     51        #else
     52        start=(double)clock();
     53        #endif
    4854
    4955        /*Size and rank: */
     56        #ifdef _HAVE_MPI_
    5057        MPI_Comm_rank(MPI_COMM_WORLD,&my_rank); 
    5158        MPI_Comm_size(MPI_COMM_WORLD,&num_procs);
     59        #endif
    5260
    5361        /*First process inputs*/
     
    6270       
    6371        /*Create femmodel, using input file: */
     72        #ifdef _HAVE_MPI_
    6473        MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime();
     74        #else
     75        start_init=(double)clock();
     76        #endif
    6577        femmodel=new FemModel(binfilename,outbinfilename,solution_type,analyses,numanalyses);
    6678       
     
    8294        femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
    8395        femmodel->parameters->FindParam(&tao_analysis,InversionTaoEnum);
     96        #ifdef _HAVE_MPI_
    8497        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
     98        #else
     99        finish_init=(double)clock();
     100        #endif
    85101
    86102        _printf_(true,"call computational core:\n");
     103        #ifdef _HAVE_MPI_
    87104        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
     105        #else
     106        start_core=(double)clock();
     107        #endif
     108       
    88109        if(dakota_analysis){
    89110                #ifdef _HAVE_DAKOTA_
     
    106127                solutioncore(femmodel);
    107128        }
     129        #ifdef _HAVE_MPI_
    108130        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    109 
     131        #else
     132        finish_core=(double)clock();
     133        #endif
     134       
    110135        _printf_(true,"write results to disk:\n");
    111136        OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
     
    127152
    128153        /*Get finish time and close*/
     154        #ifdef _HAVE_MPI_
    129155        MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( );
    130156        _printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",finish_init-start_init);
    131157        _printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",finish_core-start_core);
    132158        _printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600),int(int(finish-start)%3600/60),int(finish-start)%60);
     159        #else
     160        finish=(double)clock();
     161        _printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",(finish_init-start_init)/CLOCKS_PER_SEC);
     162        _printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",(finish_core-start_core)/CLOCKS_PER_SEC);
     163        _printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600/CLOCKS_PER_SEC),int(int((finish-start)/CLOCKS_PER_SEC)%3600/60),(int(finish-start)/CLOCKS_PER_SEC)%60);
     164        #endif
    133165       
     166               
    134167       
     168        #ifdef _HAVE_PETSC_
    135169        _printf_(true,"closing MPI and Petsc\n");
    136         #ifdef _HAVE_PETSC_
    137170        PetscFinalize();
    138171        #else
     172        #ifdef _HAVE_MPI_
     173        _printf_(true,"closing MPI and Petsc\n");
    139174        MPI_Finalize();
     175        #endif
    140176        #endif
    141177       
  • issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscMatrixToDoubleMatrix.cpp

    r12101 r12102  
    1010#endif
    1111
     12#include <string>
    1213
    1314/*Petsc includes: */
     
    1718
    1819/*Petsc includes: */
    19 #include "mex.h"
    20 
    21 #include "../../shared/shared.h"
    22 #include <string>
     20#include "../../../shared/shared.h"
    2321
    2422
  • issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscVectorToDoubleVector.cpp

    r12101 r12102  
    88#endif
    99
     10#include <string>
     11
    1012/*Petsc includes: */
    1113#include "petscmat.h"
     
    1315#include "petscksp.h"
    1416
    15 #include "mex.h"
    16 #include "../../shared/shared.h"
    17 #include <string>
     17#include "../../../shared/shared.h"
    1818
    1919void PetscVectorToDoubleVector(double** pvector, int* prows, Vec petsc_vector){
     
    2323        int    *idxm   = NULL;
    2424        double *vector = NULL;
    25 
    26         /*output: */
    27         mxArray* dataref=NULL;
    2825
    2926        /*Get size of vector: */
  • issm/trunk-jpl/src/c/toolkits/toolkits.h

    r12017 r12102  
    2020#endif
    2121
     22#ifdef _HAVE_MPI_
    2223#include "./mpi/mpiincludes.h"
     24#endif
     25
     26#ifdef _HAVE_METIS_
    2327#include "./metis/metisincludes.h"
     28#endif
     29
    2430#include "./triangle/triangleincludes.h"
    2531#include "./toolkitsenums.h"
  • issm/trunk-jpl/startup.py

    r12066 r12102  
    8282from miscellaneous import *
    8383from private import *
     84from triangle import *
    8485
    8586#}}}
  • issm/trunk-jpl/test/NightlyRun/test101.py

    r12047 r12102  
    11from model import *
    22from TriMesh import *
     3from triangle import *
    34
    4 #md=model()
    5 #md=triangle(md,'../Exp/Square.exp',150000);
     5md=model()
     6md=triangle(md,'../Exp/Square.exp',150000);
    67
    7 [index,x,y,segments,segmentmarkers]=TriMesh('../Exp/Square.exp',15000.0**2.0,True)
    8 print(index,x,y,segments,segmentmarkers)
     8#[index,x,y,segments,segmentmarkers]=TriMesh('../Exp/Square.exp',15000.0**2.0,True)
     9#print(index,x,y,segments,segmentmarkers)
Note: See TracChangeset for help on using the changeset viewer.