parent
0e17f86580
commit
65b310205a
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
#-------------------------------------------------------------------
|
||||
# Purpose:
|
||||
# Copyright 2020 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
LOCAL_PATH=$(cd "$(dirname "$0")"; pwd)
|
||||
PKG_PATH=$(cd ${LOCAL_PATH}/..; pwd)
|
||||
LIB_P="/lib64"
|
||||
PYTHON_P="/python/site-packages"
|
||||
LIB64_PATH="${PKG_PATH}${LIB_P}"
|
||||
PYTHON_PATH="${PKG_PATH}${PYTHON_P}"
|
||||
export LD_LIBRARY_PATH="${LIB64_PATH}:${LD_LIBRARY_PATH}"
|
||||
export PYTHONPATH="${PYTHON_PATH}:${PYTHONPATH}"
|
||||
|
||||
if [ -f "${PKG_PATH}/bin/atc.bin" ];then
|
||||
atc.bin $@
|
||||
else
|
||||
fwk_atc.bin $@
|
||||
fi
|
@ -1 +1 @@
|
||||
Subproject commit 29c31bb87d8bbe6904ab6fa72034a803fb50a746
|
||||
Subproject commit 5b9a7f84a4347f8816d492aa51f2414ccf8a0744
|
@ -1 +1 @@
|
||||
Subproject commit ba956d349d8ad3e864d27467f4f0119333cbadc6
|
||||
Subproject commit 70369668abebed84942d9f355494a89e82cc1eac
|
@ -1,42 +0,0 @@
|
||||
# Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ============================================================================
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
project(ge_st CXX C)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-O1 -fPIC -Wl,-unresolved-symbols=ignore-in-shared-libs")
|
||||
|
||||
|
||||
file(GLOB_RECURSE RES50_TRAIN_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
"resnet50/resnet50_train.cc"
|
||||
"resnet50/common.cc"
|
||||
)
|
||||
|
||||
include_directories(${GE_SOURCE_DIR}/inc)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/graph)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/framework)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/external)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/external/ge)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/external/graph)
|
||||
include_directories(${GE_SOURCE_DIR}/third_party/fwkacllib/inc)
|
||||
include_directories(${GE_SOURCE_DIR}/third_party/fwkacllib/inc/ops)
|
||||
include_directories(/usr/local/HiAI/opp/op_proto/built-in/inc)
|
||||
|
||||
add_executable(st_resnet50_train ${RES50_TRAIN_SRCS})
|
||||
target_link_libraries(st_resnet50_train
|
||||
${PROTOBUF_LIBRARY}
|
||||
ge_client_train ge_memory
|
||||
)
|
File diff suppressed because it is too large
Load Diff
@ -1,102 +0,0 @@
|
||||
/**
|
||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ST_RESNET50_GE_COMMON_H_
|
||||
#define ST_RESNET50_GE_COMMON_H_
|
||||
#include "common/ge_inner_error_codes.h"
|
||||
#include "utils/tensor_utils.h"
|
||||
|
||||
#define MY_USER_GE_LOGI(...) GE_LOG_INFO(1, __VA_ARGS__)
|
||||
#define MY_USER_GE_LOGW(...) GE_LOG_WARN(1, __VA_ARGS__)
|
||||
#define MY_USER_GE_LOGE(...) GE_LOG_ERROR(1, 3, __VA_ARGS__)
|
||||
|
||||
#ifndef USER_GE_LOGI
|
||||
#define USER_GE_LOGI MY_USER_GE_LOGI
|
||||
#endif // USER_GE_LOGI
|
||||
|
||||
#ifndef USER_GE_LOGW
|
||||
#define USER_GE_LOGW MY_USER_GE_LOGW
|
||||
#endif // USER_GE_LOGW
|
||||
|
||||
#ifndef USER_GE_LOGE
|
||||
#define USER_GE_LOGE MY_USER_GE_LOGE
|
||||
#endif // USER_GE_LOGE
|
||||
|
||||
/// train_flag is 0 when infer, train_flag is 1 when train.this param is set for RunGranph_readData() and
|
||||
/// RunGraph_initData()
|
||||
#define TRAIN_FLAG_INFER "infer"
|
||||
#define TRAIN_FLAG_TRAIN "train"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include "ge_api.h"
|
||||
#include "graph.h"
|
||||
#include "ptest.h"
|
||||
#include "ops/all_ops.h"
|
||||
using namespace std;
|
||||
using namespace ge;
|
||||
|
||||
// read bin file and compile result
|
||||
void update_op_format(Operator ops, Format format = ge::FORMAT_NCHW);
|
||||
void getDimInfo(FILE *fp, std::vector<uint64_t> &dim_info);
|
||||
void *readTestDataFile(std::string infile, std::vector<uint64_t> &dim_info);
|
||||
void *readUint8TestDataFile(std::string infile, int size);
|
||||
bool allclose(float *a, float *b, uint64_t count, float rtol, float atol);
|
||||
bool compFp32WithTData(float *actual_output_data, std::string expected_data_file, float rtol, float atol);
|
||||
Tensor load_variable_input_data(string input_path, std::vector<int64_t> shapes, Format ft = ge::FORMAT_NCHW,
|
||||
DataType dt = ge::DT_FLOAT);
|
||||
// constructor Tensor
|
||||
int GetDatTypeSize(DataType dt);
|
||||
ge::Tensor genTensor(std::vector<int64_t> tensor_shape, Format format = ge::FORMAT_NCHW, DataType dt = ge::DT_FLOAT);
|
||||
ge::Tensor genTensor_withVaule(std::vector<int64_t> tensor_shape, float value = 1);
|
||||
Tensor genTesnor_Shape_as_data(std::vector<int64_t> tensor_shape);
|
||||
// Init GE
|
||||
ge::Status GEInitialize_api(string train_flag = "0", string run_mode_path = "0");
|
||||
ge::Status GEInitialize_api_new(string train_flag = "infer", string run_mode = "fe");
|
||||
ge::Status GEFinalize_api();
|
||||
// constructor session and build graph
|
||||
ge::Session *create_aipp_session();
|
||||
ge::Session *create_session();
|
||||
ge::Status session_add_and_run_graph(ge::Session *session, uint32_t graphId, Graph &graph, std::vector<Tensor> inputs,
|
||||
std::vector<Tensor> &outputs);
|
||||
|
||||
// common interface for infer
|
||||
int RunGraph_initData(Graph &graph, string op_name, map<string, std::vector<int64_t>> attr_test,
|
||||
string train_flag = "infer", string run_mode_path = "fe");
|
||||
void Inputs_load_Data(string op_name, std::vector<Tensor> &input, map<string, std::vector<int64_t>> attr_test,
|
||||
Format format = ge::FORMAT_NCHW, DataType dt = ge::DT_FLOAT);
|
||||
bool comparaData(std::vector<Tensor> &output, string op_name, map<string, std::vector<int64_t>> attr_test);
|
||||
int RunGraph_readData(Graph &graph, string op_name, map<string, std::vector<int64_t>> attr_test,
|
||||
string train_flag = "infer", string run_mode_path = "fe", Format format = ge::FORMAT_NCHW,
|
||||
DataType dt = ge::DT_FLOAT);
|
||||
|
||||
// common interface for train
|
||||
int buildCheckPointGraph(Graph &graph, map<string, TensorDesc> variables);
|
||||
int buildInitGraph(Graph &graph, std::vector<TensorDesc> desc_var, std::vector<std::string> name_var,
|
||||
std::vector<float> values_var);
|
||||
int buildInitGraph_other_dataType(Graph &graph, std::vector<TensorDesc> desc_var, std::vector<std::string> name_var);
|
||||
|
||||
bool build_multi_input_multi_output_graph(Graph &graph);
|
||||
void build_big_graph(Graph &graph, map<string, std::vector<int64_t>> attr);
|
||||
int buildConvGraph_new(Graph &graph, std::vector<TensorDesc> desc_var, std::vector<std::string> name_var, int flag = 2);
|
||||
|
||||
#endif // ST_RESNET50_GE_COMMON_H_
|
@ -1,225 +0,0 @@
|
||||
/**
|
||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ST_RESNET50_PTEST_H_
|
||||
#define ST_RESNET50_PTEST_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace ptest {
|
||||
class assertion_error : public std::exception {
|
||||
public:
|
||||
const char *what() const throw() { return "Assertion Exception"; }
|
||||
};
|
||||
|
||||
class TestFixture {
|
||||
public:
|
||||
virtual void SetUp() {}
|
||||
virtual void TearDown() {}
|
||||
void Run() { _func(); }
|
||||
void BindFunction(std::function<void(void)> function) { _func = function; }
|
||||
void SetName(const std::string &name) { _name = name; }
|
||||
std::string Name() const { return _name; }
|
||||
virtual ~TestFixture() {}
|
||||
|
||||
private:
|
||||
std::function<void(void)> _func;
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
enum TestResult { SUCCESS, FAILED, UNAVAILABLE, UNKNOWN, NOCASEFOUND };
|
||||
|
||||
class TestManager {
|
||||
public:
|
||||
static TestManager &GetSingleton() {
|
||||
static TestManager instance;
|
||||
return instance;
|
||||
}
|
||||
void RegisterTest(const std::string &name, TestFixture *fixture) { _testfixtures[name] = fixture; }
|
||||
|
||||
const std::string GetRunningTestcaseName() const { return _running_testcase_name; }
|
||||
|
||||
const std::list<std::string> GetAllTestNames() const {
|
||||
std::list<std::string> result;
|
||||
for (auto &t : _testfixtures) {
|
||||
result.push_back(t.first);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
TestResult RunTest(const std::string &name) {
|
||||
if (_testfixtures.find(name) == _testfixtures.end()) {
|
||||
return NOCASEFOUND;
|
||||
}
|
||||
|
||||
_running_testcase_name = name;
|
||||
|
||||
do {
|
||||
SetTestResult(name, UNKNOWN);
|
||||
_testfixtures[name]->SetUp();
|
||||
if (_testresults[name] == FAILED) {
|
||||
_testresults[name] = UNAVAILABLE;
|
||||
break;
|
||||
}
|
||||
SetTestResult(name, SUCCESS);
|
||||
try {
|
||||
_testfixtures[name]->Run();
|
||||
} catch (assertion_error &e) {
|
||||
// Do nothing as the error has been handled by the TestManager.
|
||||
}
|
||||
_testfixtures[name]->TearDown();
|
||||
} while (0);
|
||||
|
||||
return _testresults[name];
|
||||
}
|
||||
void SetTestResult(const std::string &name, TestResult result) { _testresults[name] = result; }
|
||||
TestResult GetTestResult(const std::string &name) { return _testresults[name]; }
|
||||
|
||||
private:
|
||||
std::map<std::string, TestFixture *> _testfixtures;
|
||||
std::map<std::string, TestResult> _testresults;
|
||||
std::string _running_testcase_name;
|
||||
};
|
||||
|
||||
class TestFixtureRegister {
|
||||
public:
|
||||
TestFixtureRegister(const std::string &name, TestFixture *fixture, std::function<void(void)> function) {
|
||||
fixture->BindFunction(function);
|
||||
fixture->SetName(name);
|
||||
TestManager::GetSingleton().RegisterTest(name, fixture);
|
||||
}
|
||||
};
|
||||
} // namespace ptest
|
||||
|
||||
#define _STR(x) #x
|
||||
#define _EMPTY_NAMESPACE
|
||||
|
||||
#define _TEST(NAMESPACE, FIXTURECLASS, TESTNAME, CASENAME) \
|
||||
void g_func_##TESTNAME##_##CASENAME(void); \
|
||||
NAMESPACE::FIXTURECLASS g_fixture_##TESTNAME##_##CASENAME; \
|
||||
ptest::TestFixtureRegister g_register_##TESTNAME##_##CASENAME( \
|
||||
_STR(TESTNAME##_##CASENAME), &g_fixture_##TESTNAME##_##CASENAME, g_func_##TESTNAME##_##CASENAME); \
|
||||
void g_func_##TESTNAME##_##CASENAME(void)
|
||||
|
||||
#define TEST(TESTNAME, CASENAME) _TEST(ptest, TestFixture, TESTNAME, CASENAME)
|
||||
|
||||
#define TEST_F(TESTFIXTURE, CASENAME) _TEST(_EMPTY_NAMESPACE, TESTFIXTURE, TESTFIXTURE, CASENAME)
|
||||
|
||||
#define EXPECT_TRUE(X) \
|
||||
do { \
|
||||
if (!(X)) { \
|
||||
std::string test_name = ptest::TestManager::GetSingleton().GetRunningTestcaseName(); \
|
||||
ptest::TestManager::GetSingleton().SetTestResult(test_name, ptest::FAILED); \
|
||||
std::cerr << #X << "Expectation Failed\n" \
|
||||
<< "Testcase Name: " << test_name << "\n" \
|
||||
<< "File: " __FILE__ << "\tLine:" << __LINE__ << std::endl; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
// With the macro definition ensures that the compiler can detect compiler warning.
|
||||
#define Max_Log_Len 1024
|
||||
#define PRINT_ERR(lpszFormat, ...) \
|
||||
do { \
|
||||
char szTmpBuf[Max_Log_Len + 1] = {0}; \
|
||||
snprintf(szTmpBuf, Max_Log_Len, lpszFormat, ##__VA_ARGS__); \
|
||||
std::cerr << szTmpBuf << std::endl; \
|
||||
} while (0)
|
||||
|
||||
// Increase the content of print error messages and error to facilitate rapid analysis
|
||||
#define EXPECT_TRUE_C(X, ERR_TYPE, format, ...) \
|
||||
do { \
|
||||
if (!(X)) { \
|
||||
std::string test_name = ptest::TestManager::GetSingleton().GetRunningTestcaseName(); \
|
||||
ptest::TestManager::GetSingleton().SetTestResult(test_name, ptest::FAILED); \
|
||||
std::cerr << #X << " Expectation Failed." \
|
||||
<< "Testcase Name: " << test_name << " File:" __FILE__ << " Line:" << __LINE__ << std::endl; \
|
||||
PRINT_ERR("[" ERR_TYPE "]" format, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ASSERT_TRUE(X) \
|
||||
do { \
|
||||
if (!(X)) { \
|
||||
std::string test_name = ptest::TestManager::GetSingleton().GetRunningTestcaseName(); \
|
||||
ptest::TestManager::GetSingleton().SetTestResult(test_name, ptest::FAILED); \
|
||||
std::cerr << #X << "Assertion Failed\n" \
|
||||
<< "Testcase Name: " << test_name << "\n" \
|
||||
<< "File: " __FILE__ << "\tLine:" << __LINE__ << std::endl; \
|
||||
throw ptest::assertion_error(); \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
// Add printing error information and error line content for quick analysis
|
||||
#define ASSERT_TRUE_C(X, ERR_TYPE, format, ...) \
|
||||
do { \
|
||||
if (!(X)) { \
|
||||
std::string test_name = ptest::TestManager::GetSingleton().GetRunningTestcaseName(); \
|
||||
ptest::TestManager::GetSingleton().SetTestResult(test_name, ptest::FAILED); \
|
||||
std::cerr << #X << " Assertion Failed." \
|
||||
<< "Testcase Name: " << test_name << " File:" __FILE__ << " Line:" << __LINE__ << std::endl; \
|
||||
PRINT_ERR("[" ERR_TYPE "]" format, ##__VA_ARGS__); \
|
||||
throw ptest::assertion_error(); \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define CONFIG_ERR "CONFIG_ERR"
|
||||
#define LOAD_MODEL_ERR "LOAD_MODEL_ERR"
|
||||
#define FILE_READ_ERR "FILE_READ_ERR"
|
||||
#define RUN_ERROR "RUN_ERROR"
|
||||
#define MEM_ERROR "MEM_ERROR"
|
||||
#define RESULT_ERR "RESULT_ERR"
|
||||
|
||||
#define EXPECT_FALSE(X) EXPECT_TRUE(!(X))
|
||||
#define EXPECT_EQ(X, Y) EXPECT_TRUE(((X) == (Y)))
|
||||
#define EXPECT_NE(X, Y) EXPECT_TRUE(((X) != (Y)))
|
||||
#define EXPECT_GT(X, Y) EXPECT_TRUE(((X) > (Y)))
|
||||
#define EXPECT_GE(X, Y) EXPECT_TRUE(((X) >= (Y)))
|
||||
#define EXPECT_LT(X, Y) EXPECT_TRUE(((X) < (Y)))
|
||||
#define EXPECT_LE(X, Y) EXPECT_TRUE(((X) <= (Y)))
|
||||
|
||||
#define EXPECT_FALSE_C(X, ERR_TYPE, format, ...) EXPECT_TRUE_C(!(X), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define EXPECT_EQ_C(X, Y, ERR_TYPE, format, ...) EXPECT_TRUE_C(((X) == (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define EXPECT_NE_C(X, Y, ERR_TYPE, format, ...) EXPECT_TRUE_C(((X) != (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define EXPECT_GT_C(X, Y, ERR_TYPE, format, ...) EXPECT_TRUE_C(((X) > (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define EXPECT_GE_C(X, Y, ERR_TYPE, format, ...) EXPECT_TRUE_C(((X) >= (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define EXPECT_LT_C(X, Y, ERR_TYPE, format, ...) EXPECT_TRUE_C(((X) < (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define EXPECT_LE_C(X, Y, ERR_TYPE, format, ...) EXPECT_TRUE_C(((X) <= (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
|
||||
#define ASSERT_FALSE(X) ASSERT_TRUE(!(X))
|
||||
#define ASSERT_EQ(X, Y) ASSERT_TRUE(((X) == (Y)))
|
||||
#define ASSERT_NE(X, Y) ASSERT_TRUE(((X) != (Y)))
|
||||
#define ASSERT_GT(X, Y) ASSERT_TRUE(((X) > (Y)))
|
||||
#define ASSERT_GE(X, Y) ASSERT_TRUE(((X) >= (Y)))
|
||||
#define ASSERT_LT(X, Y) ASSERT_TRUE(((X) < (Y)))
|
||||
#define ASSERT_LE(X, Y) ASSERT_TRUE(((X) <= (Y)))
|
||||
|
||||
#define ASSERT_FALSE_C(X, ERR_TYPE, format, ...) ASSERT_TRUE_C(!(X), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define ASSERT_EQ_C(X, Y, ERR_TYPE, format, ...) ASSERT_TRUE_C(((X) == (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define ASSERT_NE_C(X, Y, ERR_TYPE, format, ...) ASSERT_TRUE_C(((X) != (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define ASSERT_GT_C(X, Y, ERR_TYPE, format, ...) ASSERT_TRUE_C(((X) > (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define ASSERT_GE_C(X, Y, ERR_TYPE, format, ...) ASSERT_TRUE_C(((X) >= (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define ASSERT_LT_C(X, Y, ERR_TYPE, format, ...) ASSERT_TRUE_C(((X) < (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
#define ASSERT_LE_C(X, Y, ERR_TYPE, format, ...) ASSERT_TRUE_C(((X) <= (Y)), ERR_TYPE, format, ##__VA_ARGS__)
|
||||
|
||||
#endif // ST_RESNET50_PTEST_H_
|
File diff suppressed because it is too large
Load Diff
@ -1,56 +0,0 @@
|
||||
# Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ============================================================================
|
||||
|
||||
"""
|
||||
ge st test.
|
||||
"""
|
||||
import pytest
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
@pytest.mark.level0
|
||||
@pytest.mark.platform_arm_ascend_training
|
||||
@pytest.mark.platform_x86_ascend_training
|
||||
@pytest.mark.env_card
|
||||
@pytest.mark.component_ge
|
||||
def test_resnet50_train():
|
||||
ge_st_dir=os.environ.get('GE_ST_DIR',
|
||||
'/home/jenkins/workspace/release_pkg/gate/graphengine_lib')
|
||||
ge_lib_dir=os.environ.get('GRAPHENGINE_LIB', '/home/jenkins/workspace/release_pkg/gate/graphengine_lib')
|
||||
|
||||
real_pythonpath=os.environ.get('REAL_PYTHONPATH')
|
||||
pythonpath=os.environ.get('PYTHONPATH')
|
||||
if real_pythonpath:
|
||||
if pythonpath:
|
||||
os.environ['PYTHONPATH']=real_pythonpath+':'+pythonpath
|
||||
else:
|
||||
os.environ['PYTHONPATH']=real_pythonpath
|
||||
print('PYTHONPATH: '+os.environ.get('PYTHONPATH'))
|
||||
|
||||
os.environ['ASCEND_OPP_PATH']='/usr/local/Ascend/opp'
|
||||
os.environ['ASCEND_ENGINE_PATH']='/usr/local/Ascend/fwkacllib/lib64/plugin/opskernel/libaicpu_engine.so:' \
|
||||
'/usr/local/Ascend/fwkacllib/lib64/plugin/opskernel/libfe.so:' \
|
||||
'/usr/local/Ascend/fwkacllib/lib64/plugin/opskernel/librts_engine.so:'+ \
|
||||
ge_lib_dir + '/libge_local_engine.so'
|
||||
print('ASCEND_OPP_PATH: '+os.environ.get('ASCEND_OPP_PATH'))
|
||||
print('ASCEND_ENGINE_PATH: '+os.environ.get('ASCEND_ENGINE_PATH'))
|
||||
print('LD_LIBRARY_PATH: '+os.environ.get('LD_LIBRARY_PATH'))
|
||||
|
||||
cmd=ge_st_dir + '/st_resnet50_train'
|
||||
print('cmd: '+cmd)
|
||||
os.environ['SLOG_PRINT_TO_STDOUT']="1"
|
||||
ret=subprocess.call([cmd], shell=True)
|
||||
assert ret==0
|
||||
|
Loading…
Reference in new issue