forked from BVLC/caffe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_parallel.cpp
More file actions
68 lines (57 loc) · 1.87 KB
/
Copy pathtest_parallel.cpp
File metadata and controls
68 lines (57 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <cstring>
#include "gtest/gtest.h"
#include "caffe/parallel.hpp"
#include "caffe/test/test_caffe_main.hpp"
namespace caffe {
template<typename Dtype>
class DistSyncTest: public ::testing::Test {
};
TYPED_TEST_CASE(DistSyncTest, TestDtypes);
TYPED_TEST(DistSyncTest, TestNothing) {
// The first test case of a test suite takes the longest time
// due to the set up overhead.
}
//TYPED_TEST(DistSyncTest, TestMasterIndex) {
// vector<shared_ptr<Blob<TypeParam> > > blobs();
// blobs.push_back(new shared_ptr(new Blob<TypeParam>(1, 1, 1, 1)));
// Params params(blobs);
//
// vector<int> nodes();
// nodes.push_back(0);
// nodes.push_back(1);
// nodes.push_back(2);
// nodes.push_back(3);
//
// uint32_t chunks = 1000;
// for(int index = 0; index < nodes.size(); ++index) {
// DistSync<TypeParam, int> sync(params, nodes, nodes, chunks);
// sync.Init(index);
//
// for(uint32_t chunk = 0; chunk < chunks; ++chunk)
// EXPECT(
// (sync.master(chunk) == index)
// ==
// (chunk >= sync.own_start_ && chunk < sync.own_until_));
// }
//}
// test buffers are the same
//bool ready = true;
//for (int i = 0; i < solvers.size(); ++i)
// if (!solvers[i])
// ready = false;
//if (ready) {
// for (int i = 0; i < solvers.size(); ++i) {
// shared_ptr<Net<float> > n0 = solvers[0]->net();
// shared_ptr<Net<float> > ni = solvers[i]->net();
// vector<shared_ptr<Blob<float> > >& p0 = n0->params();
// vector<shared_ptr<Blob<float> > >& pi = ni->params();
// for (int j = 0; j < p0.size(); ++j)
// CHECK(pi[j]->cpu_data() == p0[j]->cpu_data());
// }
// shared_ptr<Net<float> > n0 = solvers_[0]->net();
// vector<shared_ptr<Blob<float> > >& p0 = n0->params();
// for (int j = 0; j < p0.size(); ++j)
// for (int k = 0; k < p0[j]->count(); ++k)
// CHECK(!isnan(p0[j]->cpu_data()[k])) << " NAN";
//}
} // namespace caffe