• S sverchok
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • Задачи 148
    • Задачи 148
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 21
    • Запросы на слияние 21
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • Wiki
    • Wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • nikitronn
  • sverchok
  • Запросы на слияние
  • !3185

Vectorize computations in some of *Formula nodes

  • Ревью изменений

  • Скачать
  • Почтовые патчи
  • Простое отличие
Слиты nikitronn запросил слияние vectorize_formulas_1 в master Май 09, 2020
  • Обзор 1
  • Коммиты 6
  • Конвейеры 0
  • Изменения 15

Created by: portnov

For the following nodes:

  • Curve Formula
  • Surface Formula
  • Scalar Field Formula
  • Vector Field Formula

allow to perform vectorized computations via numpy. Without vectorization, the formulas are evaluated for each input value separately. With vectorization, when the subsequent node calls something like surface.evaluate_array() to calculate values at a series of points, the formula is evaluated one time for the whole array. Calls to usual math module functions are automatically replaced with corresponding numpy calls.

In my experiments, I have speedups from 2x to 100x. As usual with vectorization, the more values you compute at the time, the bigger speedup you will have. So, the biggest speedup there will be for use, for example, of "scalar field formula" + "Marching Cubes" with high samples, or "Surface Formula" + "Evaluate Surface" with a lot of samples.

I suspect there might be either bugs or precision-related troubles when math functions are replaced with their numpy counterparts, though I've not experienced such. So I made this vectorization mode optional, but enabled by default. It may be disabled in the node's N panel.

Preflight checklist

Put an x letter in each brackets when you're done this item:

  • Code changes complete.
  • Code documentation complete.
  • Documentation for users complete (or not required, if user never sees these changes).
  • Manual testing done.
  • Unit-tests implemented.
  • Ready for merge.
Ответственный
Назначить
Проверяющие
Запросить ревью
Оценка трудозатрат
Исходная ветка: vectorize_formulas_1