Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task03 Уткин Илья ITMO #107

Open
wants to merge 1 commit into
base: task03
Choose a base branch
from

Conversation

illided
Copy link

@illided illided commented Sep 29, 2024

Program build log:
Compilation started
Compilation done
Linking started
Linking done
Device build started
Device build done
Kernel <sum_global_atomic> was successfully vectorized (8)
Kernel <sum_cycle> was not vectorized
Kernel <sum_cycle_coalesce> was successfully vectorized (8)
Kernel <sum_local_mem> was successfully vectorized (8)
Kernel <sum_tree> was successfully vectorized (8)
Done.

Runtime:
Бейзлайн. Все операции суммирования стоят в очереди и драйвер никак не захотет это оптимизировать
GPU sum_global_atomic: 2.36046+-0.0251082 s
GPU sum_global_atomic: 42.3647 millions/s

Разбили работу на несколько групп и в разы сократили количество атомарных сложений. Получили существенный буст. Однако судя из билд лога у компиятора не получилось векторизовать эту операцию
GPU sum_cycle: 0.0818463+-0.001403 s
GPU sum_cycle: 1221.8 millions/s

Здесь уже получилось векторизовать кернел, получили еще буст.
GPU sum_cycle_coalesce: 0.0582893+-0.0026487 s
GPU sum_cycle_coalesce: 1715.58 millions/s

Пользуемся локальным кэшем. Удивлен что дало буст учитывая что запускаюсь на цпу. Видимо VRAM мапится в RAM а кэш гпу в кэш процесора.
GPU sum_local_mem: 0.0461117+-0.00118241 s
GPU sum_local_mem: 2168.65 millions/s

Дерево на ЦПУ дает не особо хороший буст по сравнению с бейзлайном.
GPU sum_tree: 0.162337+-0.00387873 s
GPU sum_tree: 616.001 millions/s

std::cout << "GPU sum_global_atomic: " << (n/1000.0/1000.0) / t.lapAvg() << " millions/s" << std::endl;
}

{
Copy link
Collaborator

Choose a reason for hiding this comment

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

В этой и следующей версии один поток выполняет больше работы, сказывается ли это как-то на конфигурации рабочего пространства? (а конфигурация на производительности)

if (lid == 0) {
unsigned int group_res = 0;
for (unsigned int i = 0; i < get_local_size(0); i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Есть ли здесь какое-то отличие между WORKGROUP SIZE и get_local_size?

Copy link
Collaborator

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