LAMA
|
00001 00033 #ifndef LAMA_NO_COMMUNICATOR_HPP_ 00034 #define LAMA_NO_COMMUNICATOR_HPP_ 00035 00036 // for dll_import 00037 #include <lama/config.hpp> 00038 00039 00040 // base classes 00041 #include <lama/Communicator.hpp> 00042 00043 // boost 00044 #include <boost/weak_ptr.hpp> 00045 00046 namespace lama 00047 { 00048 00053 class LAMA_DLL_IMPORTEXPORT NoCommunicator: public Communicator 00054 { 00055 public: 00056 00057 NoCommunicator(); 00058 00059 virtual ~NoCommunicator(); 00060 00061 virtual bool isEqual(const Communicator& other) const; 00062 00063 virtual ThreadSafetyLevel getThreadSafetyLevel() const; 00064 00065 virtual PartitionId getSize() const; 00066 00067 virtual PartitionId getRank() const; 00068 00069 virtual void all2all( int* recvValues, const int* sendValues ) const; 00070 00071 virtual void exchangeByPlan( 00072 int* const recvData, 00073 const CommunicationPlan& recvPlan, 00074 const int* const sendData, 00075 const CommunicationPlan& sendPlan ) const; 00076 00077 virtual void exchangeByPlan( 00078 float* const recvData, 00079 const CommunicationPlan& recvPlan, 00080 const float* const sendData, 00081 const CommunicationPlan& sendPlan ) const; 00082 00083 virtual void exchangeByPlan( 00084 double* const recvData, 00085 const CommunicationPlan& recvPlan, 00086 const double* const sendData, 00087 const CommunicationPlan& sendPlan ) const; 00088 00089 virtual std::auto_ptr<SyncToken> exchangeByPlanAsync( 00090 int* const recvData, 00091 const CommunicationPlan& recvPlan, 00092 const int* const sendData, 00093 const CommunicationPlan& sendPlan ) const; 00094 00095 virtual std::auto_ptr<SyncToken> exchangeByPlanAsync( 00096 float* const recvData, 00097 const CommunicationPlan& recvPlan, 00098 const float* const sendData, 00099 const CommunicationPlan& sendPlan ) const; 00100 00101 virtual std::auto_ptr<SyncToken> exchangeByPlanAsync( 00102 double* const recvData, 00103 const CommunicationPlan& recvPlan, 00104 const double* const sendData, 00105 const CommunicationPlan& sendPlan ) const; 00106 00107 virtual IndexType shift( double targetVals[], const IndexType targetSize, 00108 const double sourceVals[], const IndexType oldSize, 00109 const int direction ) const; 00110 00111 virtual IndexType shift( float targetVals[], const IndexType targetSize, 00112 const float sourceVals[], const IndexType oldSize, 00113 const int direction ) const; 00114 00115 virtual IndexType shift( int targetVals[], const IndexType targetSize, 00116 const int sourceVals[], const IndexType oldSize, 00117 const int direction ) const; 00118 00119 virtual void bcast (double val[], const IndexType n, const PartitionId root) const; 00120 virtual void bcast (float val[], const IndexType n, const PartitionId root) const; 00121 virtual void bcast (int val[], const IndexType n, const PartitionId root) const; 00122 00123 virtual void scatter (double myvals[], const IndexType n, const PartitionId root, const double allvals[]) const; 00124 virtual void scatter (float myvals[], const IndexType n, const PartitionId root, const float allvals[]) const; 00125 virtual void scatter (int myvals[], const IndexType n, const PartitionId root, const int allvals[]) const; 00126 00127 virtual void scatter (double myvals[], const IndexType n, const PartitionId root, 00128 const double allvals[], const IndexType sizes[]) const; 00129 virtual void scatter (float myvals[], const IndexType n, const PartitionId root, 00130 const float allvals[], const IndexType sizes[]) const; 00131 virtual void scatter (int myvals[], const IndexType n, const PartitionId root, 00132 const int allvals[], const IndexType sizes[]) const; 00133 00134 virtual void gather (double allvals[], const IndexType n, const PartitionId root, const double myvals[]) const; 00135 virtual void gather (float allvals[], const IndexType n, const PartitionId root, const float myvals[]) const; 00136 virtual void gather (int allvals[], const IndexType n, const PartitionId root, const int myvals[]) const; 00137 00138 virtual void gather (double allvals[], const IndexType n, const PartitionId root, 00139 const double myvals[], const IndexType sizes[]) const; 00140 virtual void gather (float allvals[], const IndexType n, const PartitionId root, 00141 const float myvals[], const IndexType sizes[]) const; 00142 virtual void gather (int allvals[], const IndexType n, const PartitionId root, 00143 const int myvals[], const IndexType sizes[]) const; 00144 00145 virtual float sum(const float value) const; 00146 00147 virtual double sum(const double value) const; 00148 00149 virtual int sum(const int value) const; 00150 00151 virtual size_t sum(const size_t value) const; 00152 00153 virtual float min(const float value) const; 00154 00155 virtual float max(const float value) const; 00156 00157 virtual double min(const double value) const; 00158 00159 virtual double max(const double value) const; 00160 00161 virtual int min(const int value) const; 00162 00163 virtual int max(const int value) const; 00164 00165 virtual void maxloc( double& val, int& location, const PartitionId root ) const; 00166 virtual void maxloc( float& val, int& location, const PartitionId root ) const; 00167 virtual void maxloc( int& val, int& location, const PartitionId root ) const; 00168 00169 virtual void swap( double val[], const IndexType n, const PartitionId partner ) const; 00170 virtual void swap( float val[], const IndexType n, const PartitionId partner ) const; 00171 virtual void swap( int val[], const IndexType n, const PartitionId partner ) const; 00172 00173 virtual void gather(std::vector<float>& values, float value) const; 00174 00175 virtual void synchronize() const; 00176 00177 virtual void writeAt( std::ostream& stream ) const; 00178 00179 private: 00180 00181 // common implementation for self exchange, uses size of datatype 00182 00183 void exchangeByPlanImpl( 00184 void* const recvData, 00185 const CommunicationPlan& recvPlan, 00186 const void* const sendData, 00187 const CommunicationPlan& sendPlan, 00188 int elemSize ) const; 00189 00190 virtual ContextPtr getCommunicationContext() const; 00191 00192 }; 00193 00194 } 00195 00196 #endif // LAMA_NO_COMMUNICATOR_HPP_