diff --git a/src/Sequence.cpp b/src/Sequence.cpp index c151eb9..50ef8b0 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -31,8 +31,7 @@ Sequence::~Sequence() SPDLOG_INFO("Kompute Sequence destructor called but sequence is not " "initialized so no need to removing GPU resources."); return; - } - else { + } else { this->freeMemoryDestroyGPUResources(); } } @@ -206,13 +205,14 @@ Sequence::freeMemoryDestroyGPUResources() { if (!this->mIsInit) { SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called " - "but Sequence is not initialized so there's no relevant GPU resources."); + "but Sequence is not initialized so there's no relevant " + "GPU resources."); return; } if (!this->mDevice) { - SPDLOG_ERROR( - "Kompute Sequence freeMemoryDestroyGPUResources called with null Device pointer"); + SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called " + "with null Device pointer"); this->mIsInit = false; return; } @@ -220,8 +220,9 @@ Sequence::freeMemoryDestroyGPUResources() if (this->mFreeCommandBuffer) { SPDLOG_INFO("Freeing CommandBuffer"); if (!this->mCommandBuffer) { - SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called with null " - "CommandPool pointer"); + SPDLOG_ERROR( + "Kompute Sequence freeMemoryDestroyGPUResources called with null " + "CommandPool pointer"); this->mIsInit = false; return; } @@ -233,8 +234,9 @@ Sequence::freeMemoryDestroyGPUResources() if (this->mFreeCommandPool) { SPDLOG_INFO("Destroying CommandPool"); if (this->mCommandPool == nullptr) { - SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called with null " - "CommandPool pointer"); + SPDLOG_ERROR( + "Kompute Sequence freeMemoryDestroyGPUResources called with null " + "CommandPool pointer"); this->mIsInit = false; return; } @@ -250,7 +252,6 @@ Sequence::freeMemoryDestroyGPUResources() } this->mIsInit = false; - } void diff --git a/src/include/kompute/Core.hpp b/src/include/kompute/Core.hpp index 1c0629b..e1940e7 100644 --- a/src/include/kompute/Core.hpp +++ b/src/include/kompute/Core.hpp @@ -33,75 +33,70 @@ static const char* KOMPUTE_LOG_TAG = "KomputeLog"; #endif #if defined(KOMPUTE_BUILD_PYTHON) - #include - namespace py = pybind11; - //from python/src/main.cpp - extern py::object kp_debug, kp_info, kp_warning, kp_error; +#include +namespace py = pybind11; +// from python/src/main.cpp +extern py::object kp_debug, kp_info, kp_warning, kp_error; #endif - #ifndef KOMPUTE_LOG_OVERRIDE - #if KOMPUTE_ENABLE_SPDLOG - #include - #else - #include - #if SPDLOG_ACTIVE_LEVEL > 1 - #define SPDLOG_DEBUG(message, ...) - #else - #if defined(VK_USE_PLATFORM_ANDROID_KHR) - #define SPDLOG_DEBUG(message, ...) \ - ((void)__android_log_print(ANDROID_LOG_DEBUG, KOMPUTE_LOG_TAG, message)) - #elif defined(KOMPUTE_BUILD_PYTHON) - #define SPDLOG_DEBUG(message, ...) \ - kp_debug(message); - #else - #define SPDLOG_DEBUG(message, ...) \ - std::cout << "DEBUG: " << message << std::endl - #endif // VK_USE_PLATFORM_ANDROID_KHR - #endif // SPDLOG_ACTIVE_LEVEL > 1 - - #if SPDLOG_ACTIVE_LEVEL > 2 - #define SPDLOG_INFO(message, ...) - #else - #if defined(VK_USE_PLATFORM_ANDROID_KHR) - #define SPDLOG_INFO(message, ...) \ - ((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message)) - #elif defined(KOMPUTE_BUILD_PYTHON) - #define SPDLOG_INFO(message, ...) \ - kp_info(message); - #else - #define SPDLOG_INFO(message, ...) std::cout << "INFO: " << message << std::endl - #endif // VK_USE_PLATFORM_ANDROID_KHR - #endif // SPDLOG_ACTIVE_LEVEL > 2 - - #if SPDLOG_ACTIVE_LEVEL > 3 - #define SPDLOG_WARN(message, ...) - #else - #if defined(VK_USE_PLATFORM_ANDROID_KHR) - #define SPDLOG_WARN(message, ...) \ - ((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message)) - #elif defined(KOMPUTE_BUILD_PYTHON) - #define SPDLOG_WARN(message, ...) \ - kp_warning(message); - #else - #define SPDLOG_WARN(message, ...) \ - std::cout << "WARNING: " << message << std::endl - #endif // VK_USE_PLATFORM_ANDROID_KHR - #endif // SPDLOG_ACTIVE_LEVEL > 3 - - #if SPDLOG_ACTIVE_LEVEL > 4 - #define SPDLOG_ERROR(message, ...) - #else - #if defined(VK_USE_PLATFORM_ANDROID_KHR) - #define SPDLOG_ERROR(message, ...) \ - ((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message)) - #elif defined(KOMPUTE_BUILD_PYTHON) - #define SPDLOG_ERROR(message, ...) \ - kp_error(message); - #else - #define SPDLOG_ERROR(message, ...) \ - std::cout << "ERROR: " << message << std::endl - #endif // VK_USE_PLATFORM_ANDROID_KHR - #endif // SPDLOG_ACTIVE_LEVEL > 4 - #endif // KOMPUTE_SPDLOG_ENABLED +#if KOMPUTE_ENABLE_SPDLOG +#include +#else +#include +#if SPDLOG_ACTIVE_LEVEL > 1 +#define SPDLOG_DEBUG(message, ...) +#else +#if defined(VK_USE_PLATFORM_ANDROID_KHR) +#define SPDLOG_DEBUG(message, ...) \ + ((void)__android_log_print(ANDROID_LOG_DEBUG, KOMPUTE_LOG_TAG, message)) +#elif defined(KOMPUTE_BUILD_PYTHON) +#define SPDLOG_DEBUG(message, ...) kp_debug(message); +#else +#define SPDLOG_DEBUG(message, ...) \ + std::cout << "DEBUG: " << message << std::endl +#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // SPDLOG_ACTIVE_LEVEL > 1 + +#if SPDLOG_ACTIVE_LEVEL > 2 +#define SPDLOG_INFO(message, ...) +#else +#if defined(VK_USE_PLATFORM_ANDROID_KHR) +#define SPDLOG_INFO(message, ...) \ + ((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message)) +#elif defined(KOMPUTE_BUILD_PYTHON) +#define SPDLOG_INFO(message, ...) kp_info(message); +#else +#define SPDLOG_INFO(message, ...) std::cout << "INFO: " << message << std::endl +#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // SPDLOG_ACTIVE_LEVEL > 2 + +#if SPDLOG_ACTIVE_LEVEL > 3 +#define SPDLOG_WARN(message, ...) +#else +#if defined(VK_USE_PLATFORM_ANDROID_KHR) +#define SPDLOG_WARN(message, ...) \ + ((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message)) +#elif defined(KOMPUTE_BUILD_PYTHON) +#define SPDLOG_WARN(message, ...) kp_warning(message); +#else +#define SPDLOG_WARN(message, ...) \ + std::cout << "WARNING: " << message << std::endl +#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // SPDLOG_ACTIVE_LEVEL > 3 + +#if SPDLOG_ACTIVE_LEVEL > 4 +#define SPDLOG_ERROR(message, ...) +#else +#if defined(VK_USE_PLATFORM_ANDROID_KHR) +#define SPDLOG_ERROR(message, ...) \ + ((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message)) +#elif defined(KOMPUTE_BUILD_PYTHON) +#define SPDLOG_ERROR(message, ...) kp_error(message); +#else +#define SPDLOG_ERROR(message, ...) \ + std::cout << "ERROR: " << message << std::endl +#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // SPDLOG_ACTIVE_LEVEL > 4 +#endif // KOMPUTE_SPDLOG_ENABLED #endif // KOMPUTE_LOG_OVERRIDE diff --git a/test/TestLogisticRegression.cpp b/test/TestLogisticRegression.cpp index 94f34b5..5fa3032 100644 --- a/test/TestLogisticRegression.cpp +++ b/test/TestLogisticRegression.cpp @@ -55,8 +55,7 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegression) std::vector( kp::shader_data::shaders_glsl_logisticregression_comp_spv, kp::shader_data::shaders_glsl_logisticregression_comp_spv + - kp::shader_data:: - shaders_glsl_logisticregression_comp_spv_len)); + kp::shader_data::shaders_glsl_logisticregression_comp_spv_len)); #endif sq->record({ wOutI, wOutJ, bOut, lOut }); @@ -86,9 +85,9 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegression) EXPECT_LT(bIn->data()[0], 0.0); SPDLOG_WARN("Result wIn i: {}, wIn j: {}, bIn: {}", - wIn->data()[0], - wIn->data()[1], - bIn->data()[0]); + wIn->data()[0], + wIn->data()[1], + bIn->data()[0]); } TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy) @@ -144,8 +143,7 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy) std::vector( kp::shader_data::shaders_glsl_logisticregression_comp_spv, kp::shader_data::shaders_glsl_logisticregression_comp_spv + - kp::shader_data:: - shaders_glsl_logisticregression_comp_spv_len)); + kp::shader_data::shaders_glsl_logisticregression_comp_spv_len)); #endif sq->record({ wOutI, wOutJ, bOut, lOut }); @@ -177,7 +175,7 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy) EXPECT_LT(bIn->data()[0], 0.0); SPDLOG_WARN("Result wIn i: {}, wIn j: {}, bIn: {}", - wIn->data()[0], - wIn->data()[1], - bIn->data()[0]); + wIn->data()[0], + wIn->data()[1], + bIn->data()[0]); }