Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
f93ea36f
Commit
f93ea36f
authored
Mar 02, 2018
by
Leona C
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cyphers/dochow' of github.com:NervanaSystems/private-ngraph-cpp into cyphers/dochow
parents
34eed33a
3c123424
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
51 deletions
+55
-51
CMakeLists.txt
src/ngraph/CMakeLists.txt
+1
-1
file_util.cpp
src/ngraph/file_util.cpp
+5
-2
mkldnn.cpp
test/mkldnn.cpp
+49
-48
No files found.
src/ngraph/CMakeLists.txt
View file @
f93ea36f
...
...
@@ -263,7 +263,7 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND MKLDNN_INCLUDE_DIR)
BYPRODUCTS
)
add_dependencies
(
ngraph header_resource ext_json
)
include_directories
(
${
CMAKE_BINARY_DIR
}
)
include_directories
(
SYSTEM
${
CMAKE_BINARY_DIR
}
)
include_directories
(
SYSTEM
${
JSON_INCLUDE_DIR
}
)
endif
()
...
...
src/ngraph/file_util.cpp
View file @
f93ea36f
...
...
@@ -150,9 +150,12 @@ string ngraph::file_util::make_temp_directory(const string& path)
string
tmp_template
=
file_util
::
path_join
(
fname
,
"ngraph_XXXXXX"
);
char
*
tmpname
=
strdup
(
tmp_template
.
c_str
());
mkdtemp
(
tmpname
);
string
rc
;
if
(
mkdtemp
(
tmpname
))
{
rc
=
tmpname
;
}
string
rc
=
tmpname
;
free
(
tmpname
);
return
rc
;
}
...
...
test/mkldnn.cpp
View file @
f93ea36f
...
...
@@ -28,62 +28,63 @@ static int tensor_volume(const mkldnn::memory::dims& t)
return
x
;
}
TEST
(
mkldnn
,
engine
)
void
test
(
)
{
using
namespace
mkldnn
;
#pragma GCC diagnostic ignored "-Wgnu-statement-expression"
auto
cpu_engine
=
engine
(
engine
::
cpu
,
0
);
EXPECT_NO_THROW
(({
auto
cpu_engine
=
engine
(
engine
::
cpu
,
0
);
const
int
mb
=
2
;
const
int
groups
=
2
;
memory
::
dims
input_tz
=
{
mb
,
256
,
13
,
13
};
memory
::
dims
weights_tz
=
{
groups
,
384
/
groups
,
256
/
groups
,
3
,
3
};
memory
::
dims
bias_tz
=
{
384
};
memory
::
dims
strides
=
{
1
,
1
};
memory
::
dims
padding
=
{
0
,
0
};
memory
::
dims
output_tz
=
{
mb
,
384
,
(
input_tz
[
2
]
+
2
*
padding
[
0
]
-
weights_tz
[
3
])
/
strides
[
0
]
+
1
,
(
input_tz
[
3
]
+
2
*
padding
[
1
]
-
weights_tz
[
4
])
/
strides
[
1
]
+
1
,
};
const
int
mb
=
2
;
const
int
groups
=
2
;
memory
::
dims
input_tz
=
{
mb
,
256
,
13
,
13
};
memory
::
dims
weights_tz
=
{
groups
,
384
/
groups
,
256
/
groups
,
3
,
3
};
memory
::
dims
bias_tz
=
{
384
};
memory
::
dims
strides
=
{
1
,
1
};
memory
::
dims
padding
=
{
0
,
0
};
memory
::
dims
output_tz
=
{
mb
,
384
,
(
input_tz
[
2
]
+
2
*
padding
[
0
]
-
weights_tz
[
3
])
/
strides
[
0
]
+
1
,
(
input_tz
[
3
]
+
2
*
padding
[
1
]
-
weights_tz
[
4
])
/
strides
[
1
]
+
1
,
};
std
::
vector
<
float
>
input
(
tensor_volume
(
input_tz
),
.0
f
);
std
::
vector
<
float
>
weights
(
tensor_volume
(
weights_tz
),
.0
f
);
std
::
vector
<
float
>
bias
(
tensor_volume
(
bias_tz
),
.0
f
);
std
::
vector
<
float
>
output
(
tensor_volume
(
output_tz
),
.0
f
);
std
::
vector
<
float
>
input
(
tensor_volume
(
input_tz
),
.0
f
);
std
::
vector
<
float
>
weights
(
tensor_volume
(
weights_tz
),
.0
f
);
std
::
vector
<
float
>
bias
(
tensor_volume
(
bias_tz
),
.0
f
);
std
::
vector
<
float
>
output
(
tensor_volume
(
output_tz
),
.0
f
);
auto
c3_src_desc
=
memory
::
desc
({
input_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
nchw
);
auto
c3_weights_desc
=
memory
::
desc
({
weights_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
goihw
);
auto
c3_bias_desc
=
memory
::
desc
({
bias_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
x
);
auto
c3_dst_desc
=
memory
::
desc
({
output_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
nchw
);
auto
c3_src_desc
=
memory
::
desc
({
input_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
nchw
);
auto
c3_weights_desc
=
memory
::
desc
({
weights_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
goihw
);
auto
c3_bias_desc
=
memory
::
desc
({
bias_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
x
);
auto
c3_dst_desc
=
memory
::
desc
({
output_tz
},
memory
::
data_type
::
f32
,
memory
::
format
::
nchw
);
auto
c3_src
=
memory
({
c3_src_desc
,
cpu_engine
},
input
.
data
());
auto
c3_weights
=
memory
({
c3_weights_desc
,
cpu_engine
},
weights
.
data
());
auto
c3_bias
=
memory
({
c3_bias_desc
,
cpu_engine
},
bias
.
data
());
auto
c3_dst
=
memory
({
c3_dst_desc
,
cpu_engine
},
output
.
data
());
auto
c3_src
=
memory
({
c3_src_desc
,
cpu_engine
},
input
.
data
());
auto
c3_weights
=
memory
({
c3_weights_desc
,
cpu_engine
},
weights
.
data
());
auto
c3_bias
=
memory
({
c3_bias_desc
,
cpu_engine
},
bias
.
data
());
auto
c3_dst
=
memory
({
c3_dst_desc
,
cpu_engine
},
output
.
data
());
auto
c3
=
convolution_forward
(
convolution_forward
::
primitive_desc
(
convolution_forward
::
desc
(
prop_kind
::
forward
,
algorithm
::
convolution_direct
,
c3_src_desc
,
c3_weights_desc
,
c3_bias_desc
,
c3_dst_desc
,
strides
,
padding
,
padding
,
padding_kind
::
zero
),
cpu_engine
),
c3_src
,
c3_weights
,
c3_bias
,
c3_dst
);
auto
c3
=
convolution_forward
(
convolution_forward
::
primitive_desc
(
convolution_forward
::
desc
(
prop_kind
::
forward
,
algorithm
::
convolution_direct
,
c3_src_desc
,
c3_weights_desc
,
c3_bias_desc
,
c3_dst_desc
,
strides
,
padding
,
padding
,
padding_kind
::
zero
),
cpu_engine
),
c3_src
,
c3_weights
,
c3_bias
,
c3_dst
);
stream
(
stream
::
kind
::
eager
).
submit
({
c3
}).
wait
();
}
stream
(
stream
::
kind
::
eager
).
submit
({
c3
}).
wait
();
}));
TEST
(
mkldnn
,
engine
)
{
EXPECT_NO_THROW
(
test
());
}
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