Skip to content

Commit

Permalink
Delete torch cpp-only test
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagocrepaldi committed Jul 19, 2024
1 parent 3d9200b commit 53ff721
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 283 deletions.
33 changes: 2 additions & 31 deletions cmake/ext_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ if(IOS)
PROPERTY COMPILE_OPTIONS "-fobjc-arc")
endif()

set(CMAKE_PREFIX_PATH /home/thiagofc/dev/libtorch)
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

function(add_test_target)
set(optional_args)
set(single_value_args
Expand All @@ -57,8 +53,7 @@ function(add_test_target)
"${TEST_SRC_DIR}/unittest_main/test_main.cc")
target_link_libraries(${ARG_TARGET} PRIVATE
${ARG_LIBRARIES}
gtest
"${TORCH_LIBRARIES}")
gtest)

if(OCOS_USE_CUDA)
target_link_directories(${ARG_TARGET} PRIVATE ${CUDAToolkit_LIBRARY_DIR})
Expand Down Expand Up @@ -100,18 +95,6 @@ function(add_test_target)

set(test_data_destination_root_directory $<TARGET_FILE_DIR:${dummy_testee_target}>)

# The following code block is suggested to be used on Windows.
# According to https://github.com/pytorch/pytorch/issues/25457,
# the DLLs need to be copied to avoid memory errors.
if (MSVC)
file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")
add_custom_command(TARGET ${ARG_TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${TORCH_DLLS}
$<TARGET_FILE_DIR:${ARG_TARGET}>)
endif (MSVC)

endif()

# copy any test data directories to the target directory
Expand Down Expand Up @@ -210,25 +193,13 @@ else()
LIBRARIES ${extensions_test_libraries}
TEST_DATA_DIRECTORIES ${TEST_SRC_DIR}/data)

target_include_directories(extensions_test PRIVATE ${spm_INCLUDE_DIRS} PUBLIC ${TORCH_INCLUDE_DIRS})
target_include_directories(extensions_test PRIVATE ${spm_INCLUDE_DIRS})

target_compile_definitions(extensions_test PUBLIC ${OCOS_COMPILE_DEFINITIONS})
if(use_extensions_shared_library)
target_compile_definitions(extensions_test PUBLIC ORT_EXTENSIONS_UNIT_TEST_USE_EXTENSIONS_SHARED_LIBRARY)
endif()

option(DOWNLOAD_MNIST "Download the MNIST dataset from the internet" ON)
if (DOWNLOAD_MNIST)
message(STATUS "Downloading MNIST dataset")
execute_process(
COMMAND python ${CMAKE_CURRENT_LIST_DIR}/../tools/download_mnist.py
-d ${CMAKE_BINARY_DIR}/data
ERROR_VARIABLE DOWNLOAD_ERROR)
if (DOWNLOAD_ERROR)
message(FATAL_ERROR "Error downloading MNIST dataset: ${DOWNLOAD_ERROR}")
endif()
endif()

# FUTURE: This is required to use the ORT C++ API with delayed init which must be done conditionally using
# ifdef OCOS_BUILD_SHARED in RegisterCustomOps and where onnxruntime_cxx_api.h is included .
# ---
Expand Down
96 changes: 0 additions & 96 deletions test/shared_test/generate_mnist_onnx.py

This file was deleted.

156 changes: 0 additions & 156 deletions test/shared_test/test_torch_only_mnist.cc

This file was deleted.

0 comments on commit 53ff721

Please sign in to comment.