Parallel.cpp

00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00009 #include <stk_util/parallel/Parallel.hpp>
00010 
00011 /*--------------------------------------------------------------------*/
00012 /* Parallel operations */
00013 
00014 #if defined( STK_HAS_MPI )
00015 
00016 namespace stk {
00017 
00018 unsigned parallel_machine_size( ParallelMachine parallel_machine )
00019 {
00020   int value = 0 ;
00021   if ( MPI_SUCCESS != MPI_Comm_size( parallel_machine , &value ) ) { value = 0 ; }
00022   return value ;
00023 }
00024 
00025 unsigned parallel_machine_rank( ParallelMachine parallel_machine )
00026 {
00027   int value = 0 ;
00028   if ( MPI_SUCCESS != MPI_Comm_rank( parallel_machine , &value ) ) { value = 0 ; }
00029   return value ;
00030 }
00031 
00032 void parallel_machine_barrier( ParallelMachine parallel_machine )
00033 {
00034   MPI_Barrier( parallel_machine );
00035 }
00036 
00037 }
00038 
00039 #else
00040 
00041 namespace stk {
00042 
00043 unsigned parallel_machine_size( ParallelMachine parallel_machine) { return 1 ; }
00044 
00045 unsigned parallel_machine_rank( ParallelMachine parallel_machine) { return 0 ; }
00046 
00047 void parallel_machine_barrier( ParallelMachine parallel_machine) {}
00048 
00049 }
00050 
00051 #endif
00052 
00053 /*--------------------------------------------------------------------*/
00054 
00055 

Generated on Tue Jul 13 09:27:32 2010 for Sierra Toolkit by  doxygen 1.4.7