Initial implementation of tensor working compiling

This commit is contained in:
Alejandro Saucedo 2021-03-06 17:25:35 +00:00
parent b81896a780
commit ad18c2e546
12 changed files with 417 additions and 210 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17.0)
cmake_minimum_required(VERSION 3.4.1)
project(kompute_array_mult VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 14)
@ -23,10 +23,6 @@ endif()
find_package(Vulkan REQUIRED)
if(KOMPUTE_OPT_ENABLE_SPDLOG)
find_package(spdlog REQUIRED)
endif()
add_executable(kompute_array_mult
src/Main.cpp)

View file

@ -15,8 +15,11 @@ This project has the option to either import the Kompute dependency relative to
To build you just need to run the cmake command in this folder as follows:
```
cmake \
-Bbuild
cmake -Bbuild/ \
-DCMAKE_BUILD_TYPE=Debug \
-DKOMPUTE_OPT_INSTALL=0 \
-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 \
-DKOMPUTE_OPT_ENABLE_SPDLOG=1
```
You can pass the following optional parameters based on your desired configuration:

View file

@ -7,16 +7,11 @@
int main()
{
#if KOMPUTE_ENABLE_SPDLOG
spdlog::set_level(
static_cast<spdlog::level::level_enum>(SPDLOG_ACTIVE_LEVEL));
#endif
kp::Manager mgr;
auto tensorInA = mgr.tensor({ 2.0, 4.0, 6.0 });
auto tensorInB = mgr.tensor({ 0.0, 1.0, 2.0 });
auto tensorOut = mgr.tensor({ 0.0, 0.0, 0.0 });
auto tensorInA = mgr.tensor<float>({ 2.0, 4.0, 6.0 });
auto tensorInB = mgr.tensor<float>({ 0.0, 1.0, 2.0 });
auto tensorOut = mgr.tensor<float>({ 0.0, 0.0, 0.0 });
std::string shader(R"(
// The version to use

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17.0)
cmake_minimum_required(VERSION 3.4.1)
project(kompute_linear_reg VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 14)
@ -23,10 +23,6 @@ endif()
find_package(Vulkan REQUIRED)
if(KOMPUTE_OPT_ENABLE_SPDLOG)
find_package(spdlog REQUIRED)
endif()
add_executable(kompute_linear_reg
src/Main.cpp)
@ -39,7 +35,7 @@ include_directories(
../../single_include/)
if(KOMPUTE_OPT_ENABLE_SPDLOG)
target_link_libraries(kompute_array_mult
target_link_libraries(kompute_linear_reg
spdlog::spdlog)
endif()

View file

@ -15,8 +15,11 @@ This project has the option to either import the Kompute dependency relative to
To build you just need to run the cmake command in this folder as follows:
```
cmake \
-Bbuild
cmake -Bbuild/ \
-DCMAKE_BUILD_TYPE=Debug \
-DKOMPUTE_OPT_INSTALL=0 \
-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1 \
-DKOMPUTE_OPT_ENABLE_SPDLOG=1
```
You can pass the following optional parameters based on your desired configuration:

View file

@ -17,19 +17,19 @@ int main()
kp::Manager mgr;
std::shared_ptr<kp::Tensor> xI = mgr.tensor({ 0, 1, 1, 1, 1 });
std::shared_ptr<kp::Tensor> xJ = mgr.tensor({ 0, 0, 0, 1, 1 });
auto xI = mgr.tensor<float>({ 0, 1, 1, 1, 1 });
auto xJ = mgr.tensor<float>({ 0, 0, 0, 1, 1 });
std::shared_ptr<kp::Tensor> y = mgr.tensor({ 0, 0, 0, 1, 1 });
auto y = mgr.tensor<float>({ 0, 0, 0, 1, 1 });
std::shared_ptr<kp::Tensor> wIn = mgr.tensor({ 0.001, 0.001 });
std::shared_ptr<kp::Tensor> wOutI = mgr.tensor({ 0, 0, 0, 0, 0 });
std::shared_ptr<kp::Tensor> wOutJ = mgr.tensor({ 0, 0, 0, 0, 0 });
auto wIn = mgr.tensor<float>({ 0.001, 0.001 });
auto wOutI = mgr.tensor<float>({ 0, 0, 0, 0, 0 });
auto wOutJ = mgr.tensor<float>({ 0, 0, 0, 0, 0 });
std::shared_ptr<kp::Tensor> bIn = mgr.tensor({ 0 });
std::shared_ptr<kp::Tensor> bOut = mgr.tensor({ 0, 0, 0, 0, 0 });
auto bIn = mgr.tensor<float>({ 0 });
auto bOut = mgr.tensor<float>({ 0, 0, 0, 0, 0 });
std::shared_ptr<kp::Tensor> lOut = mgr.tensor({ 0, 0, 0, 0, 0 });
auto lOut = mgr.tensor<float>({ 0, 0, 0, 0, 0 });
std::vector<std::shared_ptr<kp::Tensor>> params = { xI, xJ, y,
wIn, wOutI, wOutJ,