![GitHub](https://img.shields.io/badge/Version-0.5.2-green.svg)
![GitHub](https://img.shields.io/badge/C++-14â20-purple.svg)
![GitHub](https://img.shields.io/badge/Build-cmake-red.svg)
![GitHub](https://img.shields.io/badge/Python-3.5â3.8-blue.svg)
![GitHub](https://img.shields.io/badge/License-Apache-black.svg)
<table>
<tr>
<td width="20%">
<img src="https://raw.githubusercontent.com/EthicalML/vulkan-kompute/master/docs/images/kompute.jpg">
</td>
<td>
<h1>Vulkan Kompute</h1>
<h3>The general purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends).</h3>
</td>
</tr>
</table>
<h4>Blazing fast, mobile-enabled, asynchronous, and optimized for advanced GPU processing usecases.</h4>
ð [Documentation](https://kompute.cc) ð» [Blog Post](https://medium.com/@AxSaucedo/machine-learning-and-data-processing-in-the-gpu-with-vulkan-kompute-c9350e5e5d3a) ⨠[Examples](#more-examples) ð¾
## Principles & Features
* Low level extensible [C++ SDK](#your-first-kompute-c) with high level optimized [Python module](#your-first-kompute-python)
* [Asynchronous & parallel processing](#asynchronous-and-parallel-operations) support through GPU family queues
* [Mobile enabled](#mobile-enabled) with examples via Android NDK across several architectures
* BYOV: [Bring-your-own-Vulkan design](#motivations) to play nice with existing Vulkan applications
* Explicit relationships for GPU and host [memory ownership and memory management](https://kompute.cc/overview/memory-management.html)
* [Hands on examples](#simple-examples) showing the core features
* Longer tutorials for [machine learning ð¤](https://towardsdatascience.com/machine-learning-and-data-processing-in-the-gpu-with-vulkan-kompute-c9350e5e5d3a), [mobile development ð±](https://towardsdatascience.com/gpu-accelerated-machine-learning-in-your-mobile-applications-using-the-android-ndk-vulkan-kompute-1e9da37b7617) and [game development ð®](https://towardsdatascience.com/supercharging-game-development-with-gpu-accelerated-ml-using-vulkan-kompute-the-godot-game-engine-4e75a84ea9f0).
![](https://raw.githubusercontent.com/ethicalml/vulkan-kompute/master/docs/images/komputer-logos.gif)
## Getting Started
Below you can find a GPU multiplication example using the C++ and Python Kompute interfaces.
### Your First Kompute (C++)
The C++ interface provides low level access to the native components of Kompute and Vulkan, enabling for [advanced optimizations](https://kompute.cc/overview/async-parallel.html) as well as [extension of components](https://kompute.cc/overview/reference.html).
```c++
int main() {
// 1. Create Kompute Manager with default settings (device 0 and first compute compatible queue)
kp::Manager mgr;
// 2. Create and initialise Kompute Tensors through manager
auto tensorInA = mgr.buildTensor({ 2., 2., 2. });
auto tensorInB = mgr.buildTensor({ 1., 2., 3. });
auto tensorOut = mgr.buildTensor({ 0., 0., 0. });
// 3. Specify "multiply shader" code (can also be raw string, spir-v bytes or file path)
std::string shaderString = (R"(
#version 450
layout (local_size_x = 1) in;
// The input tensors bind index is relative to index in parameter passed
layout(set = 0, binding = 0) buffer bina { float tina[]; };
layout(set = 0, binding = 1) buffer binb { float tinb[]; };
layout(set = 0, binding = 2) buffer bout { float tout[]; };
void main() {
uint index = gl_GlobalInvocationID.x;
tout[index] = tina[index] * tinb[index];
}
)");
// 3. Run operation with string shader synchronously
mgr.evalOpDefault<kp::OpAlgoBase>(
{ tensorInA, tensorInB, tensorOut },
std::vector<char>(shaderString.begin(), shaderString.end()));
// 4. Map results back from GPU memory to print the results
mgr.evalOpDefault<kp::OpTensorSyncLocal>({ tensorInA, tensorInB, tensorOut });
// Prints the output which is Output: { 2, 4, 6 }
for (const float& elem : tensorOut->data()) std::cout << elem << " ";
}
```
### Your First Kompute (Python)
The [Python package](https://kompute.cc/overview/python-package.html) provides a [high level interactive interface](https://kompute.cc/overview/python-reference.html) that enables for experimentation whilst ensuring high performance and fast development workflows.
```python
# 1. Create Kompute Manager with default settings (device 0 and first compute compatible queue)
mgr = Manager()
# 2. Create and initialise Kompute Tensors (can be initialized with List[] or np.Array)
tensor_in_a = Tensor([2, 2, 2])
tensor_in_b = Tensor([1, 2, 3])
tensor_out = Tensor([0, 0, 0])
mgr.eval_tensor_create_def([tensor_in_a, tensor_in_b, tensor_out])
# 3. Specify "multiply shader" code (can also be raw string, spir-v bytes or file path)
@python2shader
def compute_shader_multiply(index=("input", "GlobalInvocationId", ivec3),
data1=("buffer", 0, Array(f32)),
data2=("buffer", 1, Array(f32)),
data3=("buffer", 2, Array(f32))):
i = index.x
data3[i] = data1[i] * data2[i]
# 4. Run multiplication operation synchronously
mgr.eval_algo_data_def(
[tensor_in_a, tensor_in_b, tensor_out], compute_shader_multiply.to_spirv())
# 5. Map results back from GPU memory to print the results
mgr.eval_tensor_sync_local_def([tensor_out])
# Prints [2.0, 4.0, 6.0]
print(tensor_out.data())
```
### Interactive Notebooks & Hands on Videos
You are able to try out the interactive Colab Notebooks which allow you to use a free GPU. The available examples are the Python and C++ examples below:
<table>
<tr>
<td width="50%">
<h5>Try the interactive <a href="https://colab.research.google.com/drive/1l3hNSq2AcJ5j2E3YIw__jKy5n6M615GP?authuser=1#scrollTo=1BipBsO-fQRD">C++ Colab</a> from <a href="https://towardsdatascience.com/machine-learning-and-data-processing-in-the-gpu-with-vulkan-kompute-c9350e5e5d3a">Blog Post</a></h5>
</td>
<td>
<h5>Try the interactive <a href="https://colab.research.google.com/drive/15uQ7qMZuOyk8JcXF-3SB2R5yNFW21I4P">Python Colab</a> from <a href="https://towardsdatascience.com/beyond-cuda-gpu-accelerated-python-for-machine-learning-in-cross-vendor-graphics-cards-made-simple-6cc828a45cc3">Blog Post</a></h5>
</td>
</tr>
<tr>
<td width="50%">
<a href="https://colab.research.google.com/drive/1l3hNSq2AcJ5j2E3YIw__jKy5n6M615GP?authuser=1#scrollTo=1BipBsO-fQRD">
<img src="https://raw.githubusercontent.com/EthicalML/vulkan-kompute/master/docs/images/binder-cpp.jpg">
</a>
</td>
<td>
<a href="https://colab.research.google.com/drive/15uQ7qMZuOyk8JcXF-3SB2R5yNFW21I4P">
<img src="https://raw.githubusercontent.com/EthicalML/vulkan-kompute/master/docs/images/binder-python.jpg">
</a>
</td>
</tr>
</table>
You can also check out the two following talks presented at the FOSDEM 2021 conference.
Both videos have timestamps which will allow you to skip to the most relevant section for you - the intro & motivations for both is almost the same so you can skip to the more specific content.
<table>
<tr>
<td width="50%">
<h5>Watch the video for <a href="https://www.youtube.com/watch?v=Xz4fiQNmGSA">C++ & Vulkan SDK</a> Enthusiasts</h5>
</td>
<td>
<h5>Watch the video for <a href="https://www.youtube.com/watch?v=AJRyZ09IUdg">Python & Machine Learning</a> Enthusiasts</h5>
</td>
</tr>
<tr>
<td width="50%">
<a href="https://www.youtube.com/watch?v=Xz4fiQNmGSA">
<img src="https://raw.githubusercontent.com/EthicalML/vulkan-kompute/master/docs/images/kompute-cpp-video.png">
</a>
</td>
<td>
<a href="https://www.youtube.com/watch?v=AJRyZ09IUdg">
<img src="https://raw.githubusercontent.com/EthicalML/vulkan-kompute/master/docs/images/kompute-python-video.png">
</a>
</td>
</tr>
</table>
## Architectural Overview
The core architecture of Kompute includes the following:
* [Kompute Manager](https://kompute.cc/overview/reference.html#manager) - Bas
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Python库 | kp-0.6.0.tar.gz (740个子文件)
BUILD.bazel 13KB
BUILD.bazel 5KB
BUILD.bazel 3KB
xxd.c 21KB
gtest_unittest.cc 244KB
gtest.cc 221KB
gmock-matchers_test.cc 219KB
gtest_pred_impl_unittest.cc 76KB
gmock-spec-builders_test.cc 73KB
gtest-death-test.cc 61KB
googletest-printers-test.cc 50KB
googletest-death-test-test.cc 46KB
gtest-port.cc 45KB
gmock-actions_test.cc 45KB
gmock-generated-matchers_test.cc 43KB
googletest-port-test.cc 39KB
googletest-param-test-test.cc 38KB
googletest-output-test_.cc 36KB
gmock-generated-actions_test.cc 35KB
gmock-spec-builders.cc 32KB
gmock-internal-utils_test.cc 26KB
googletest-listener-test.cc 24KB
gmock-more-actions_test.cc 24KB
googletest-filepath-test.cc 22KB
gmock-function-mocker_test.cc 20KB
gmock-generated-function-mockers_test.cc 20KB
gmock-matchers.cc 18KB
gtest-typed-test_test.cc 15KB
gtest-printers.cc 14KB
gmock-nice-strict_test.cc 14KB
gtest-filepath.cc 14KB
gtest-unittest-api_test.cc 13KB
gmock-cardinalities_test.cc 12KB
gtest_stress_test.cc 9KB
sample6_unittest.cc 9KB
gmock-pp-string_test.cc 9KB
gmock_output_test_.cc 8KB
googletest-catch-exceptions-test_.cc 8KB
gmock.cc 8KB
googletest-test-part-test.cc 8KB
googletest-options-test.cc 8KB
gmock-internal-utils.cc 7KB
gtest_repeat_test.cc 7KB
gmock_stress_test.cc 7KB
sample5_unittest.cc 6KB
gtest_environment_test.cc 6KB
gmock_test.cc 6KB
sample8_unittest.cc 6KB
gtest_xml_output_unittest_.cc 6KB
sample9_unittest.cc 6KB
sample3_unittest.cc 5KB
googletest-message-test.cc 5KB
gmock-cardinalities.cc 5KB
sample1_unittest.cc 5KB
sample10_unittest.cc 5KB
googletest-list-tests-unittest_.cc 5KB
sample7_unittest.cc 5KB
gtest_premature_exit_test.cc 4KB
gtest-test-part.cc 4KB
gtest-typed-test.cc 4KB
sample2_unittest.cc 4KB
gtest_assert_by_exception_test.cc 4KB
gtest_test_macro_stack_footprint_test.cc 4KB
gtest-matchers.cc 4KB
googletest-death-test_ex_test.cc 4KB
googletest-env-var-test_.cc 3KB
googletest-filter-unittest_.cc 3KB
gtest_throw_on_failure_ex_test.cc 3KB
gmock_ex_test.cc 3KB
googletest-break-on-failure-unittest_.cc 3KB
gmock_leak_test_.cc 3KB
googletest-shuffle-test_.cc 3KB
gmock-pp_test.cc 3KB
googletest-throw-on-failure-test_.cc 3KB
gmock_main.cc 3KB
googletest-param-test2-test.cc 3KB
googletest-test2_test.cc 3KB
googletest-color-test_.cc 2KB
gmock_all_test.cc 2KB
sample1.cc 2KB
gtest_no_test_unittest.cc 2KB
sample2.cc 2KB
gtest_all_test.cc 2KB
gtest_sole_header_test.cc 2KB
gtest-all.cc 2KB
gtest_prod_test.cc 2KB
googletest-param-test-invalid-name2-test_.cc 2KB
gtest_list_output_unittest_.cc 2KB
sample4.cc 2KB
gmock-all.cc 2KB
gtest_help_test_.cc 2KB
gtest_skip_in_environment_setup_test.cc 2KB
googletest-param-test-invalid-name1-test_.cc 2KB
gtest-typed-test2_test.cc 2KB
sample4_unittest.cc 2KB
gtest_skip_test.cc 2KB
gmock-port_test.cc 2KB
gtest_xml_outfile2_test_.cc 2KB
gtest_xml_outfile1_test_.cc 2KB
gtest_testbridge_test_.cc 2KB
共 740 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功