diff --git a/CMakeLists.txt b/CMakeLists.txt index 454876d4e..bd489d465 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ set(KOMPUTE_EXTRA_CXX_FLAGS "" CACHE STRING "Extra compile flags for Kompute, se if(KOMPUTE_OPT_ENABLE_SPDLOG) set(KOMPUTE_EXTRA_CXX_FLAGS "${KOMPUTE_EXTRA_CXX_FLAGS} -DKOMPUTE_ENABLE_SPDLOG=1") + set(SPDLOG_INSTALL, 1) endif() if(KOMPUTE_OPT_ANDOID_BUILD) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..e9f375e39 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include CMakeLists.txt +recursive-include src * +recursive-include python * +recursive-include single_include * +recursive-include external * + diff --git a/Makefile b/Makefile index 2ed2c457d..5aabbd294 100755 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ mk_run_tests: mk_build_tests VS_BUILD_TYPE ?= "Debug" # Run with multiprocessin / parallel build by default VS_CMAKE_EXTRA_FLAGS ?= "" -VS_KOMPUTE_EXTRA_CXX_FLAGS ?= "/MP" # Adding multiprocessing by default. You should add "/MT" for submodule builds for compatibility with gtest +VS_KOMPUTE_EXTRA_CXX_FLAGS ?= "/MP" # /MP is for faster multiprocessing builds. You should add "/MT" for submodule builds for compatibility with gtest VS_INSTALL_PATH ?= "build/src/CMakeFiles/Export/" # Set to "" if prefer default vs_cmake: diff --git a/README.md b/README.md index b745ccfbf..43b3b8511 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,25 @@ static std::string shaderData = "path/to/shader.glsl"; static std::string shaderData = "path/to/shader.glsl.spv"; ``` +## More examples + +### Simple examples + +* [Pass shader as raw string](https://kompute.cc/overview/advanced-examples.html#simple-shader-example) +* [Record batch commands with a Kompute Sequence](https://kompute.cc/overview/advanced-examples.html#record-batch-commands) +* [Run Asynchronous Operations](https://kompute.cc/overview/advanced-examples.html#asynchronous-operations) +* [Run Parallel Operations Across Multiple GPU Queues](https://kompute.cc/overview/advanced-examples.html#parallel-operations) +* [Create your custom Kompute Operations](https://kompute.cc/overview/advanced-examples.html#your-custom-kompute-operation) +* [Implementing logistic regression from scratch](https://kompute.cc/overview/advanced-examples.html#logistic-regression-example) + +### End-to-end examples + +* [Machine Learning Logistic Regression Implementation](https://towardsdatascience.com/machine-learning-and-data-processing-in-the-gpu-with-vulkan-kompute-c9350e5e5d3a) +* [Parallelizing GPU-intensive Workloads via Multi-Queue Operations](https://towardsdatascience.com/parallelizing-heavy-gpu-workloads-via-multi-queue-operations-50a38b15a1dc) +* [Android NDK Mobile Kompute ML Application](https://towardsdatascience.com/gpu-accelerated-machine-learning-in-your-mobile-applications-using-the-android-ndk-vulkan-kompute-1e9da37b7617) +* [Game Development Kompute ML in Godot Engine](https://towardsdatascience.com/supercharging-game-development-with-gpu-accelerated-ml-using-vulkan-kompute-the-godot-game-engine-4e75a84ea9f0) + + ## Architectural Overview The core architecture of Kompute includes the following: @@ -259,10 +278,16 @@ You can also access the (SPDLOG_LEVEL_INFO)); +#else + SPDLOG_WARN("SPDLOG not enabled so log level config function not supported"); +#endif + }); + py::enum_(m, "TensorTypes", "Enum with GPU memory types for Tensor.") .value("device", kp::Tensor::TensorTypes::eDevice, "Tensor holding data in GPU memory.") .value("staging", kp::Tensor::TensorTypes::eStaging, "Tensor used for transfer of data to device.") diff --git a/setup.py b/setup.py index 0b5db2f9c..eac6985ad 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,9 @@ from setuptools import setup, Extension from setuptools.command.build_ext import build_ext from distutils.version import LooseVersion +curr_dir = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(curr_dir, 'README.md'), encoding='utf-8') as f: + long_description = f.read() class CMakeExtension(Extension): def __init__(self, name, sourcedir=''): @@ -23,10 +26,9 @@ class CMakeBuild(build_ext): raise RuntimeError("CMake must be installed to build the following extensions: " + ", ".join(e.name for e in self.extensions)) - if platform.system() == "Windows": - cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1)) - if cmake_version < '3.1.0': - raise RuntimeError("CMake >= 3.1.0 is required on Windows") + cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1)) + if cmake_version < '3.4.1': + raise RuntimeError("CMake >= 3.4.1 is required") for ext in self.extensions: self.build_extension(ext) @@ -39,13 +41,15 @@ class CMakeBuild(build_ext): cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, '-DKOMPUTE_OPT_BUILD_PYTHON=1', - '-DKOMPUTE_OPT_BUILD_SINGLE_HEADER=1', + '-DKOMPUTE_OPT_ENABLE_SPDLOG=1', + '-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1', '-DPYTHON_EXECUTABLE=' + sys.executable] cfg = 'Debug' if self.debug else 'Release' build_args = ['--config', cfg] if platform.system() == "Windows": + cmake_args += ['-DKOMPUTE_EXTRA_CXX_FLAGS=""'] cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)] if sys.maxsize > 2**32: cmake_args += ['-A', 'x64'] @@ -66,11 +70,13 @@ class CMakeBuild(build_ext): setup( name='kp', - version='0.0.1', + version='0.4.1', author='Alejandro Saucedo', description='Vulkan Kompute: Blazing fast, mobile-enabled, asynchronous, and optimized for advanced GPU processing usecases.', - long_description='', + long_description=long_description, + long_description_content_type='text/markdown', ext_modules=[CMakeExtension('kp')], cmdclass=dict(build_ext=CMakeBuild), zip_safe=False, + include_package_data=True, ) diff --git a/single_include/kompute/Kompute.hpp b/single_include/kompute/Kompute.hpp index 3ae98b483..9674d44c4 100755 --- a/single_include/kompute/Kompute.hpp +++ b/single_include/kompute/Kompute.hpp @@ -24,7 +24,7 @@ static const char* KOMPUTE_LOG_TAG = "KomputeLog"; #endif // KOMPUTE_VK_API_VERSION // SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import -#if !defined(SPDLOG_ACTIVE_LEVEL) +#ifndef SPDLOG_ACTIVE_LEVEL #if DEBUG #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG #else diff --git a/src/Sequence.cpp b/src/Sequence.cpp index 4f01891c4..c151eb9c8 100644 --- a/src/Sequence.cpp +++ b/src/Sequence.cpp @@ -244,6 +244,11 @@ Sequence::freeMemoryDestroyGPUResources() SPDLOG_DEBUG("Kompute Sequence Destroyed CommandPool"); } + if (this->mOperations.size()) { + SPDLOG_INFO("Kompute Sequence clearing operations buffer"); + this->mOperations.clear(); + } + this->mIsInit = false; } diff --git a/src/include/kompute/Core.hpp b/src/include/kompute/Core.hpp index 72ffa5346..73d6bc88e 100644 --- a/src/include/kompute/Core.hpp +++ b/src/include/kompute/Core.hpp @@ -24,7 +24,7 @@ static const char* KOMPUTE_LOG_TAG = "KomputeLog"; #endif // KOMPUTE_VK_API_VERSION // SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import -#if !defined(SPDLOG_ACTIVE_LEVEL) +#ifndef SPDLOG_ACTIVE_LEVEL #if DEBUG #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG #else