Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
410062df
Commit
410062df
authored
Sep 09, 2016
by
Hu Shiwen
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cmake with windows (#40)
parent
241c7ac7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
0 deletions
+81
-0
nnvm/CMakeLists.txt
+65
-0
nnvm/cmake/Utils.cmake
+0
-0
nnvm/include/dmlc/array_view.h
+12
-0
nnvm/src/pass/gradient.cc
+4
-0
No files found.
nnvm/CMakeLists.txt
0 → 100644
View file @
410062df
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
nnvm C CXX
)
list
(
APPEND CMAKE_MODULE_PATH
${
PROJECT_SOURCE_DIR
}
/cmake/Modules
)
include
(
cmake/Utils.cmake
)
# include path
include_directories
(
BEFORE
"include"
)
set
(
nnvm_LINKER_LIBS
""
)
add_definitions
(
-DNNVM_EXPORTS
)
# compile
if
(
MSVC
)
add_definitions
(
-DDMLC_USE_CXX11
)
add_definitions
(
-DDMLC_STRICT_CXX11
)
foreach
(
flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if
(
${
flag_var
}
MATCHES
"/MD"
)
string
(
REGEX REPLACE
"/MD"
"/MT"
${
flag_var
}
"
${${
flag_var
}}
"
)
endif
(
${
flag_var
}
MATCHES
"/MD"
)
endforeach
(
flag_var
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/EHsc"
)
else
(
MSVC
)
include
(
CheckCXXCompilerFlag
)
check_cxx_compiler_flag
(
"-std=c++0x"
SUPPORT_CXX0X
)
check_cxx_compiler_flag
(
"-msse2"
SUPPORT_MSSE2
)
check_cxx_compiler_flag
(
"-openmp"
SUPPORT_OPENMP
)
set
(
CMAKE_C_FLAGS
"-O3 -Wall -msse2 -Wno-unknown-pragmas -std=c++0x -fPIC"
)
if
(
SUPPORT_OPENMP
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-fopenmp"
)
endif
()
set
(
CMAKE_CXX_FLAGS
${
CMAKE_C_FLAGS
}
)
endif
(
MSVC
)
mxnet_source_group
(
"Include
\\
c_api"
GLOB
"src/c_api/*.h"
)
mxnet_source_group
(
"Include
\\
core"
GLOB
"src/core/*.h"
)
mxnet_source_group
(
"Include
\\
pass"
GLOB
"src/pass/*.h"
)
mxnet_source_group
(
"Include
\\
nnvm"
GLOB
"include/nnvm/*.h"
)
mxnet_source_group
(
"Include
\\
dmlc"
GLOB
"include/dmlc/*.h"
)
mxnet_source_group
(
"Source"
GLOB
"src/*.cc"
)
mxnet_source_group
(
"Source
\\
c_api"
GLOB
"src/c_api/*.cc"
)
mxnet_source_group
(
"Source
\\
core"
GLOB
"src/core/*.cc"
)
mxnet_source_group
(
"Source
\\
pass"
GLOB
"src/pass/*.cc"
)
FILE
(
GLOB_RECURSE SOURCE
"src/*.cc"
"src/*.h"
"include/*.h"
)
add_library
(
nnvm
${
SOURCE
}
)
target_link_libraries
(
nnvm
${
nnvm_LINKER_LIBS
}
)
# ---[ Linter target
if
(
MSVC
)
find_package
(
PythonInterp 2
)
set
(
PYTHON2_EXECUTABLE
${
PYTHON_EXECUTABLE
}
CACHE FILEPATH
"Path to the python 2.x executable"
)
find_package
(
PythonInterp 3
)
set
(
PYTHON3_EXECUTABLE
${
PYTHON_EXECUTABLE
}
CACHE FILEPATH
"Path to the python 3.x executable"
)
endif
()
set
(
LINT_DIRS include src scripts
)
add_custom_target
(
nnvm_lint COMMAND
${
CMAKE_COMMAND
}
-DMSVC=
${
MSVC
}
-DPYTHON2_EXECUTABLE=
${
PYTHON2_EXECUTABLE
}
-DPYTHON3_EXECUTABLE=
${
PYTHON3_EXECUTABLE
}
-DPROJECT_SOURCE_DIR=
${
PROJECT_SOURCE_DIR
}
-DLINT_DIRS=
${
LINT_DIRS
}
-DPROJECT_NAME=dmlc -P
${
PROJECT_SOURCE_DIR
}
/cmake/lint.cmake
)
nnvm/cmake/Utils.cmake
0 → 100644
View file @
410062df
This diff is collapsed.
Click to expand it.
nnvm/include/dmlc/array_view.h
View file @
410062df
...
@@ -42,11 +42,23 @@ class array_view {
...
@@ -42,11 +42,23 @@ class array_view {
* \param other another array view.
* \param other another array view.
*/
*/
array_view
(
const
array_view
<
ValueType
>
&
other
)
=
default
;
// NOLINT(*)
array_view
(
const
array_view
<
ValueType
>
&
other
)
=
default
;
// NOLINT(*)
#ifndef _MSC_VER
/*!
/*!
* \brief default move constructor
* \brief default move constructor
* \param other another array view.
* \param other another array view.
*/
*/
array_view
(
array_view
<
ValueType
>&&
other
)
=
default
;
// NOLINT(*)
array_view
(
array_view
<
ValueType
>&&
other
)
=
default
;
// NOLINT(*)
#else
/*!
* \brief default move constructor
* \param other another array view.
*/
array_view
(
array_view
<
ValueType
>&&
other
)
{
// NOLINT(*)
begin_
=
other
.
begin_
;
size_
=
other
.
size_
;
other
.
begin_
=
nullptr
;
}
#endif
/*!
/*!
* \brief default assign constructor
* \brief default assign constructor
* \param other another array view.
* \param other another array view.
...
...
nnvm/src/pass/gradient.cc
View file @
410062df
...
@@ -32,7 +32,11 @@ NodeEntry DefaultAggregateGradient(std::vector<NodeEntry>&& v) {
...
@@ -32,7 +32,11 @@ NodeEntry DefaultAggregateGradient(std::vector<NodeEntry>&& v) {
// helper entry
// helper entry
struct
GradEntry
{
struct
GradEntry
{
#ifdef _MSC_VER
NodeEntry
sum
=
NodeEntry
{
nullptr
,
0
,
0
};
#else
NodeEntry
sum
{
nullptr
,
0
,
0
};
NodeEntry
sum
{
nullptr
,
0
,
0
};
#endif
std
::
vector
<
NodeEntry
>
grads
;
std
::
vector
<
NodeEntry
>
grads
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment