File tree 7 files changed +29
-25
lines changed
python/paddle/fluid/tests/unittests
7 files changed +29
-25
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,8 @@ if(WITH_XBYAK)
21
21
add_subdirectory (gen)
22
22
endif ()
23
23
24
- if (WITH_IPU)
25
- set (JIT_IPU_DEPS ipu_backend)
26
- elseif (WITH_IPU)
27
- set (JIT_IPU_DEPS "" )
28
- endif ()
29
-
30
- cc_library(jit_kernel_helper INTERFACE SRCS ${jit_kernel_cc_srcs} DEPS jit_kernel_base ${JIT_KERNEL_DEPS} ${JIT_IPU_DEPS} )
31
- cc_test(jit_kernel_test SRCS test .cc DEPS jit_kernel_helper ${JIT_IPU_DEPS} )
24
+ cc_library(jit_kernel_helper INTERFACE SRCS ${jit_kernel_cc_srcs} DEPS jit_kernel_base ${JIT_KERNEL_DEPS} )
25
+ cc_test(jit_kernel_test SRCS test .cc DEPS jit_kernel_helper)
32
26
if (NOT WIN32 )
33
27
cc_binary(jit_kernel_benchmark SRCS benchmark.cc DEPS jit_kernel_helper device_tracer tensor)
34
28
endif ()
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ IF(WITH_GPU OR WITH_ROCM)
75
75
ENDIF ()
76
76
77
77
IF (WITH_IPU)
78
- set (IPU_CTX_DEPS ipu_backend )
78
+ set (IPU_CTX_DEPS ipu_info )
79
79
ELSE ()
80
80
set (IPU_CTX_DEPS)
81
81
ENDIF (WITH_IPU)
Original file line number Diff line number Diff line change 1
1
IF (WITH_IPU)
2
2
FILE (GLOB POPART_CANONICALIZATION_SRC ${PADDLE_SOURCE_DIR} /paddle/fluid/platform/device/ipu/popart_canonicalization/*.cc)
3
3
list (APPEND PADDLE_IPU_SRC ${POPART_CANONICALIZATION_SRC} )
4
- set (PADDLE_IPU_LIB "${CMAKE_CURRENT_BINARY_DIR} /libpaddle_ipu.so" CACHE STRING "" )
5
- set (PADDLE_IPU_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR} " CACHE STRING "" )
6
4
set (IPU_BACKEND_SRC
7
- "ipu_device.cc"
8
5
"ipu_strategy.cc"
9
6
"ipu_executor.cc"
10
7
"ipu_compiler.cc"
11
8
"ipu_backend.cc"
12
9
"ipu_utils.cc"
13
10
)
11
+ set (IPU_INFO_SRC
12
+ "ipu_info.cc"
13
+ "ipu_device.cc"
14
+ )
14
15
15
- cc_library(ipu_backend SRCS ${IPU_BACKEND_SRC} DEPS popart graph framework_proto enforce graph_helper timer )
16
- cc_library(ipu_info SRCS ipu_info.cc DEPS ipu_backend )
17
- cc_library(paddle_ipu SHARED SRCS ${PADDLE_IPU_SRC} DEPS popart)
16
+ cc_library(ipu_backend SRCS ${IPU_BACKEND_SRC} DEPS popart graph graph_helper)
17
+ cc_library(ipu_info SRCS ${IPU_INFO_SRC} DEPS popart enforce )
18
+ cc_library(paddle_ipu SHARED SRCS ${PADDLE_IPU_SRC} DEPS popart graph_helper )
18
19
add_dependencies (paddle_ipu ipu_backend)
20
+ set (PADDLE_IPU_LIB "${CMAKE_CURRENT_BINARY_DIR} /libpaddle_ipu.so" CACHE STRING "" )
21
+ set (PADDLE_IPU_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR} " CACHE STRING "" )
19
22
ENDIF ()
Original file line number Diff line number Diff line change @@ -13,12 +13,26 @@ See the License for the specific language governing permissions and
13
13
limitations under the License. */
14
14
15
15
#include " paddle/fluid/platform/device/ipu/ipu_device.h"
16
- #include " paddle/fluid/platform/device/ipu/ipu_utils .h"
16
+ #include " paddle/fluid/platform/enforce .h"
17
17
18
18
namespace paddle {
19
19
namespace platform {
20
20
namespace ipu {
21
21
22
+ // TODO(alleng) merge with ipu_utils
23
+ static bool GetBoolEnv (std::string str) {
24
+ char * str_val = getenv (str.c_str ());
25
+ if (str_val == NULL ) {
26
+ return false ;
27
+ } else {
28
+ bool val = false ;
29
+ if (strcmp (str_val, " 1" ) == 0 || strcmp (str_val, " true" ) == 0 ||
30
+ strcmp (str_val, " True" ) == 0 || strcmp (str_val, " TRUE" ) == 0 )
31
+ val = true ;
32
+ return val;
33
+ }
34
+ }
35
+
22
36
int GetNumDevices () {
23
37
bool ipu_model = GetBoolEnv (" POPLAR_IPUMODEL" );
24
38
if (ipu_model) {
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ limitations under the License. */
15
15
#pragma once
16
16
17
17
#include < popart/devicemanager.hpp>
18
- #include " paddle/fluid/platform/enforce.h"
19
18
20
19
namespace paddle {
21
20
namespace platform {
Original file line number Diff line number Diff line change @@ -16,12 +16,10 @@ namespace paddle {
16
16
namespace platform {
17
17
18
18
// ! Get a list of device ids from environment variable or use all.
19
- std::vector<int > GetSelectedIPUDevices () {
20
- return platform::ipu::GetDeviceIds ();
21
- }
19
+ std::vector<int > GetSelectedIPUDevices () { return ipu::GetDeviceIds (); }
22
20
23
21
// ! Get the total number of IPU devices in system.
24
- int GetIPUDeviceCount () { return platform:: ipu::GetNumDevices (); }
22
+ int GetIPUDeviceCount () { return ipu::GetNumDevices (); }
25
23
26
24
} // namespace platform
27
25
} // namespace paddle
Original file line number Diff line number Diff line change @@ -806,10 +806,6 @@ if (WITH_MKLDNN)
806
806
add_subdirectory (mkldnn)
807
807
endif ()
808
808
809
- if (WITH_IPU)
810
- add_subdirectory (ipu)
811
- endif ()
812
-
813
809
if (WITH_MLU)
814
810
add_subdirectory (mlu)
815
811
endif ()
You can’t perform that action at this time.
0 commit comments