Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SeetaResearch
/
Dragon
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ee893b1b
authored
Jul 29, 2017
by
Ting PAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add setup.py
1 parent
88ba833a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
12 deletions
Dragon/CMakeLists.txt
Dragon/python/protos/dragon.proto
Dragon/python/vm/caffe/io/minibatch.py
Dragon/setup.py
README.md
Dragon/CMakeLists.txt
View file @
ee893b1
...
...
@@ -19,11 +19,10 @@ option(WITH_CUDA_FP16 "Set to ON to use FP16" ON)
# set your 3rdparty
set
(
3RDPARTY_DIR
${
PROJECT_SOURCE_DIR
}
/3rdparty
)
# set if you want to build pydragon
#set(PYTHON_DIR /usr/include/python2.7)
set
(
ANACONDA_DIR /xxx/anaconda
)
set
(
NUMPY_DIR /xxx/numpy
)
# set your py27
set
(
PYTHON_DIR /usr/include/python2.7
)
# prefer
#set(ANACONDA_DIR /xxx/anaconda) # optional
set
(
NUMPY_DIR /xxx/numpy
)
# require
# set CUDA compiling architecture
set
(
CUDA_ARCH -gencode arch=compute_20,code=sm_20
...
...
Dragon/python/protos/dragon.proto
0 → 100644
View file @
ee893b1
message
TensorProto
{
repeated
int32
dims
=
1
;
enum
DataType
{
FLOAT
=
1
;
INT32
=
2
;
BYTE
=
3
;
STRING
=
4
;
FLOAT16
=
12
;
}
optional
DataType
data_type
=
2
[
default
=
FLOAT
];
repeated
float
float_data
=
3
[
packed
=
true
];
repeated
int32
int32_data
=
4
[
packed
=
true
];
optional
bytes
byte_data
=
5
;
repeated
bytes
string_data
=
6
;
optional
string
name
=
7
;
}
message
TensorProtos
{
repeated
TensorProto
protos
=
1
;
}
message
Argument
{
optional
string
name
=
1
;
optional
float
f
=
2
;
optional
int32
i
=
3
;
optional
int64
i64
=
9
;
optional
string
s
=
4
;
optional
bool
b
=
8
;
repeated
float
floats
=
5
;
repeated
int32
ints
=
6
;
repeated
string
strings
=
7
;
}
enum
DeviceType
{
CPU
=
0
;
CUDA
=
1
;
OPENCL
=
2
;
}
message
DeviceOption
{
optional
DeviceType
device_type
=
1
[
default
=
CPU
];
optional
int32
gpu_id
=
2
[
default
=
0
];
optional
uint32
random_seed
=
3
[
default
=
3
];
optional
string
engine
=
4
;
}
message
OperatorDef
{
repeated
string
input
=
1
;
repeated
string
output
=
2
;
optional
string
name
=
3
;
optional
string
type
=
4
;
repeated
Argument
arg
=
5
;
optional
DeviceOption
device_option
=
6
;
optional
bool
debug_mode
=
7
[
default
=
false
];
}
message
GradientTarget
{
optional
string
cost
=
1
;
optional
string
wrt
=
2
;
optional
string
external
=
3
;
}
message
UpdateTarget
{
optional
string
name
=
1
;
optional
string
type
=
2
;
repeated
string
tensor
=
3
;
repeated
Argument
arg
=
4
;
}
// simply copy from caffe1
message
TensorFiller
{
optional
string
tensor
=
1
;
optional
string
type
=
2
[
default
=
'constant'
];
optional
float
value
=
3
[
default
=
0
];
optional
float
low
=
4
[
default
=
0
];
optional
float
high
=
5
[
default
=
1
];
optional
float
mean
=
6
[
default
=
0
];
optional
float
std
=
7
[
default
=
1
];
optional
float
scale
=
8
[
default
=
3
];
enum
VarianceNorm
{
FAN_IN
=
0
;
FAN_OUT
=
1
;
FAN_AVG
=
2
;
}
optional
VarianceNorm
variance_norm
=
9
[
default
=
FAN_IN
];
}
message
GraphDef
{
optional
string
name
=
1
;
repeated
OperatorDef
op
=
2
;
optional
string
graph_type
=
3
;
optional
DeviceOption
device_option
=
5
;
repeated
Argument
arg
=
6
;
repeated
string
target
=
7
;
repeated
GradientTarget
g_target
=
8
;
repeated
UpdateTarget
u_target
=
9
;
optional
bool
debug_mode
=
10
[
default
=
false
];
}
Dragon/python/vm/caffe/io/minibatch.py
View file @
ee893b1
...
...
@@ -107,4 +107,4 @@ class DataBatch(object):
'num_transformers'
:
self
.
_num_transformers
,
'num_prefetching'
:
self
.
_prefetch
}
pprint
.
pprint
(
params
)
print
'---------------------------------------------------------'
\ No newline at end of file
print
'---------------------------------------------------------'
Dragon/setup.py
0 → 100644
View file @
ee893b1
from
distutils.core
import
setup
,
Extension
import
os.path
,
sys
import
shutil
packages
=
[]
def
find_packages
(
root_dir
):
filenames
=
os
.
listdir
(
root_dir
)
for
filename
in
filenames
:
filepath
=
os
.
path
.
join
(
root_dir
,
filename
)
if
os
.
path
.
isdir
(
filepath
):
find_packages
(
filepath
)
else
:
if
filename
==
'__init__.py'
:
packages
.
append
(
root_dir
.
replace
(
'python'
,
'dragon'
)
.
replace
(
'
\\
'
,
'.'
)
.
replace
(
'/'
,
'.'
))
def
find_modules
():
dragon_c_lib_win32
=
'lib/dragon.dll'
dragon_c_lib_other
=
'lib/libdragon.so'
if
os
.
path
.
exists
(
dragon_c_lib_win32
):
shutil
.
copy
(
dragon_c_lib_win32
,
'python/libdragon.pyd'
)
elif
os
.
path
.
exists
(
dragon_c_lib_other
):
shutil
.
copy
(
dragon_c_lib_other
,
'python/libdragon.so'
)
else
:
print
(
'ERROR: Unable to find modules. built Dragon using CMake.'
)
sys
.
exit
()
def
find_resources
():
c_lib
=
[
'libdragon.*'
]
protos
=
[
'protos/*.proto'
,
'vm/caffe/proto/*.proto'
]
others
=
[]
return
c_lib
+
protos
+
others
find_packages
(
'python'
)
find_modules
()
setup
(
name
=
'dragon'
,
version
=
'0.2'
,
description
=
'Dragon: A Computation Graph Virtual Machine Based Deep Learning Framework'
,
url
=
'https://github.com/neopenx/Dragon'
,
author
=
'Ting Pan'
,
license
=
'BSD 2-Clause'
,
packages
=
packages
,
package_dir
=
{
'dragon'
:
'python'
},
package_data
=
{
'dragon'
:
find_resources
()})
\ No newline at end of file
README.md
View file @
ee893b1
...
...
@@ -31,8 +31,9 @@
4.
Configure Dragon/CMakeLists.txt
-
Select optional libraries
[
CUDA / CUDNN / BLAS / SSE / MPI / MPI_CUDA_AWARE / CUDA_FP16
]
-
Set 3rdparty path (recommend to keep defualt)
-
Set python path
-
Set python
& numpy root
path
-
Set cuda compiling architectures if necessary
-
GCC version(4.8+, 5.0-) should add
``-std=c++11``
to
``CUDA_NVCC_FLAGS``
, if
``nullptr``
is not found.
5.
Environment Variables
### Linux(Only for OpenMPI):
...
...
@@ -100,9 +101,7 @@
8.
Deploy
```Shell
cp Dragon/libs/libdragon.so Dragon/python
cp Dragon/python /usr/lib/python2.7/dist-packages/dragon (For Python)
cp Dragon/python ANACONDA_DIR/libs/python2.7/dist-packages/dragon (For Anaconda)
python Dragon/setup.py install
```
----
...
...
@@ -189,4 +188,3 @@ Please cite Dragon in your publications if it helps your research:
Title = {Dragon: A Computation Graph Virtual Machine Based Deep Learning Framework},
Year = {2017}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment