diff options
author | John Langford <jl@hunch.net> | 2011-06-24 06:08:14 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2011-06-24 06:08:14 +0400 |
commit | 2f623c4fe2aa664bcd3145ca6e0ec8e0bd1f05a3 (patch) | |
tree | bccf35ad6b1adf3fd4d71e14cf18fcd104cc5dad /allreduce.cc | |
parent | 0454c2131c54278010a0bef49d86f730dea3255a (diff) |
initiall cluster parallel CG code
Diffstat (limited to 'allreduce.cc')
-rw-r--r-- | allreduce.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/allreduce.cc b/allreduce.cc index 02000a25..a791ed58 100644 --- a/allreduce.cc +++ b/allreduce.cc @@ -1,3 +1,12 @@ +/* +Copyright (c) 2011 Yahoo! Inc. All rights reserved. The copyrights +embodied in the content of this file are licensed under the BSD +(revised) open source license + +This implements the allreduce function of MPI. Code primarily by +Alekh Agarwal and John Langford, with help Olivier Chapelle. + + */ #include <iostream> #include <cstdio> #include <cmath> @@ -384,20 +393,8 @@ void broadcast(char* buffer, int n, int parent_sock, int* child_sockets) { void all_reduce(char* buffer, int n, node_socks socks) { - //cout<<"Sum before reduce = "<<add((float*)buffer,n/sizeof(float))<<endl; - //cerr<<"before reduce "; - //printfloat((float*)buffer,n/sizeof(float)); - //printchar(buffer,n); reduce(buffer, n, socks.parent, socks.children); - //cerr<<"Done reducing: sum = "<<add((float*)buffer,n/sizeof(float))<<endl; - //cout<<"after reduce "; - //printfloat((float*)buffer,n/sizeof(float)); - //printchar(buffer,n); broadcast(buffer, n, socks.parent, socks.children); - //cout<<"after broadcast "; - //printfloat((float*)buffer,n/sizeof(float)); - //printchar(buffer,n); - //cerr<<"Done broadcasting: sum = "<<add((float*)buffer,n/sizeof(float))<<endl; } void all_reduce_close(node_socks socks) |