Unverified Commit 333e2dc4 authored by Sevin F. Varoglu's avatar Sevin F. Varoglu Committed by GitHub

Remove condition from allreduce op class (#561)

* Remove NGRAPH_DISTRIBUTED from allreduce op class
* Add allreduce doc
parent f4ff1c3b
.. allreduce.rst:
###
AllReduce
###
.. code-block:: cpp
AllReduce // Collective operation
Description
===========
Combines values from all processes or devices and distributes the result back
to all processes or devices.
Inputs
------
+-----------------+-------------------------+--------------------------------+
| Name | Element Type | Shape |
+=================+=========================+================================+
| ``arg`` | ``element::f32`` | Any |
| | ``element::f64`` | |
+-----------------+-------------------------+--------------------------------+
Outputs
-------
+-----------------+-------------------------+--------------------------------+
| Name | Element Type | Shape |
+=================+=========================+================================+
| ``output`` | ``element::f32`` | Same as ``arg`` |
| | ``element::f64`` | |
+-----------------+-------------------------+--------------------------------+
C++ Interface
=============
.. doxygenclass:: ngraph::op::AllReduce
:project: ngraph
:members:
...@@ -52,6 +52,7 @@ Not currently a comprehensive list. ...@@ -52,6 +52,7 @@ Not currently a comprehensive list.
abs.rst abs.rst
acos.rst acos.rst
add.rst add.rst
allreduce.rst
asin.rst asin.rst
atan.rst atan.rst
avg_pool.rst avg_pool.rst
......
...@@ -34,6 +34,7 @@ set (SRC ...@@ -34,6 +34,7 @@ set (SRC
node.cpp node.cpp
ops/abs.cpp ops/abs.cpp
ops/add.cpp ops/add.cpp
ops/allreduce.cpp
ops/avg_pool.cpp ops/avg_pool.cpp
ops/batch_norm.cpp ops/batch_norm.cpp
ops/broadcast.cpp ops/broadcast.cpp
...@@ -215,11 +216,6 @@ if(NGRAPH_DISTRIBUTED_ENABLE AND MPI_CXX_INCLUDE_PATH) ...@@ -215,11 +216,6 @@ if(NGRAPH_DISTRIBUTED_ENABLE AND MPI_CXX_INCLUDE_PATH)
include_directories(SYSTEM ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH}) include_directories(SYSTEM ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH})
link_directories(${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES}) link_directories(${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES})
# Add sources for distributed ngraph
# and all its dependencies
set(SRC ${SRC}
ops/allreduce.cpp
)
set_property(SOURCE codegen/compiler.cpp APPEND PROPERTY COMPILE_DEFINITIONS set_property(SOURCE codegen/compiler.cpp APPEND PROPERTY COMPILE_DEFINITIONS
"MPI_HEADER_PATH=\"${MPI_C_INCLUDE_PATH}\";") "MPI_HEADER_PATH=\"${MPI_C_INCLUDE_PATH}\";")
endif() endif()
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include "ngraph/ops/abs.hpp" #include "ngraph/ops/abs.hpp"
#include "ngraph/ops/acos.hpp" #include "ngraph/ops/acos.hpp"
#include "ngraph/ops/add.hpp" #include "ngraph/ops/add.hpp"
#include "ngraph/ops/allreduce.hpp"
#include "ngraph/ops/asin.hpp" #include "ngraph/ops/asin.hpp"
#include "ngraph/ops/atan.hpp" #include "ngraph/ops/atan.hpp"
#include "ngraph/ops/avg_pool.hpp" #include "ngraph/ops/avg_pool.hpp"
...@@ -130,7 +131,3 @@ ...@@ -130,7 +131,3 @@
#include "ngraph/shape.hpp" #include "ngraph/shape.hpp"
#include "ngraph/types/element_type.hpp" #include "ngraph/types/element_type.hpp"
#include "ngraph/types/type.hpp" #include "ngraph/types/type.hpp"
#ifdef NGRAPH_DISTRIBUTED
#include "ngraph/ops/allreduce.hpp"
#endif
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef NGRAPH_DISTRIBUTED
#include "ngraph/ops/allreduce.hpp" #include "ngraph/ops/allreduce.hpp"
using namespace std; using namespace std;
...@@ -31,5 +29,3 @@ op::AllReduce::AllReduce(const std::shared_ptr<Node>& arg) ...@@ -31,5 +29,3 @@ op::AllReduce::AllReduce(const std::shared_ptr<Node>& arg)
throw ngraph_error("Unsupported data type for AllReduce"); throw ngraph_error("Unsupported data type for AllReduce");
} }
} }
#endif
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#pragma once #pragma once
#ifdef NGRAPH_DISTRIBUTED
#include <memory> #include <memory>
#include "ngraph/ops/util/requires_tensor_view_args.hpp" #include "ngraph/ops/util/requires_tensor_view_args.hpp"
...@@ -40,5 +38,3 @@ namespace ngraph ...@@ -40,5 +38,3 @@ namespace ngraph
}; };
} }
} }
#endif
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "ngraph/ops/abs.hpp" #include "ngraph/ops/abs.hpp"
#include "ngraph/ops/acos.hpp" #include "ngraph/ops/acos.hpp"
#include "ngraph/ops/add.hpp" #include "ngraph/ops/add.hpp"
#include "ngraph/ops/allreduce.hpp"
#include "ngraph/ops/asin.hpp" #include "ngraph/ops/asin.hpp"
#include "ngraph/ops/atan.hpp" #include "ngraph/ops/atan.hpp"
#include "ngraph/ops/avg_pool.hpp" #include "ngraph/ops/avg_pool.hpp"
...@@ -77,10 +78,6 @@ ...@@ -77,10 +78,6 @@
#include "ngraph/util.hpp" #include "ngraph/util.hpp"
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#ifdef NGRAPH_DISTRIBUTED
#include "ngraph/ops/allreduce.hpp"
#endif
using namespace ngraph; using namespace ngraph;
using namespace std; using namespace std;
using json = nlohmann::json; using json = nlohmann::json;
...@@ -279,12 +276,10 @@ static shared_ptr<ngraph::Function> ...@@ -279,12 +276,10 @@ static shared_ptr<ngraph::Function>
{ {
node = make_shared<op::Add>(args[0], args[1]); node = make_shared<op::Add>(args[0], args[1]);
} }
#ifdef NGRAPH_DISTRIBUTED
else if (node_op == "AllReduce") else if (node_op == "AllReduce")
{ {
node = make_shared<op::AllReduce>(args[0]); node = make_shared<op::AllReduce>(args[0]);
} }
#endif
else if (node_op == "Asin") else if (node_op == "Asin")
{ {
node = make_shared<op::Asin>(args[0]); node = make_shared<op::Asin>(args[0]);
......
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