Skip to content

Add cuda inference example: #155 - #210

Open
a-vartenkov wants to merge 43 commits into
KasperskyLab:masterfrom
a-vartenkov:feature/#155-add-cuda-inference-example
Open

Add cuda inference example: #155#210
a-vartenkov wants to merge 43 commits into
KasperskyLab:masterfrom
a-vartenkov:feature/#155-add-cuda-inference-example

Conversation

@a-vartenkov

Copy link
Copy Markdown
Collaborator

Adding CUDA inference example. Now CUDA backend works at least with a decent speed.

Comment thread examples/mnist-client/inference.cpp
Comment thread examples/mnist-learn/models/network_functions.h
Comment thread examples/mnist-learn/main.cpp Outdated
Comment thread examples/mnist-learn/main.cpp Outdated
Comment thread examples/mnist-learn/model_desc.h
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_lib/value_index.cuh
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_lib/value_index.cu Outdated
Comment thread knp/base-framework/impl/network.cpp Outdated
Comment thread knp/base-framework/impl/network.cpp Outdated
Comment thread knp/base-framework/impl/network.cpp

@artiomn artiomn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

См. комменты.

@artiomn artiomn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Продолжаем...

Comment thread examples/mnist-learn/main.cpp Outdated
@artiomn artiomn changed the title Feature/#155 add cuda inference example Add cuda inference example: #155 Aug 7, 2026
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_bus/message_bus.cuh Outdated
for (auto iter = buffer.begin(); iter != buffer.end(); ++iter)
{
LongIndex current_neuron = (*iter).first;
// Filling offsets for skipped neurons: if first three are missing that would be (0, 0, 0, 0, 5...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Скобку в комменте не закрыл.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не вижу.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(0, 0, 0, 0, 5...

Comment thread knp/backends/gpu/cuda-backend/impl/cuda_lib/vector.cuh Outdated
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_bus/subscription.cuh Outdated
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_lib/vector.cuh Outdated
Comment thread knp/backends/gpu/cuda-backend/impl/backend.cu Outdated
Comment thread knp/backends/gpu/cuda-backend/impl/backend_impl.cu
Comment thread knp/backends/gpu/cuda-backend/impl/backend_impl.cuh
Comment thread knp/backends/gpu/cuda-backend/impl/backend_impl.cuh
Comment thread knp/base-framework/impl/network.cpp Outdated
Comment thread examples/mnist-learn/main.cpp Outdated
Comment thread examples/mnist-learn/main.cpp
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_bus/messaging.cu Outdated
Comment thread knp/backends/gpu/cuda-backend/impl/backend.cu
Comment thread knp/backends/gpu/cuda-backend/CMakeLists.txt Outdated
Comment thread knp/base-framework/include/knp/framework/network.h Outdated

@a-vartenkov a-vartenkov left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поисправлял основные. Порезолвь, посмотри, осталось ли чего.

Comment thread knp/base-framework/impl/network.cpp Outdated
Comment thread examples/mnist-learn/models/network_functions.h
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_bus/message_bus.cu
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_bus/messaging.cu
Comment thread knp/backends/gpu/cuda-backend/impl/uid.cuh
Comment thread knp/tests/framework/slicing_generators_test.cpp Outdated
Comment thread examples/mnist-learn/model_desc.h
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_bus/messaging.cu Outdated
Comment thread knp/backends/gpu/cuda-backend/impl/cuda_bus/messaging.cu Outdated
Comment thread knp/backends/gpu/cuda-backend/impl/projection.cuh Outdated

@a-vartenkov a-vartenkov left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ответил на часть комментов.

*/
__host__ unsigned long long count_values_by_indexes(const ValueIndex &index,
const CUDAVectorView<cuda::SpikeIndex> inputs);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

После функций идёт 2 пустые строки.

for (auto iter = buffer.begin(); iter != buffer.end(); ++iter)
{
LongIndex current_neuron = (*iter).first;
// Filling offsets for skipped neurons: if first three are missing that would be (0, 0, 0, 0, 5...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(0, 0, 0, 0, 5...

Comment thread knp/tests/framework/slicing_generators_test.cpp
Comment thread knp/backends/gpu/cuda-backend/impl/backend_impl.cu
REGISTER_CUDA_VECTOR_TYPE(knp::backends::gpu::cuda::CUDABackendImpl::PopulationVariants); \
REGISTER_CUDA_VECTOR_TYPE(knp::backends::gpu::cuda::CUDABackendImpl::ProjectionVariants); \
REGISTER_CUDA_VECTOR_TYPE(knp::backends::gpu::cuda::CUDAPopulation<knp::neuron_traits::BLIFATNeuron>); \
REGISTER_CUDA_VECTOR_TYPE(knp::backends::gpu::cuda::CUDAProjection<knp::synapse_traits::DeltaSynapse>); \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хотя бы коммент поставь, что надо сделать циклическим макросом.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants