diff --git a/paddle/fluid/distributed/index_dataset/CMakeLists.txt b/paddle/fluid/distributed/index_dataset/CMakeLists.txt index 6edb9834d49eb752a88bacf3cf7d0cd72f081100..98bc0a0ad4a26f10319ae4650620fe51cb0fdcff 100644 --- a/paddle/fluid/distributed/index_dataset/CMakeLists.txt +++ b/paddle/fluid/distributed/index_dataset/CMakeLists.txt @@ -1,9 +1,9 @@ proto_library(index_dataset_proto SRCS index_dataset.proto) cc_library(index_wrapper SRCS index_wrapper.cc DEPS index_dataset_proto fs) if(WITH_MKLDNN) - cc_library(index_sampler SRCS index_sampler.cc DEPS xxhash index_wrapper mkldnn) + cc_library(index_sampler SRCS index_sampler.cc DEPS xxhash index_wrapper eigen3 mkldnn) else() - cc_library(index_sampler SRCS index_sampler.cc DEPS xxhash index_wrapper) + cc_library(index_sampler SRCS index_sampler.cc DEPS xxhash index_wrapper eigen3) endif() if(WITH_PYTHON) py_proto_compile(index_dataset_py_proto SRCS index_dataset.proto) diff --git a/paddle/fluid/operators/concat_op_mlu.cc b/paddle/fluid/operators/concat_op_mlu.cc index f7a1cae72be5a42d15d2e89663010489f529962a..6325d1ccda8c83e0ef1f1b735b3fe99596e03639 100644 --- a/paddle/fluid/operators/concat_op_mlu.cc +++ b/paddle/fluid/operators/concat_op_mlu.cc @@ -45,7 +45,8 @@ class ConcatMLUKernel : public framework::OpKernel { ins_dims[i] = ins[i]->dims(); } - framework::DDim out_dims = ComputeAndCheckShape(true, ins_dims, axis); + framework::DDim out_dims = + pten::funcs::ComputeAndCheckShape(true, ins_dims, axis); out->Resize(out_dims); } const int axis_t = axis; diff --git a/paddle/fluid/operators/fill_constant_op_mlu.cc b/paddle/fluid/operators/fill_constant_op_mlu.cc index d161a857d6c1778e8136702564dae2582c8a0465..c265977715ff147bf360cafb92a86538ce828d90 100644 --- a/paddle/fluid/operators/fill_constant_op_mlu.cc +++ b/paddle/fluid/operators/fill_constant_op_mlu.cc @@ -63,7 +63,8 @@ class FillConstantMLUKernel : public framework::OpKernel { framework::Tensor mlu_tensor; auto tmp_place = value_tensor->place(); if (platform::is_mlu_place(tmp_place)) { - TensorCopySync(*value_tensor, platform::CPUPlace(), &mlu_tensor); + framework::TensorCopySync(*value_tensor, platform::CPUPlace(), + &mlu_tensor); tensor_data = mlu_tensor.data(); } value = tensor_data[0]; diff --git a/paddle/fluid/operators/mlu/CMakeLists.txt b/paddle/fluid/operators/mlu/CMakeLists.txt index 59fab48b271d556c84d4f502022d41ec6d830e0a..efd6aeb8eeb1c35290e69e49f1a6b5cd75a4880a 100644 --- a/paddle/fluid/operators/mlu/CMakeLists.txt +++ b/paddle/fluid/operators/mlu/CMakeLists.txt @@ -1,5 +1,5 @@ IF(WITH_MLU) - cc_library(mlu_baseop SRCS mlu_baseop.cc DEPS neuware_lib framework_proto xxhash) + cc_library(mlu_baseop SRCS mlu_baseop.cc DEPS neuware_lib device_context) cc_test(activation_op_mlu_test SRCS activation_op_mlu_test.cc DEPS op_registry activation_op scope device_context executor) ENDIF() diff --git a/paddle/fluid/operators/split_op_mlu.cc b/paddle/fluid/operators/split_op_mlu.cc index c569c9bf091335a01dfb2d70808cb6ce0bb66812..d6d3f4c99aa052aa87fb6365c77d3cba8a2f5cab 100644 --- a/paddle/fluid/operators/split_op_mlu.cc +++ b/paddle/fluid/operators/split_op_mlu.cc @@ -58,7 +58,6 @@ class SplitMLUKernel : public framework::OpKernel { std::vector vct_tensor; std::vector output_descs; std::vector desc_vector; - auto place = ctx.GetPlace(); for (size_t i = 0; i < outs.size(); i++) { outs[i]->mutable_data(ctx.GetPlace()); output_descs.emplace_back(MLUCnnlTensorDesc( diff --git a/paddle/fluid/operators/sum_op_mlu.cc b/paddle/fluid/operators/sum_op_mlu.cc index e2cd649722b2444bb7a032eac18760e582db71d8..59f3a424479bb5c971d9e86e4be4283f45a2b79c 100644 --- a/paddle/fluid/operators/sum_op_mlu.cc +++ b/paddle/fluid/operators/sum_op_mlu.cc @@ -33,7 +33,7 @@ class SumMLUKernel : public framework::OpKernel { auto place = ctx.GetPlace(); int ins_size = static_cast(ins.size()); if (ins_size == 1) { - TensorCopy(*ins[0], place, out); + framework::TensorCopy(*ins[0], place, out); return; } diff --git a/paddle/fluid/platform/CMakeLists.txt b/paddle/fluid/platform/CMakeLists.txt index a151c824a220fba6e0b72c1f7869f22b48a30dab..7dc07942d44b14014513f441238418239fd29abb 100644 --- a/paddle/fluid/platform/CMakeLists.txt +++ b/paddle/fluid/platform/CMakeLists.txt @@ -55,6 +55,12 @@ ENDIF() cc_library(place SRCS place.cc DEPS enforce boost pten_place) cc_test(place_test SRCS place_test.cc DEPS place glog gflags) +IF(WITH_MKLDNN) + set(MKLDNN_CTX_DEPS mkldnn) +ELSE() + set(MKLDNN_CTX_DEPS) +ENDIF() + add_subdirectory(device) add_subdirectory(dynload) add_subdirectory(stream) @@ -85,12 +91,6 @@ IF(WITH_MLU) set(MLU_CTX_DEPS mlu_device_context) ENDIF() -IF(WITH_MKLDNN) - set(MKLDNN_CTX_DEPS mkldnn) -ELSE() - set(MKLDNN_CTX_DEPS) -ENDIF() - IF(WITH_ASCEND_CL OR WITH_MLU) cc_library(stream_callback_manager SRCS stream_callback_manager.cc DEPS simple_threadpool enforce) ENDIF() diff --git a/paddle/fluid/platform/device/CMakeLists.txt b/paddle/fluid/platform/device/CMakeLists.txt index c5fe211470949e4023bb28c6f0e9d1888d66a1fc..2cd068badf51e8a3176de4ec80700ce7057862d1 100644 --- a/paddle/fluid/platform/device/CMakeLists.txt +++ b/paddle/fluid/platform/device/CMakeLists.txt @@ -1,10 +1,12 @@ +# GPU +IF(WITH_GPU OR WITH_ROCM) + add_subdirectory(gpu) +ENDIF() + # XPU IF(WITH_XPU) add_subdirectory(xpu) ENDIF() -IF(WITH_GPU OR WITH_ROCM) - add_subdirectory(gpu) -ENDIF() # NPU IF(WITH_ASCEND OR WITH_ASCEND_CL) diff --git a/paddle/fluid/platform/device/mlu/CMakeLists.txt b/paddle/fluid/platform/device/mlu/CMakeLists.txt index a4584f54637a615d79995e1e27303128b4202b5e..e8b794a03e38db5c2f5c5f471b4ed419a4884b43 100644 --- a/paddle/fluid/platform/device/mlu/CMakeLists.txt +++ b/paddle/fluid/platform/device/mlu/CMakeLists.txt @@ -1,10 +1,10 @@ -IF(WITH_MLU) - cc_test(mlu_enforce_test SRCS enforce_test.cc DEPS stringpiece) - cc_library(mlu_info SRCS mlu_info.cc DEPS enforce glog monitor neuware_lib) +if(NOT WITH_MLU) + return() +endif() - cc_library(mlu_stream SRCS mlu_stream.cc DEPS boost mlu_info stream_callback_manager) - - cc_library(mlu_device_context SRCS device_context.cc DEPS mlu_stream eigen3) - cc_test(mlu_device_context_test SRCS device_context_test.cc DEPS mlu_device_context) -ENDIF() +cc_test(mlu_enforce_test SRCS enforce_test.cc DEPS stringpiece) +cc_library(mlu_info SRCS mlu_info.cc DEPS enforce glog monitor neuware_lib) +cc_library(mlu_stream SRCS mlu_stream.cc DEPS boost mlu_info stream_callback_manager eigen3 ${MKLDNN_CTX_DEPS}) +cc_library(mlu_device_context SRCS device_context.cc DEPS mlu_stream) +cc_test(mlu_device_context_test SRCS device_context_test.cc DEPS mlu_device_context) diff --git a/paddle/fluid/platform/stream/CMakeLists.txt b/paddle/fluid/platform/stream/CMakeLists.txt index 623b069df9b571dd7a169cfe641066b2b1cae802..6a825e9077c0a47b1daa98d7da7fce6cac281cde 100644 --- a/paddle/fluid/platform/stream/CMakeLists.txt +++ b/paddle/fluid/platform/stream/CMakeLists.txt @@ -1,9 +1,3 @@ -IF(WITH_MKLDNN) - set(MKLDNN_CTX_DEPS mkldnn) -ELSE() - set(MKLDNN_CTX_DEPS) -ENDIF() - IF(WITH_GPU OR WITH_ROCM) -cc_library(cuda_stream SRCS cuda_stream.cc DEPS enforce boost ${MKLDNN_CTX_DEPS}) + cc_library(cuda_stream SRCS cuda_stream.cc DEPS enforce boost eigen3 ${MKLDNN_CTX_DEPS}) ENDIF() diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 384dfbf558f42926e40f1fbe4c8611547037d180..d1fb2ba13bb65c968340e3ebc55e5a218ca962ad 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -227,6 +227,7 @@ function cmake_base() { -DWITH_GLOO=${gloo_flag} -DWITH_LITE=${WITH_LITE:-OFF} -DWITH_XPU=${WITH_XPU:-OFF} + -DWITH_MLU=${WITH_MLU:-OFF} -DLITE_GIT_TAG=release/v2.10 -DWITH_UNITY_BUILD=${WITH_UNITY_BUILD:-OFF} -DWITH_XPU_BKCL=${WITH_XPU_BKCL:-OFF} @@ -275,6 +276,7 @@ EOF -DWITH_GLOO=${gloo_flag} \ -DLITE_GIT_TAG=release/v2.10 \ -DWITH_XPU=${WITH_XPU:-OFF} \ + -DWITH_MLU=${WITH_MLU:-OFF} \ -DXPU_SDK_ROOT=${XPU_SDK_ROOT:-""} \ -DWITH_LITE=${WITH_LITE:-OFF} \ -DWITH_XPU_BKCL=${WITH_XPU_BKCL:-OFF} \ diff --git a/tools/dockerfile/Dockerfile.paddle-mlu-build b/tools/dockerfile/Dockerfile.paddle-mlu-build new file mode 100644 index 0000000000000000000000000000000000000000..6fcf6b6278d75f1aeb4006c03de57b56eef23e59 --- /dev/null +++ b/tools/dockerfile/Dockerfile.paddle-mlu-build @@ -0,0 +1,5 @@ +FROM registry.baidubce.com/qili93/paddle-mlu:neuware-latest +RUN apt-get install pigz -y +RUN apt-get remove -y openjdk* +CMD ["/bin/bash"] +EXPOSE 22