Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit b8cb4f5

Browse files
committed
Merge branch 'release_1.0.0_rc2' of ssh://git-ccr-1.devtools.intel.com:29418/dl_framework-intel_caffe
2 parents b0ef323 + cef51e9 commit b8cb4f5

36 files changed

+3036
-2132
lines changed

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
COPYRIGHT
23

34
All modification made by Intel Corporation: © 2017 Intel Corporation.

Makefile.mkldnn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ MKLDNN_COMMIT := `cat ${CAFFE_ROOTDIR}/mkldnn.commit`
88
MKLDNN_CXX := $(CXX)
99
MKLDNN_CC := $(CC)
1010

11+
RETURN_STRING=$(shell ./external/mkl/prepare_mkl.sh)
12+
MKLROOT=$(firstword $(RETURN_STRING))
13+
MKL_ROOTDIR := $(MKLROOT)
14+
1115
# We do this because earlier versions of CMake have problems with ccache
1216
ifneq (,$(findstring ccache,$(CXX)))
1317
MKLDNN_CXX := $(lastword $(CXX))
@@ -18,7 +22,7 @@ ifneq (,$(findstring ccache,$(CC)))
1822
endif
1923

2024
MKLDNN_GITHUB := https://github.com/01org/mkl-dnn.git
21-
MKLDNN_CMAKE_FLAGS += $(MKLDNN_SRCDIR) -DCMAKE_INSTALL_PREFIX=$(CAFFE_ROOTDIR)/$(MKLDNN_INSTALLDIR) -B$(CAFFE_ROOTDIR)/$(MKLDNN_BUILDDIR) -DCMAKE_CXX_COMPILER="$(MKLDNN_CXX)" -DCMAKE_C_COMPILER="$(MKLDNN_CC)"
25+
MKLDNN_CMAKE_FLAGS += $(MKLDNN_SRCDIR) -DCMAKE_INSTALL_PREFIX=$(CAFFE_ROOTDIR)/$(MKLDNN_INSTALLDIR) -DMKLROOT=${MKL_ROOTDIR} -B$(CAFFE_ROOTDIR)/$(MKLDNN_BUILDDIR) -DCMAKE_CXX_COMPILER="$(MKLDNN_CXX)" -DCMAKE_C_COMPILER="$(MKLDNN_CC)"
2226

2327
ifeq ("$(wildcard $(MKLDNN_INSTALLDIR)/include/mkldnn.hpp)", "")
2428
mkldnn_download:

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,6 @@ Please cite Caffe in your publications if it helps your research:
7171

7272
***
7373
*Other names and brands may be claimed as the property of others
74+
75+
76+

external/mkl/prepare_mkl.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ echo $VERSION_LINE # Return Version Line
7474
# MKL
7575
DST=`dirname $0`
7676
OMP=0
77-
VERSION_MATCH=20170101
78-
ARCHIVE_BASENAME=mklml_lnx_2017.0.2.20170110.tgz
77+
VERSION_MATCH=20170425
78+
ARCHIVE_BASENAME=mklml_lnx_2018.0.20170425.tgz
7979
MKL_CONTENT_DIR=`echo $ARCHIVE_BASENAME | rev | cut -d "." -f 2- | rev`
80-
GITHUB_RELEASE_TAG=self_containted_MKLGOLD_u2
80+
GITHUB_RELEASE_TAG=1.0.0
81+
8182
MKLURL="https://github.com/intel/caffe/releases/download/$GITHUB_RELEASE_TAG/$ARCHIVE_BASENAME"
8283
# there are diffrent MKL lib to be used for GCC and for ICC
8384
reg='^[0-9]+$'

