Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
935e365c
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
935e365c
编写于
8月 04, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
!3906 fix allocator for gpu
Merge pull request !3906 from wandongdong/master
上级
b0b4fa08
cfb58a2c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
19 addition
and
9 deletion
+19
-9
build.sh
build.sh
+2
-2
mindspore/lite/src/runtime/kernel/opencl/subgraph_opencl_kernel.cc
.../lite/src/runtime/kernel/opencl/subgraph_opencl_kernel.cc
+2
-2
mindspore/lite/src/runtime/opencl/opencl_executor.cc
mindspore/lite/src/runtime/opencl/opencl_executor.cc
+2
-2
mindspore/lite/test/st/benchmark_test.cc
mindspore/lite/test/st/benchmark_test.cc
+8
-0
mindspore/lite/test/ut/src/runtime/kernel/opencl/matmul_tests.cc
...re/lite/test/ut/src/runtime/kernel/opencl/matmul_tests.cc
+1
-1
mindspore/lite/test/ut/src/runtime/kernel/opencl/softmax_cl_tests.cc
...ite/test/ut/src/runtime/kernel/opencl/softmax_cl_tests.cc
+1
-1
mindspore/lite/tools/benchmark/benchmark.cc
mindspore/lite/tools/benchmark/benchmark.cc
+2
-0
mindspore/lite/tools/benchmark/benchmark.h
mindspore/lite/tools/benchmark/benchmark.h
+1
-1
未找到文件。
build.sh
浏览文件 @
935e365c
...
...
@@ -527,7 +527,7 @@ build_lite()
{
echo
"start build mindspore lite project"
if
[
[
"
${
ENABLE_GPU
}
"
==
"on"
]
]
;
then
if
[
"
${
ENABLE_GPU
}
"
==
"on"
]
||
[
"
${
LITE_PLATFORM
}
"
==
"arm64"
]
;
then
echo
"start build opencl"
build_opencl
fi
...
...
@@ -554,7 +554,7 @@ build_lite()
-DANDROID_NDK
=
"
${
ANDROID_NDK
}
"
-DANDROID_ABI
=
"arm64-v8a"
-DANDROID_TOOLCHAIN_NAME
=
"aarch64-linux-android-clang"
\
-DANDROID_STL
=
"c++_shared"
-DCMAKE_BUILD_TYPE
=
${
BUILD_TYPE
}
-DSUPPORT_TRAIN
=
${
SUPPORT_TRAIN
}
\
-DBUILD_DEVICE
=
on
-DPLATFORM_ARM64
=
on
-DBUILD_CONVERTER
=
off
-DENABLE_NEON
=
on
-DENABLE_FP16
=
"off"
\
-DSUPPORT_GPU
=
${
ENABLE_GPU
}
-DOFFLINE_COMPILE
=
${
OPENCL_OFFLINE_COMPILE
}
"
${
BASEPATH
}
/mindspore/lite"
-DSUPPORT_GPU
=
on
-DOFFLINE_COMPILE
=
${
OPENCL_OFFLINE_COMPILE
}
"
${
BASEPATH
}
/mindspore/lite"
elif
[[
"
${
LITE_PLATFORM
}
"
==
"arm32"
]]
;
then
checkndk
cmake
-DCMAKE_TOOLCHAIN_FILE
=
"
${
ANDROID_NDK
}
/build/cmake/android.toolchain.cmake"
-DANDROID_NATIVE_API_LEVEL
=
"19"
\
...
...
mindspore/lite/src/runtime/kernel/opencl/subgraph_opencl_kernel.cc
浏览文件 @
935e365c
...
...
@@ -50,12 +50,12 @@ int SubGraphOpenCLKernel::UnInit() {
}
for
(
const
auto
tensor
:
inputs_
)
{
if
(
tensor
!=
nullptr
)
{
tensor
->
FreeData
(
allocator_
);
tensor
->
FreeData
();
}
}
for
(
const
auto
tensor
:
outputs_
)
{
if
(
tensor
!=
nullptr
)
{
tensor
->
FreeData
(
allocator_
);
tensor
->
FreeData
();
}
}
return
0
;
...
...
mindspore/lite/src/runtime/opencl/opencl_executor.cc
浏览文件 @
935e365c
...
...
@@ -44,7 +44,7 @@ int OpenCLExecutor::Run(std::vector<tensor::Tensor *> &inputs, std::vector<tenso
auto
&
outputs
=
kernel
->
GetOutputs
();
for
(
auto
*
output
:
outputs
)
{
MS_ASSERT
(
nullptr
!=
output
);
output
->
MallocData
(
allocator_
);
output
->
MallocData
();
}
kernel
::
CallBackParam
callbackParam
;
callbackParam
.
name_callback_aram
=
kernel
->
Name
();
...
...
@@ -67,7 +67,7 @@ int OpenCLExecutor::Run(std::vector<tensor::Tensor *> &inputs, std::vector<tenso
}
for
(
auto
input_kernel
:
kernel
->
GetInKernels
())
{
MS_EXCEPTION_IF_NULL
(
input_kernel
);
ret
=
input_kernel
->
DecOutTensorRefCount
(
allocator_
);
ret
=
input_kernel
->
DecOutTensorRefCount
();
if
(
0
!=
ret
)
{
MS_LOG
(
WARNING
)
<<
"DecOutTensorRefCount for kernel"
<<
kernel
->
Name
()
<<
" failed"
;
}
...
...
mindspore/lite/test/st/benchmark_test.cc
浏览文件 @
935e365c
...
...
@@ -41,6 +41,14 @@ TEST_F(BenchmarkTest, TestOCR_02) {
ASSERT_EQ
(
status
,
RET_OK
);
}
TEST_F
(
BenchmarkTest
,
TestOCR_02_GPU
)
{
const
char
*
argv
[]
=
{
"./benchmark"
,
"--modelPath=./hiai/hiai_cv_focusShootOCRMOdel_02.ms"
"--inDataPath=./hiai/hiai_cv_focusShootOCRMOdel_02.bin"
"--calibDataPath=./hiai/hiai_cv_focusShootOCRMOdel_02.txt"
};
auto
status
=
RunBenchmark
(
2
,
argv
);
ASSERT_EQ
(
status
,
RET_OK
);
}
TEST_F
(
BenchmarkTest
,
TestHebing
)
{
const
char
*
argv
[]
=
{
"./benchmark"
,
"--modelPath=./hiai/model_hebing_3branch.ms"
"--inDataPath=./hiai/model_hebing_3branch.bin"
...
...
mindspore/lite/test/ut/src/runtime/kernel/opencl/matmul_tests.cc
浏览文件 @
935e365c
...
...
@@ -52,7 +52,7 @@ TEST_F(TestMatMulOpenCL, MatMulFp32) {
auto
*
arith_kernel
=
new
kernel
::
MatMulOpenCLKernel
(
nullptr
,
inputs
,
outputs
,
false
);
arith_kernel
->
Init
();
std
::
vector
<
LiteKernel
*>
kernels
{
arith_kernel
};
std
::
vector
<
kernel
::
LiteKernel
*>
kernels
{
arith_kernel
};
auto
*
pGraph
=
new
kernel
::
SubGraphOpenCLKernel
(
inputs
,
outputs
,
kernels
,
kernels
,
kernels
);
pGraph
->
Init
();
...
...
mindspore/lite/test/ut/src/runtime/kernel/opencl/softmax_cl_tests.cc
浏览文件 @
935e365c
...
...
@@ -51,7 +51,7 @@ TEST_F(TestSoftmaxOpenCL, SoftmaxFp32) {
MS_LOG
(
INFO
)
<<
"create OpenCL Kernel"
;
auto
*
Softmax_kernel
=
new
kernel
::
SoftmaxOpenCLKernel
(
reinterpret_cast
<
OpParameter
*>
(
param
),
inputs
,
outputs
);
Softmax_kernel
->
Init
();
std
::
vector
<
LiteKernel
*>
kernels
{
Softmax_kernel
};
std
::
vector
<
kernel
::
LiteKernel
*>
kernels
{
Softmax_kernel
};
MS_LOG
(
INFO
)
<<
"create SubGraphOpenCLKernel"
;
auto
*
pGraph
=
new
kernel
::
SubGraphOpenCLKernel
(
inputs
,
outputs
,
kernels
,
kernels
,
kernels
);
...
...
mindspore/lite/tools/benchmark/benchmark.cc
浏览文件 @
935e365c
...
...
@@ -351,6 +351,8 @@ int Benchmark::RunBenchmark(const std::string &deviceType) {
auto
context
=
new
lite
::
Context
;
if
(
_flags
->
device
==
"CPU"
)
{
context
->
device_ctx_
.
type
=
lite
::
DT_CPU
;
}
else
if
(
_flags
->
device
==
"GPU"
)
{
context
->
device_ctx_
.
type
=
lite
::
DT_GPU
;
}
else
{
context
->
device_ctx_
.
type
=
lite
::
DT_NPU
;
}
...
...
mindspore/lite/tools/benchmark/benchmark.h
浏览文件 @
935e365c
...
...
@@ -57,7 +57,7 @@ class MS_API BenchmarkFlags : public virtual FlagParser {
AddFlag
(
&
BenchmarkFlags
::
inDataPath
,
"inDataPath"
,
"Input data path, if not set, use random input"
,
""
);
AddFlag
(
&
BenchmarkFlags
::
inDataTypeIn
,
"inDataType"
,
"Input data type. img | bin"
,
"bin"
);
AddFlag
(
&
BenchmarkFlags
::
omModelPath
,
"omModelPath"
,
"OM model path, only required when device is NPU"
,
""
);
AddFlag
(
&
BenchmarkFlags
::
device
,
"device"
,
"CPU | NPU"
,
"CPU"
);
AddFlag
(
&
BenchmarkFlags
::
device
,
"device"
,
"CPU | NPU
| GPU
"
,
"CPU"
);
AddFlag
(
&
BenchmarkFlags
::
cpuBindMode
,
"cpuBindMode"
,
"Input -1 for MID_CPU, 1 for HIGHER_CPU, 0 for NO_BIND, defalut value: 1"
,
1
);
// MarkPerformance
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录