Skip to content

Commit

Permalink
try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aciddelgado committed Feb 15, 2024
1 parent 63a84c8 commit 8c066aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 67 deletions.
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ file(GLOB test_srcs CONFIGURE_DEPENDS
# )

# google unit test
add_executable(unit_tests test.cpp c_api.cpp gtest_main.cpp tests.cpp)
add_executable(unit_tests main.cpp c_api.cpp tests.cpp)
target_include_directories(unit_tests PRIVATE
${ORT_HEADER_DIR}
${CMAKE_SOURCE_DIR}/src
Expand Down
23 changes: 0 additions & 23 deletions test/gtest_main.cpp

This file was deleted.

48 changes: 14 additions & 34 deletions test/main.cpp
Original file line number Diff line number Diff line change
@@ -1,43 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#include <gtest/gtest.h>
#include <generators.h>
#include <iostream>
// #include "tests.cpp"
// #include "c_api.cpp"

extern std::unique_ptr<OrtEnv> g_ort_env;

void Test_GreedySearch_Gpt_Fp32_C_API();
void Test_GreedySearch_Gpt_Fp32();
void Test_BeamSearch_Gpt_Fp32();

#if USE_CUDA
void Test_GreedySearch_Gpt_Cuda();
void Test_BeamSearch_Gpt_Cuda();
#endif

int main() {
int main(int argc, char **argv) {
std::cout << "Generators Utility Library" << std::endl;

try {

std::cout << "Initializing OnnxRuntime...";
std::cout.flush();
Ort::InitApi();
g_ort_env = OrtEnv::Create();
std::cout << "done" << std::endl;

Test_GreedySearch_Gpt_Fp32_C_API();
Test_GreedySearch_Gpt_Fp32();
Test_BeamSearch_Gpt_Fp32();

#if USE_CUDA
Test_GreedySearch_Gpt_Cuda();
Test_BeamSearch_Gpt_Cuda();
#endif
} catch (const std::exception& e) {
std::cout << "Fatal Exception: " << e.what() << std::endl;
}
return 0;
}
std::cout << "Initializing OnnxRuntime... ";
std::cout.flush();
Ort::InitApi();
g_ort_env = OrtEnv::Create();
std::cout << "done" << std::endl;
::testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
std::cout << "Shutting down OnnxRuntime... ";
g_ort_env.release();
std::cout << "done" << std::endl;
return result;
}
9 changes: 0 additions & 9 deletions test/test.cpp

This file was deleted.

0 comments on commit 8c066aa

Please sign in to comment.