"src/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "cedfbd8840250e8035f94ebe2fc6f1665f8dec46"
Unverified Commit 1c417ae7 authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Fix issues with python 'ImportError' (#690)

* Fix issue with module wrapper

* Formatting

* Remove custom build of python 3.6

* Fix print function in tests

* Formatting

* Install onnx

* Download the models

* Add gcc 5

* Boost time limit for now

* Try to use oauth instead of app

* Disable all warnings
parent 1bfb147d
FROM ubuntu:xenial-20180417 FROM ubuntu:18.04
ARG PREFIX=/usr/local ARG PREFIX=/usr/local
...@@ -23,6 +23,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow- ...@@ -23,6 +23,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
comgr \ comgr \
curl \ curl \
doxygen \ doxygen \
g++-5 \
g++-7 \ g++-7 \
gdb \ gdb \
git \ git \
......
...@@ -32,7 +32,7 @@ def rocmtestnode(Map conf) { ...@@ -32,7 +32,7 @@ def rocmtestnode(Map conf) {
stage("checkout ${variant}") { stage("checkout ${variant}") {
checkout scm checkout scm
} }
gitStatusWrapper(credentialsId: 'github-app-rocm-mici', gitHubContext: "Jenkins - ${variant}", account: 'ROCmSoftwarePlatform', repo: 'AMDMIGraphX') { gitStatusWrapper(credentialsId: '7126e5fe-eb51-4576-b52b-9aaf1de8f0fd', gitHubContext: "Jenkins - ${variant}", account: 'ROCmSoftwarePlatform', repo: 'AMDMIGraphX') {
pre() pre()
stage("image ${variant}") { stage("image ${variant}") {
try { try {
...@@ -43,7 +43,7 @@ def rocmtestnode(Map conf) { ...@@ -43,7 +43,7 @@ def rocmtestnode(Map conf) {
} }
} }
withDockerContainer(image: image, args: "--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE ${docker_args}") { withDockerContainer(image: image, args: "--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE ${docker_args}") {
timeout(time: 1, unit: 'HOURS') { timeout(time: 2, unit: 'HOURS') {
body(cmake_build) body(cmake_build)
} }
} }
......
...@@ -46,13 +46,16 @@ function(py_add_module NAME) ...@@ -46,13 +46,16 @@ function(py_add_module NAME)
endfunction() endfunction()
set(PYTHON_SEARCH_VERSIONS 2.7 3.5 3.6 3.7 3.8 3.9) set(PYTHON_SEARCH_VERSIONS 2.7 3.5 3.6 3.7 3.8 3.9)
set(PYTHON_VERSIONS) set(_PYTHON_VERSIONS)
foreach(PYTHON_VERSION ${PYTHON_SEARCH_VERSIONS}) foreach(PYTHON_VERSION ${PYTHON_SEARCH_VERSIONS})
find_python(${PYTHON_VERSION}) find_python(${PYTHON_VERSION})
if(TARGET python${PYTHON_VERSION}::headers) if(TARGET python${PYTHON_VERSION}::headers)
message(STATUS "Python ${PYTHON_VERSION} found.") message(STATUS "Python ${PYTHON_VERSION} found.")
list(APPEND PYTHON_VERSIONS ${PYTHON_VERSION}) list(APPEND _PYTHON_VERSIONS ${PYTHON_VERSION})
else() else()
message(STATUS "Python ${PYTHON_VERSION} not found.") message(STATUS "Python ${PYTHON_VERSION} not found.")
endif() endif()
endforeach() endforeach()
\ No newline at end of file
# Make the variable global
set(PYTHON_VERSIONS "${_PYTHON_VERSIONS}" CACHE INTERNAL "" FORCE)
...@@ -48,6 +48,13 @@ RUN pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar. ...@@ -48,6 +48,13 @@ RUN pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.
ADD doc/requirements.txt /doc-requirements.txt ADD doc/requirements.txt /doc-requirements.txt
RUN pip3 install -r /doc-requirements.txt RUN pip3 install -r /doc-requirements.txt
RUN pip3 install onnx==1.7.0 numpy==1.18.5 typing==3.7.4 pytest==6.0.1
# Download real models to run onnx unit tests
ENV ONNX_HOME=$HOME
COPY ./tools/download_models.sh /
RUN chmod +x /download_models.sh && /download_models.sh && rm /download_models.sh
# Install dependencies # Install dependencies
ADD dev-requirements.txt /dev-requirements.txt ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt ADD requirements.txt /requirements.txt
......
...@@ -213,6 +213,8 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -213,6 +213,8 @@ inline namespace MIGRAPHX_INLINE_NS {
struct module_wrap struct module_wrap
{ {
migraphx::program* prog; migraphx::program* prog;
operator const migraphx::program&() const { return *prog; }
operator migraphx::program&() { return *prog; }
}; };
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
...@@ -256,9 +258,12 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m) ...@@ -256,9 +258,12 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m)
py::class_<migraphx::target>(m, "target"); py::class_<migraphx::target>(m, "target");
py::class_<migraphx::module>(m, "module").def("print", [](const migraphx::module& mm) { py::class_<migraphx::module_wrap>(m, "module")
std::cout << mm << std::endl; .def("print", [](const migraphx::module_wrap& mm) { std::cout << *mm.prog << std::endl; })
}); .def("__eq__", std::equal_to<migraphx::program>{})
.def("__ne__", std::not_equal_to<migraphx::program>{})
.def("__repr__",
[](const migraphx::module_wrap& mm) { return migraphx::to_string(*mm.prog); });
py::class_<migraphx::program>(m, "program") py::class_<migraphx::program>(m, "program")
.def("clone", [](migraphx::program& p) { return *(new migraphx::program(p)); }) .def("clone", [](migraphx::program& p) { return *(new migraphx::program(p)); })
...@@ -279,7 +284,7 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m) ...@@ -279,7 +284,7 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m)
.def("get_main_module", .def("get_main_module",
[](migraphx::program& p) { [](migraphx::program& p) {
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
return migraphx::module{*mm}; return migraphx::module_wrap{mm};
}) })
.def("run", .def("run",
[](migraphx::program& p, py::dict params) { [](migraphx::program& p, py::dict params) {
...@@ -294,6 +299,7 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m) ...@@ -294,6 +299,7 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m)
return p.eval(pm); return p.eval(pm);
}) })
.def("sort", &migraphx::program::sort) .def("sort", &migraphx::program::sort)
.def("print", [](const migraphx::program& p) { std::cout << p << std::endl; })
.def("__eq__", std::equal_to<migraphx::program>{}) .def("__eq__", std::equal_to<migraphx::program>{})
.def("__ne__", std::not_equal_to<migraphx::program>{}) .def("__ne__", std::not_equal_to<migraphx::program>{})
.def("__repr__", [](const migraphx::program& p) { return migraphx::to_string(p); }); .def("__repr__", [](const migraphx::program& p) { return migraphx::to_string(p); });
......
File mode changed from 100644 to 100755
...@@ -56,8 +56,8 @@ def test_add_scalar(): ...@@ -56,8 +56,8 @@ def test_add_scalar():
def test_module(): def test_module():
p = migraphx.parse_onnx("add_scalar_test.onnx") p = migraphx.parse_onnx("add_scalar_test.onnx")
mm = p.get_main_module() mm = p.get_main_module()
p.print() print(p)
mm.print() print(mm)
test_conv_relu() test_conv_relu()
......
...@@ -2,6 +2,6 @@ cd /onnxruntime ...@@ -2,6 +2,6 @@ cd /onnxruntime
pip3 install -r requirements.txt pip3 install -r requirements.txt
# Add newer cmake to the path # Add newer cmake to the path
export PATH="/opt/cmake/bin:$PATH" export PATH="/opt/cmake/bin:$PATH"
export CXXFLAGS="-D__HIP_PLATFORM_HCC__=1" export CXXFLAGS="-D__HIP_PLATFORM_HCC__=1 -w"
./build.sh --config Release --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --test --use_migraphx ./build.sh --config Release --update --build --parallel --cmake_extra_defines ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --test --use_migraphx
# pip3 install /code/onnxruntime/build/Linux/Release/dist/*.whl # pip3 install /code/onnxruntime/build/Linux/Release/dist/*.whl
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment