CMakeLists.txt 2.5 KB
Newer Older
1 2 3 4
file(
  GLOB TEST_OPS
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_*.py")
5
string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}")
6 7 8 9
file(
  GLOB TEST_DIST_OPS
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "test_collective_*.py")
Z
zn 已提交
10
string(REPLACE ".py" "" TEST_DIST_OPS "${TEST_DIST_OPS}")
11

12 13 14
if(WITH_MLU)
  foreach(TEST_OP ${TEST_DIST_OPS})
    list(REMOVE_ITEM TEST_OPS ${TEST_OP})
15
  endforeach()
16
  list(REMOVE_ITEM TEST_OPS "test_spawn_mlu")
Z
zn 已提交
17

18 19
  foreach(TEST_OP ${TEST_OPS})
    py_test_modules(${TEST_OP} MODULES ${TEST_OP})
20
  endforeach()
Z
zn 已提交
21

22 23 24 25
  if(WITH_CNCL)
    list(APPEND TEST_DIST_OPS "test_spawn_mlu")
    foreach(TEST_OP ${TEST_DIST_OPS})
      py_test_modules(${TEST_OP} MODULES ${TEST_OP})
26
    endforeach()
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    bash_test_modules(test_launch_async_mlu START_BASH test_launch_async_mlu.sh
                      ENVS PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR})
    bash_test_modules(test_launch_cloud_mlu START_BASH test_launch_cloud_mlu.sh
                      ENVS PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR})
    bash_test_modules(test_launch_nproc_mlu START_BASH test_launch_nproc_mlu.sh
                      ENVS PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR})
    bash_test_modules(
      test_c_comm_init_op_mlu START_BASH test_c_comm_init_op_mlu.sh ENVS
      PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR})
    set_tests_properties(test_collective_broadcast PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_allreduce_sum PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_allreduce_max PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_allreduce_min PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_allreduce_prod PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_allgather PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_reduce_sum PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_reduce_max PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_reduce_min PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_reduce_prod PROPERTIES TIMEOUT 120)
    set_tests_properties(test_collective_broadcast_api_mlu PROPERTIES TIMEOUT
                                                                      120)
    set_tests_properties(test_collective_allreduce_api_mlu PROPERTIES TIMEOUT
                                                                      120)
    set_tests_properties(test_collective_allgather_api_mlu PROPERTIES TIMEOUT
                                                                      120)
    set_tests_properties(test_c_comm_init_op_mlu PROPERTIES TIMEOUT 120)
53
  endif()
54
endif()