clean bc warning and add atc.bin fwk_atc.bin

pull/539/head
taoxudonghaha 4 years ago
parent 0e17f86580
commit 65b310205a

@ -11,13 +11,13 @@ set(SRC_LIST
"main.cc"
"single_op_parser.cc"
"../session/omg.cc"
"../ir_build/atc_ir_common.cc"
"../ir_build/atc_ir_common.cc"
)
############ atc ############
add_executable(atc ${SRC_LIST} ${PROTO_HDRS})
target_compile_options(atc PRIVATE
target_compile_options(atc PRIVATE
-Werror
-O2
-Wno-deprecated-declarations
@ -74,10 +74,130 @@ target_link_libraries(atc PRIVATE
-ldl
)
############ atc.bin ############
add_executable(atc.bin ${SRC_LIST} ${PROTO_HDRS})
target_compile_options(atc.bin PRIVATE
-Werror
-O2
-Wno-deprecated-declarations
)
target_compile_definitions(atc.bin PRIVATE
PROTOBUF_INLINE_NOT_IN_HEADERS=0
COMPILE_OMG_PACKAGE
google=ascend_private
)
target_include_directories(atc.bin PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${GE_CODE_DIR}
${GE_CODE_DIR}/ge
${GE_CODE_DIR}/inc/external
${GE_CODE_DIR}/common/inc/external
${GE_CODE_DIR}/common/inc/external/graph
${GE_CODE_DIR}/inc
${GE_CODE_DIR}/inc/framework
${METADEF_DIR}/inc
${METADEF_DIR}/inc/graph
${METADEF_DIR}/inc/register
${METADEF_DIR}/inc/external
${METADEF_DIR}/inc/external/graph
${METADEF_DIR}/inc/external/register
${PARSER_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/proto/ge
#### yellow zone ####
${GE_CODE_DIR}/../inc
${GE_CODE_DIR}/../inc/common
#### blue zone ####
${GE_CODE_DIR}/third_party/fwkacllib/inc
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
)
target_link_libraries(atc.bin PRIVATE
$<BUILD_INTERFACE:intf_pub>
ascend_protobuf
ge_common
register
c_sec
graph
error_manager
ge_compiler
parser_common
gflags
json
runtime_compile
slog
static_mmpa
-lrt
-ldl
)
############ fwk_atc.bin ############
add_executable(fwk_atc.bin ${SRC_LIST} ${PROTO_HDRS})
target_compile_options(fwk_atc.bin PRIVATE
-Werror
-O2
-Wno-deprecated-declarations
)
target_compile_definitions(fwk_atc.bin PRIVATE
PROTOBUF_INLINE_NOT_IN_HEADERS=0
COMPILE_OMG_PACKAGE
google=ascend_private
)
target_include_directories(fwk_atc.bin PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${GE_CODE_DIR}
${GE_CODE_DIR}/ge
${GE_CODE_DIR}/inc/external
${GE_CODE_DIR}/common/inc/external
${GE_CODE_DIR}/common/inc/external/graph
${GE_CODE_DIR}/inc
${GE_CODE_DIR}/inc/framework
${METADEF_DIR}/inc
${METADEF_DIR}/inc/graph
${METADEF_DIR}/inc/register
${METADEF_DIR}/inc/external
${METADEF_DIR}/inc/external/graph
${METADEF_DIR}/inc/external/register
${PARSER_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/proto/ge
#### yellow zone ####
${GE_CODE_DIR}/../inc
${GE_CODE_DIR}/../inc/common
#### blue zone ####
${GE_CODE_DIR}/third_party/fwkacllib/inc
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
)
target_link_libraries(fwk_atc.bin PRIVATE
$<BUILD_INTERFACE:intf_pub>
ascend_protobuf
ge_common
register
c_sec
graph
error_manager
ge_compiler
parser_common
gflags
json
runtime_compile
slog
static_mmpa
-lrt
-ldl
)
############ install ############
set(INSTALL_BASE_DIR "")
set(INSTALL_LIBRARY_DIR lib)
install(TARGETS atc OPTIONAL
install(TARGETS atc atc.bin fwk_atc.bin OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
)

@ -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

@ -54,3 +54,108 @@ LOCAL_LDFLAGS := -lrt -ldl
include $(BUILD_HOST_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := atc.bin
LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations
LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -DCOMPILE_OMG_PACKAGE -O2 -Dgoogle=ascend_private
LOCAL_SRC_FILES := \
main.cc \
single_op_parser.cc \
../session/omg.cc \
../ir_build/atc_ir_common.cc \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../ ./ \
$(TOPDIR)inc \
$(TOPDIR)metadef/inc \
$(TOPDIR)graphengine/inc \
$(TOPDIR)inc/external \
$(TOPDIR)metadef/inc/external \
$(TOPDIR)graphengine/inc/external \
$(TOPDIR)metadef/inc/external/graph \
$(TOPDIR)graphengine/inc/framework \
$(TOPDIR)libc_sec/include \
$(TOPDIR)metadef/inc/common/util \
$(TOPDIR)parser \
third_party/json/include \
third_party/gflags/include \
third_party/protobuf/include \
proto/om.proto \
proto/ge_ir.proto \
proto/task.proto \
proto/insert_op.proto \
LOCAL_SHARED_LIBRARIES := \
libc_sec \
libge_common \
libascend_protobuf \
libslog \
libgraph \
libregister \
liberror_manager \
libge_compiler \
libruntime_compile \
libparser_common \
liberror_manager \
LOCAL_STATIC_LIBRARIES := libgflags
LOCAL_LDFLAGS := -lrt -ldl
include $(BUILD_HOST_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := fwk_atc.bin
LOCAL_CFLAGS += -Werror -Wno-deprecated-declarations
LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -DCOMPILE_OMG_PACKAGE -O2 -Dgoogle=ascend_private
LOCAL_SRC_FILES := \
main.cc \
single_op_parser.cc \
../session/omg.cc \
../ir_build/atc_ir_common.cc \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../ ./ \
$(TOPDIR)inc \
$(TOPDIR)metadef/inc \
$(TOPDIR)graphengine/inc \
$(TOPDIR)inc/external \
$(TOPDIR)metadef/inc/external \
$(TOPDIR)graphengine/inc/external \
$(TOPDIR)metadef/inc/external/graph \
$(TOPDIR)graphengine/inc/framework \
$(TOPDIR)libc_sec/include \
$(TOPDIR)metadef/inc/common/util \
$(TOPDIR)parser \
third_party/json/include \
third_party/gflags/include \
third_party/protobuf/include \
proto/om.proto \
proto/ge_ir.proto \
proto/task.proto \
proto/insert_op.proto \
LOCAL_SHARED_LIBRARIES := \
libc_sec \
libge_common \
libascend_protobuf \
libslog \
libgraph \
libregister \
liberror_manager \
libge_compiler \
libruntime_compile \
libparser_common \
liberror_manager \
LOCAL_STATIC_LIBRARIES := libgflags
LOCAL_LDFLAGS := -lrt -ldl
include $(BUILD_HOST_EXECUTABLE)

@ -1,3 +1,10 @@
#!/usr/bin/python3.7
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------
# Purpose:
# Copyright 2020 Huawei Technologies Co., Ltd. All rights reserved.
#-------------------------------------------------------------------
import os
import re
import sys

@ -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…
Cancel
Save