Skip to content

Commit

Permalink
Introduce a developer mode option in Makefile (apache#4364)
Browse files Browse the repository at this point in the history
this option will enable two addtionals for now:
1. Create symbol even for optimized build
2. Enforce warning as error

while I am here, clean up all warnings so that I can get a clean build in developer mode.
  • Loading branch information
howard0su authored and piiswrong committed Dec 29, 2016
1 parent 6f95b74 commit 82f53b7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ include $(DMLC_CORE)/make/dmlc.mk
WARNFLAGS= -Wall
CFLAGS = -DMSHADOW_FORCE_STREAM $(WARNFLAGS)

ifeq ($(DEV), 1)
CFLAGS += -g -Werror
endif

# CFLAGS for debug
ifeq ($(DEBUG), 1)
CFLAGS += -g -O0 -DDMLC_LOG_FATAL_THROW=0
Expand Down
3 changes: 3 additions & 0 deletions make/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export CC = gcc
export CXX = g++
export NVCC = nvcc

# whether compile with options for MXNet developer
DEV = 0

# whether compile with debug
DEBUG = 0

Expand Down
3 changes: 3 additions & 0 deletions make/osx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export CC = gcc
export CXX = g++
export NVCC = nvcc

# whether compile with options for MXNet developer
DEV = 0

# whether compile with debug
DEBUG = 0

Expand Down
2 changes: 1 addition & 1 deletion src/operator/pad-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class PadProp : public OperatorProperty {
const TShape &dshape = (*in_shape)[pad_enum::kData];
if (dshape.ndim() == 0) return false;
TShape oshape = dshape;
for (int i = 0; i < dshape.ndim(); ++i) {
for (size_t i = 0; i < dshape.ndim(); ++i) {
oshape[i] =
param_.pad_width[2 * i] + param_.pad_width[2 * i + 1] + dshape[i];
}
Expand Down
2 changes: 1 addition & 1 deletion src/operator/tensor/elemwise_sum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ std::vector<nnvm::NodeEntry> ElementWiseSumGrad(
CHECK_EQ(ograds.size(), 1);
std::vector<nnvm::NodeEntry> ret;
nnvm::NodeEntry n_out{n, 0, 0};
for (auto& h : n->inputs) {
for (size_t i = 0; i < n->inputs.size(); i++) {
nnvm::NodePtr id_node = nnvm::Node::Create();
id_node->attrs.op = copy_op;
id_node->inputs = {ograds[0]};
Expand Down
2 changes: 1 addition & 1 deletion src/operator/tensor/matrix_op-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ inline bool ReshapeShape(const nnvm::NodeAttrs& attrs,
dshape_vec.push_back(dshape[i]);
}
std::vector<int> tmp;
int src_idx = 0;
size_t src_idx = 0;
int inf_idx = -1;
size_t new_size = dshape.Size();
if (param_.reverse) {
Expand Down

0 comments on commit 82f53b7

Please sign in to comment.