include/caffe/layers/accuracy_layer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class AccuracyLayer : public Layer<Dtype> {
7676
// If there are two top blobs, then the second blob will contain
7777
// accuracies per class.
7878
virtual inline int MinTopBlobs() const { return 1; }
79-
virtual inline int MaxTopBlos() const { return 2; }
79+
virtual inline int MaxTopBlobs() const { return 2; }
8080

8181
protected:
8282
/**

include/caffe/layers/base_conv_layer.hpp

100644100755
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ class BaseConvolutionLayer : public Layer<Dtype> {
153153
pad_.cpu_data()[0], pad_.cpu_data()[1],
154154
stride_.cpu_data()[0], stride_.cpu_data()[1],
155155
dilation_.cpu_data()[0], dilation_.cpu_data()[1], col_buff);
156+
} else if (!force_nd_im2col_ && num_spatial_axes_ == 3) {
157+
im3d2col_cpu(data, conv_in_channels_,
158+
conv_input_shape_.cpu_data()[1], conv_input_shape_.cpu_data()[2], conv_input_shape_.cpu_data()[3],
159+
kernel_shape_.cpu_data()[0], kernel_shape_.cpu_data()[1], kernel_shape_.cpu_data()[2],
160+
pad_.cpu_data()[0], pad_.cpu_data()[1], pad_.cpu_data()[2],
161+
stride_.cpu_data()[0], stride_.cpu_data()[1], stride_.cpu_data()[2],
162+
dilation_.cpu_data()[0], dilation_.cpu_data()[1], dilation_.cpu_data()[2], col_buff);
156163
} else {
157164
im2col_nd_cpu(data, num_spatial_axes_, conv_input_shape_.cpu_data(),
158165
col_buffer_shape_.data(), kernel_shape_.cpu_data(),
@@ -167,6 +174,13 @@ class BaseConvolutionLayer : public Layer<Dtype> {
167174
pad_.cpu_data()[0], pad_.cpu_data()[1],
168175
stride_.cpu_data()[0], stride_.cpu_data()[1],
169176
dilation_.cpu_data()[0], dilation_.cpu_data()[1], data);
177+
} else if (!force_nd_im2col_ && num_spatial_axes_ == 3) {
178+
col2im3d_cpu(col_buff, conv_in_channels_,
179+
conv_input_shape_.cpu_data()[1], conv_input_shape_.cpu_data()[2], conv_input_shape_.cpu_data()[3],
180+
kernel_shape_.cpu_data()[0], kernel_shape_.cpu_data()[1], kernel_shape_.cpu_data()[2],
181+
pad_.cpu_data()[0], pad_.cpu_data()[1], pad_.cpu_data()[2],
182+
stride_.cpu_data()[0], stride_.cpu_data()[1], stride_.cpu_data()[2],
183+
dilation_.cpu_data()[0], dilation_.cpu_data()[1], dilation_.cpu_data()[2], data);
170184
} else {
171185
col2im_nd_cpu(col_buff, num_spatial_axes_, conv_input_shape_.cpu_data(),
172186
col_buffer_shape_.data(), kernel_shape_.cpu_data(),

include/caffe/layers/mkldnn_layers.hpp

Lines changed: 519 additions & 510 deletions
Large diffs are not rendered by default.

include/caffe/layers/softmax_loss_layer.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ class SoftmaxWithLossLayer : public LossLayer<Dtype> {
100100
virtual inline int MinTopBlobs() const { return 1; }
101101
virtual inline int MaxTopBlobs() const { return 2; }
102102

103+
virtual inline int ExactNumBottomBlobs() const { return -1; }
104+
virtual inline int MinBottomBlobs() const { return 2; }
105+
virtual inline int MaxBottomBlobs() const { return 3; }
103106
protected:
104107
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
105108
const vector<Blob<Dtype>*>& top);

include/caffe/mkldnn_base.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ template <typename Dtype>
203203
class MKLDNNPrimitive {
204204
public:
205205
explicit MKLDNNPrimitive():aprimitive(), mkldnn_stream() {}
206+
207+
//API for initializing with shared_ptr<primitive>
208+
MKLDNNPrimitive(shared_ptr<primitive> aprimitive_input) {this->aprimitive = aprimitive_input;}
209+
206210
virtual ~MKLDNNPrimitive() {}
207211
void reset(primitive* pprimitive) { this->aprimitive.reset(pprimitive);}
208212
shared_ptr<primitive> aprimitive;

include/caffe/util/compareToolUtilities.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,16 @@ int collectAndCheckLayerData(bool collect_step,
372372
}
373373

374374
if (bottom_need_backward[i].size() > 0 && bottom_need_backward[i][0]) {
375-
getFileName(file_name, false, "FwrdBtmDat", i);
376-
checkData(file_name, bottom_vecs[i][0]->cpu_data(),
377-
layers[i]->type(), output_dir,
378-
&erronous_layers);
379-
checkAllNans(bottom_vecs[i][0]->cpu_diff(),
380-
bottom_vecs[i][0]->count(), "bottom.diff",
381-
layers[i]->type(), &erronous_layers);
375+
// We check data only for out-of-place computations
376+
if (bottom_vecs[i][0] != top_vecs[i][0]) {
377+
getFileName(file_name, false, "FwrdBtmDat", i);
378+
checkData(file_name, bottom_vecs[i][0]->cpu_data(),
379+
layers[i]->type(), output_dir,
380+
&erronous_layers);
381+
}
382+
checkAllNans(bottom_vecs[i][0]->cpu_diff(),
383+
bottom_vecs[i][0]->count(), "bottom.diff",
384+
layers[i]->type(), &erronous_layers);
382385
}
383386

384387
checkAllNans(top_vecs[i][0]->cpu_diff(),

0 commit comments

Comments
 (0)