mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-10-31 12:04:33 +00:00 
			
		
		
		
	Deterministic homebrew reduction
This commit is contained in:
		| @@ -128,6 +128,34 @@ public: | |||||||
|   void GlobalXOR(uint32_t &); |   void GlobalXOR(uint32_t &); | ||||||
|   void GlobalXOR(uint64_t &); |   void GlobalXOR(uint64_t &); | ||||||
|    |    | ||||||
|  |   template<class obj> void GlobalSumP2P(obj &o) | ||||||
|  |   { | ||||||
|  |     std::vector<obj> column; | ||||||
|  |     obj accum = o; | ||||||
|  |     int source,dest; | ||||||
|  |     for(int d=0;d<_ndimension;d++){ | ||||||
|  |       column.resize(_processors[d]); | ||||||
|  |       column[0] = accum; | ||||||
|  |       std::vector<CommsRequest_t> list; | ||||||
|  |       for(int p=1;p<_processors[d];p++){ | ||||||
|  | 	ShiftedRanks(d,p,source,dest); | ||||||
|  | 	SendToRecvFromBegin(list, | ||||||
|  | 			    &column[0], | ||||||
|  | 			    dest, | ||||||
|  | 			    &column[p], | ||||||
|  | 			    source, | ||||||
|  | 			    sizeof(obj),d*100+p); | ||||||
|  |  | ||||||
|  |       } | ||||||
|  |       CommsComplete(list); | ||||||
|  |       for(int p=1;p<_processors[d];p++){ | ||||||
|  | 	accum = accum + column[p]; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     Broadcast(0,accum); | ||||||
|  |     o=accum; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   template<class obj> void GlobalSum(obj &o){ |   template<class obj> void GlobalSum(obj &o){ | ||||||
|     typedef typename obj::scalar_type scalar_type; |     typedef typename obj::scalar_type scalar_type; | ||||||
|     int words = sizeof(obj)/sizeof(scalar_type); |     int words = sizeof(obj)/sizeof(scalar_type); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user