Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

Commit 30a7caa

Browse files
committed
update
1 parent c6f8290 commit 30a7caa

File tree

7 files changed

+5
-103
lines changed

7 files changed

+5
-103
lines changed

3rdparty/include/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
glog/
21
google/

copydeps.bat

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
mkdir 3rdparty\include\glog
2-
copy 3rdparty\src\glog\src\windows\glog 3rdparty\include\glog
3-
copy 3rdparty\src\glog\Debug\libglog.lib 3rdparty\lib\libglogd.lib
4-
copy 3rdparty\src\glog\Release\libglog.lib 3rdparty\lib\libglog.lib
5-
copy 3rdparty\src\glog\Release\libglog.dll 3rdparty\bin\libglog.dll
6-
71
call 3rdparty\src\protobuf\cmake\build\extract_includes.bat
82
move include\google 3rdparty\include\
93
copy 3rdparty\src\protobuf\cmake\build\Debug\libprotobuf.lib 3rdparty\lib\libprotobufd.lib

include/caffe/blob.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,9 @@ class Blob {
218218

219219
const Dtype* cpu_data() const;
220220
void set_cpu_data(Dtype* data);
221-
const int* gpu_shape() const;
222-
const Dtype* gpu_data() const;
223221
const Dtype* cpu_diff() const;
224-
const Dtype* gpu_diff() const;
225222
Dtype* mutable_cpu_data();
226-
Dtype* mutable_gpu_data();
227223
Dtype* mutable_cpu_diff();
228-
Dtype* mutable_gpu_diff();
229224
void Update();
230225
void FromProto(const BlobProto& proto, bool reshape = true);
231226
void ToProto(BlobProto* proto, bool write_diff = false) const;

include/caffe/common.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
#include "caffe/util/logging.hpp"
1717

18-
#define NO_GPU LOG(FATAL) << "Cannot use GPU in CPU-only Caffe: check mode."
19-
2018
// Convert macro to string
2119
#define STRINGIFY(m) #m
2220
#define AS_STRING(m) STRINGIFY(m)

include/caffe/syncedmem.hpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,26 @@ inline void CaffeFreeHost(void* ptr, bool use_cuda) {
3232
class SyncedMemory {
3333
public:
3434
SyncedMemory()
35-
: cpu_ptr_(NULL), gpu_ptr_(NULL), size_(0), head_(UNINITIALIZED),
36-
own_cpu_data_(false), cpu_malloc_use_cuda_(false), own_gpu_data_(false),
37-
gpu_device_(-1) {}
35+
: cpu_ptr_(NULL), size_(0), head_(UNINITIALIZED),
36+
own_cpu_data_(false) {}
3837
explicit SyncedMemory(size_t size)
39-
: cpu_ptr_(NULL), gpu_ptr_(NULL), size_(size), head_(UNINITIALIZED),
40-
own_cpu_data_(false), cpu_malloc_use_cuda_(false), own_gpu_data_(false),
41-
gpu_device_(-1) {}
38+
: cpu_ptr_(NULL), size_(size), head_(UNINITIALIZED),
39+
own_cpu_data_(false) {}
4240
~SyncedMemory();
4341
const void* cpu_data();
4442
void set_cpu_data(void* data);
45-
const void* gpu_data();
46-
void set_gpu_data(void* data);
4743
void* mutable_cpu_data();
48-
void* mutable_gpu_data();
49-
enum SyncedHead { UNINITIALIZED, HEAD_AT_CPU, HEAD_AT_GPU, SYNCED };
44+
enum SyncedHead { UNINITIALIZED, HEAD_AT_CPU };
5045
SyncedHead head() { return head_; }
5146
size_t size() { return size_; }
5247

5348
private:
5449
void to_cpu();
55-
void to_gpu();
5650
void* cpu_ptr_;
57-
void* gpu_ptr_;
5851
size_t size_;
5952
SyncedHead head_;
6053
bool own_cpu_data_;
6154
bool cpu_malloc_use_cuda_;
62-
bool own_gpu_data_;
63-
int gpu_device_;
6455

6556
DISABLE_COPY_AND_ASSIGN(SyncedMemory);
6657
}; // class SyncedMemory

src/caffe/blob.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,6 @@ Blob<Dtype>::Blob(const vector<int>& shape)
7474
Reshape(shape);
7575
}
7676

77-
template <typename Dtype>
78-
const int* Blob<Dtype>::gpu_shape() const {
79-
CHECK(shape_data_);
80-
return (const int*)shape_data_->gpu_data();
81-
}
82-
8377
template <typename Dtype>
8478
const Dtype* Blob<Dtype>::cpu_data() const {
8579
CHECK(data_);
@@ -92,48 +86,24 @@ void Blob<Dtype>::set_cpu_data(Dtype* data) {
9286
data_->set_cpu_data(data);
9387
}
9488

95-
template <typename Dtype>
96-
const Dtype* Blob<Dtype>::gpu_data() const {
97-
CHECK(data_);
98-
return (const Dtype*)data_->gpu_data();
99-
}
100-
10189
template <typename Dtype>
10290
const Dtype* Blob<Dtype>::cpu_diff() const {
10391
CHECK(diff_);
10492
return (const Dtype*)diff_->cpu_data();
10593
}
10694

107-
template <typename Dtype>
108-
const Dtype* Blob<Dtype>::gpu_diff() const {
109-
CHECK(diff_);
110-
return (const Dtype*)diff_->gpu_data();
111-
}
112-
11395
template <typename Dtype>
11496
Dtype* Blob<Dtype>::mutable_cpu_data() {
11597
CHECK(data_);
11698
return static_cast<Dtype*>(data_->mutable_cpu_data());
11799
}
118100

119-
template <typename Dtype>
120-
Dtype* Blob<Dtype>::mutable_gpu_data() {
121-
CHECK(data_);
122-
return static_cast<Dtype*>(data_->mutable_gpu_data());
123-
}
124-
125101
template <typename Dtype>
126102
Dtype* Blob<Dtype>::mutable_cpu_diff() {
127103
CHECK(diff_);
128104
return static_cast<Dtype*>(diff_->mutable_cpu_data());
129105
}
130106

131-
template <typename Dtype>
132-
Dtype* Blob<Dtype>::mutable_gpu_diff() {
133-
CHECK(diff_);
134-
return static_cast<Dtype*>(diff_->mutable_gpu_data());
135-
}
136-
137107
template <typename Dtype>
138108
void Blob<Dtype>::ShareData(const Blob& other) {
139109
CHECK_EQ(count_, other.count());
@@ -162,10 +132,6 @@ void Blob<Dtype>::Update() {
162132
static_cast<const Dtype*>(diff_->cpu_data()),
163133
static_cast<Dtype*>(data_->mutable_cpu_data()));
164134
break;
165-
case SyncedMemory::HEAD_AT_GPU:
166-
case SyncedMemory::SYNCED:
167-
NO_GPU;
168-
break;
169135
default:
170136
LOG(FATAL) << "Syncedmem not initialized.";
171137
}
@@ -187,9 +153,6 @@ Dtype Blob<Dtype>::asum_data() const {
187153
switch (data_->head()) {
188154
case SyncedMemory::HEAD_AT_CPU:
189155
return caffe_cpu_asum(count_, cpu_data());
190-
case SyncedMemory::HEAD_AT_GPU:
191-
case SyncedMemory::SYNCED:
192-
NO_GPU;
193156
case SyncedMemory::UNINITIALIZED:
194157
return 0;
195158
default:
@@ -214,9 +177,6 @@ Dtype Blob<Dtype>::asum_diff() const {
214177
switch (diff_->head()) {
215178
case SyncedMemory::HEAD_AT_CPU:
216179
return caffe_cpu_asum(count_, cpu_diff());
217-
case SyncedMemory::HEAD_AT_GPU:
218-
case SyncedMemory::SYNCED:
219-
NO_GPU;
220180
case SyncedMemory::UNINITIALIZED:
221181
return 0;
222182
default:
@@ -245,10 +205,6 @@ Dtype Blob<Dtype>::sumsq_data() const {
245205
data = cpu_data();
246206
sumsq = caffe_cpu_dot(count_, data, data);
247207
break;
248-
case SyncedMemory::HEAD_AT_GPU:
249-
case SyncedMemory::SYNCED:
250-
NO_GPU;
251-
break;
252208
case SyncedMemory::UNINITIALIZED:
253209
return 0;
254210
default:
@@ -277,9 +233,6 @@ Dtype Blob<Dtype>::sumsq_diff() const {
277233
diff = cpu_diff();
278234
sumsq = caffe_cpu_dot(count_, diff, diff);
279235
break;
280-
case SyncedMemory::HEAD_AT_GPU:
281-
case SyncedMemory::SYNCED:
282-
NO_GPU;
283236
case SyncedMemory::UNINITIALIZED:
284237
return 0;
285238
default:
@@ -305,9 +258,6 @@ void Blob<Dtype>::scale_data(Dtype scale_factor) {
305258
data = mutable_cpu_data();
306259
caffe_scal(count_, scale_factor, data);
307260
return;
308-
case SyncedMemory::HEAD_AT_GPU:
309-
case SyncedMemory::SYNCED:
310-
NO_GPU;
311261
case SyncedMemory::UNINITIALIZED:
312262
return;
313263
default:
@@ -332,9 +282,6 @@ void Blob<Dtype>::scale_diff(Dtype scale_factor) {
332282
diff = mutable_cpu_diff();
333283
caffe_scal(count_, scale_factor, diff);
334284
return;
335-
case SyncedMemory::HEAD_AT_GPU:
336-
case SyncedMemory::SYNCED:
337-
NO_GPU;
338285
case SyncedMemory::UNINITIALIZED:
339286
return;
340287
default:

src/caffe/syncedmem.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,11 @@ inline void SyncedMemory::to_cpu() {
1818
head_ = HEAD_AT_CPU;
1919
own_cpu_data_ = true;
2020
break;
21-
case HEAD_AT_GPU:
22-
NO_GPU;
23-
break;
2421
case HEAD_AT_CPU:
25-
case SYNCED:
2622
break;
2723
}
2824
}
2925

30-
inline void SyncedMemory::to_gpu() {
31-
NO_GPU;
32-
}
33-
3426
const void* SyncedMemory::cpu_data() {
3527
to_cpu();
3628
return (const void*)cpu_ptr_;
@@ -46,25 +38,11 @@ void SyncedMemory::set_cpu_data(void* data) {
4638
own_cpu_data_ = false;
4739
}
4840

49-
const void* SyncedMemory::gpu_data() {
50-
NO_GPU;
51-
return NULL;
52-
}
53-
54-
void SyncedMemory::set_gpu_data(void* data) {
55-
NO_GPU;
56-
}
57-
5841
void* SyncedMemory::mutable_cpu_data() {
5942
to_cpu();
6043
head_ = HEAD_AT_CPU;
6144
return cpu_ptr_;
6245
}
6346

64-
void* SyncedMemory::mutable_gpu_data() {
65-
NO_GPU;
66-
return NULL;
67-
}
68-
6947
} // namespace caffe
7048

0 commit comments

Comments
 (0)